From 0603050d3081142c721ed3370dd289296266e5de Mon Sep 17 00:00:00 2001 From: hugogogo Date: Fri, 15 May 2026 02:30:13 +0200 Subject: [PATCH] fix atoi_supescript --- Makefile | 2 +- libft | 2 +- tester.sh | 338 +++++++++++++++++++++++++++--------------------------- 3 files changed, 171 insertions(+), 171 deletions(-) diff --git a/Makefile b/Makefile index 6622355..73861e6 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,7 @@ run: $(NAME) test: $(NAME) @echo $(B_PURPLE)"\n---------------------------------------------\nlaunch tests\n"$(RESET) - -@bash tester.sh -d + -@bash tester.sh clean: $(RM_OBJS) diff --git a/libft b/libft index e95f55c..71806cb 160000 --- a/libft +++ b/libft @@ -1 +1 @@ -Subproject commit e95f55c07f6a1e1b95dde698c4d21c6ac22ee9a9 +Subproject commit 71806cb923b2cb5e8af037ade6d06dec69bbda22 diff --git a/tester.sh b/tester.sh index 8373a04..f5f2bc6 100644 --- a/tester.sh +++ b/tester.sh @@ -201,189 +201,189 @@ run_test \ Reduced form: 0 * x^0 - 6 * x^1 + 3 * x^2 = 0 Polynomial degree: 2 Discriminant is strictly positive, the two solutions are: +2 +0" + +run_test \ +"10. degree 2" \ +"3 * x^2 + 2 * x - 7 * x^1 = x" "\ +Reduced form: 0 * x^0 - 6 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly positive, the two solutions are: +2 +0" + +run_test \ +"11. degree 2" \ +"-3x² + 2x -7 = x" "\ +Reduced form: -7 * x^0 + 1 * x^1 - 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly negative, the two complex solutions are: +0.166667 - 1.51841*i +0.166667 + 1.51841*i" + +run_test \ +"12. degree 2" \ +"+3x² + 2x -7 = x" "\ +Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly positive, the two solutions are: +1.36992 +-1.70326" + +run_test \ +"13. degree 2" \ +"3x² + 0x -7 = x" "\ +Reduced form: -7 * x^0 - 1 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly positive, the two solutions are: +1.70326 +-1.36992" + +run_test \ +"14. degree 2" \ +"3x² + 0x -0 = x" "\ +Reduced form: 0 * x^0 - 1 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly positive, the two solutions are: +0.333333 +0" + +run_test \ +"15. degree 2" \ +"3x² + 2x -0 = x" "\ +Reduced form: 0 * x^0 + 1 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly positive, the two solutions are: 0 -2" +-0.333333" -# run_test \ -# "10. degree 2" \ -# "3 * x^2 + 2 * x - 7 * x^1 = x" "\ -# Reduced form: 0 * x^0 - 6 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly positive, the two solutions are: -# 2 -# 0" +run_test \ +"16. degree 1" \ +"3x + 2x -0 = x" "\ +Reduced form: 0 * x^0 + 4 * x^1 = 0 +Polynomial degree: 1 +The solution is: +0" -# run_test \ -# "11. degree 2" \ -# "-3x² + 2x -7 = x" "\ -# Reduced form: -7 * x^0 + 1 * x^1 - 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly negative, the two complex solutions are: -# 0.166667 - 1.51841*i -# 0.166667 + 1.51841*i" +run_test \ +"17. degree 2" \ +"3x² + x -0 = x" "\ +Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Radicant is equal to zero, the solution is: +0" -# run_test \ -# "12. degree 2" \ -# "+3x² + 2x -7 = x" "\ -# Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly positive, the two solutions are: -# 1.36992 -# -1.70326" +run_test \ +"18. degree 2" \ +"0x² + x -0 = x" "\ +Reduced form: 0 * x^0 = 0 +Any real number is a solution." -# run_test \ -# "13. degree 2" \ -# "3x² + 0x -7 = x" "\ -# Reduced form: -7 * x^0 - 1 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly positive, the two solutions are: -# 1.70326 -# -1.36992" +run_test \ +"19. degree 5" \ +"2x⁵ + x -0 = -7x^5" "\ +Reduced form: 0 * x^0 + 1 * x^1 + 0 * x^2 + 0 * x^3 + 0 * x^4 + 9 * x^5 = 0 +Polynomial degree: 5 +The polynomial degree is strictly greater than 2, I can't solve." -# run_test \ -# "14. degree 2" \ -# "3x² + 0x -0 = x" "\ -# Reduced form: 0 * x^0 - 1 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly positive, the two solutions are: -# 0.333333 -# 0" +run_test \ +"20. degree 1" \ +"2x + x -0 = -7x" "\ +Reduced form: 0 * x^0 + 10 * x^1 = 0 +Polynomial degree: 1 +The solution is: +0" -# run_test \ -# "15. degree 2" \ -# "3x² + 2x -0 = x" "\ -# Reduced form: 0 * x^0 + 1 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly positive, the two solutions are: -# 0 -# -0.333333" +run_test \ +"21. degree 1" \ +"2x + x -3 = -7x" "\ +Reduced form: -3 * x^0 + 10 * x^1 = 0 +Polynomial degree: 1 +The solution is: +0.3" -# run_test \ -# "16. degree 1" \ -# "3x + 2x -0 = x" "\ -# Reduced form: 0 * x^0 + 4 * x^1 = 0 -# Polynomial degree: 1 -# The solution is: -# 0" +run_test \ +"22. degree 1" \ +"-2x + x -3 = -7x" "\ +Reduced form: -3 * x^0 + 6 * x^1 = 0 +Polynomial degree: 1 +The solution is: +0.5" -# run_test \ -# "17. degree 2" \ -# "3x² + x -0 = x" "\ -# Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is equal to zero, the solution is: -# 0" +run_test \ +"23. degree 2 without [=]" \ +"3x^2" \ +"" \ +error -# run_test \ -# "18. degree 2" \ -# "0x² + x -0 = x" "\ -# Reduced form: 0 * x^0 = 0 -# Any real number is a solution." +run_test \ +"24. degree 2" \ +"3x^2 = 0" "\ +Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Radicant is equal to zero, the solution is: +0" -# run_test \ -# "19. degree 5" \ -# "2x⁵ + x -0 = -7x^5" "\ -# Reduced form: 0 * x^0 + 1 * x^1 + 0 * x^2 + 0 * x^3 + 0 * x^4 + 9 * x^5 = 0 -# Polynomial degree: 5 -# The polynomial degree is strictly greater than 2, I can't solve." +run_test \ +"25. degree 2" \ +"3x^2 + 2 = 0" "\ +Reduced form: 2 * x^0 + 0 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Radicant is strictly negative, the two complex solutions are: +i√(2/3) +-i√(2/3)" -# run_test \ -# "20. degree 1" \ -# "2x + x -0 = -7x" "\ -# Reduced form: 0 * x^0 + 10 * x^1 = 0 -# Polynomial degree: 1 -# The solution is: -# 0" +run_test \ +"26. degree 2 pure" \ +"3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\ +Reduced form: -2 * x^0 + 0 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Radicant is strictly positive, the two solutions are: +√(2/3) +-√(2/3)" -# run_test \ -# "21. degree 1" \ -# "2x + x -3 = -7x" "\ -# Reduced form: -3 * x^0 + 10 * x^1 = 0 -# Polynomial degree: 1 -# The solution is: -# 0.3" +run_test \ +"27. degree 2 pure" \ +"9 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\ +Reduced form: -2 * x^0 + 0 * x^1 + 9 * x^2 = 0 +Polynomial degree: 2 +Radicant is strictly positive, the two solutions are: +√(2)/3 +-√(2)/3" -# run_test \ -# "22. degree 1" \ -# "-2x + x -3 = -7x" "\ -# Reduced form: -3 * x^0 + 6 * x^1 = 0 -# Polynomial degree: 1 -# The solution is: -# 0.5" +run_test \ +"28. degree 2 pure" \ +"3 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\ +Reduced form: -4 * x^0 + 0 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Radicant is strictly positive, the two solutions are: +2/√(3) +-2/√(3)" -# run_test \ -# "23. degree 2 without [=]" \ -# "3x^2" \ -# "" \ -# error +run_test \ +"29. degree 2 pure" \ +"16 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\ +Reduced form: -4 * x^0 + 0 * x^1 + 16 * x^2 = 0 +Polynomial degree: 2 +Radicant is strictly positive, the two solutions are: +1/2 +-1/2" -# run_test \ -# "24. degree 2" \ -# "3x^2 = 0" "\ -# Reduced form: 0 * x^0 + 0 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is equal to zero, the solution is: -# 0" +run_test \ +"30. degree 2 pure" \ +"4 * x^2 + 5 * x^1 - 16 * x^0 = 5 * x" "\ +Reduced form: -16 * x^0 + 0 * x^1 + 4 * x^2 = 0 +Polynomial degree: 2 +Radicant is strictly positive, the two solutions are: +2 +-2" -# run_test \ -# "25. degree 2" \ -# "3x^2 + 2 = 0" "\ -# Reduced form: 2 * x^0 + 0 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is strictly negative, the two complex solutions are: -# i√(2/3) -# -i√(2/3)" - -# run_test \ -# "26. degree 2 pure" \ -# "3 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\ -# Reduced form: -2 * x^0 + 0 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is strictly positive, the two solutions are: -# √(2/3) -# -√(2/3)" - -# run_test \ -# "27. degree 2 pure" \ -# "9 * x^2 + 5 * x^1 - 2 * x^0 = 5 * x" "\ -# Reduced form: -2 * x^0 + 0 * x^1 + 9 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is strictly positive, the two solutions are: -# √(2)/3 -# -√(2)/3" - -# run_test \ -# "28. degree 2 pure" \ -# "3 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\ -# Reduced form: -4 * x^0 + 0 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is strictly positive, the two solutions are: -# 2/√(3) -# -2/√(3)" - -# run_test \ -# "29. degree 2 pure" \ -# "16 * x^2 + 5 * x^1 - 4 * x^0 = 5 * x" "\ -# Reduced form: -4 * x^0 + 0 * x^1 + 16 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is strictly positive, the two solutions are: -# 1/2 -# -1/2" - -# run_test \ -# "30. degree 2 pure" \ -# "4 * x^2 + 5 * x^1 - 16 * x^0 = 5 * x" "\ -# Reduced form: -16 * x^0 + 0 * x^1 + 4 * x^2 = 0 -# Polynomial degree: 2 -# Radicant is strictly positive, the two solutions are: -# 2 -# -2" - -# run_test \ -# "31. degree 2" \ -# "3x² + 2x -7 = x" "\ -# Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0 -# Polynomial degree: 2 -# Discriminant is strictly positive, the two solutions are: -# 1.36992 -# -1.70326" +run_test \ +"31. degree 2" \ +"3x² + 2x -7 = x" "\ +Reduced form: -7 * x^0 + 1 * x^1 + 3 * x^2 = 0 +Polynomial degree: 2 +Discriminant is strictly positive, the two solutions are: +1.36992 +-1.70326"