summaryrefslogtreecommitdiffstats
path: root/otherlibs/num
diff options
context:
space:
mode:
authorPierre Weis <Pierre.Weis@inria.fr>1999-09-02 17:58:43 +0000
committerPierre Weis <Pierre.Weis@inria.fr>1999-09-02 17:58:43 +0000
commita6be1053de9d6f2ea95f5bb2631adcb78c640f9f (patch)
treecee7e8ca4f940d8def14f720292e30dbaa16e0ae /otherlibs/num
parent3eac8b0537a1dbb5a188aa418109413be17bce63 (diff)
test_big_ints.ml: fix de square_big_int et sys_big_int_of_string par Damien
test.ml: flush sur stderr git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2396 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/num')
-rw-r--r--otherlibs/num/test/test.ml12
-rw-r--r--otherlibs/num/test/test_big_ints.ml9
2 files changed, 17 insertions, 4 deletions
diff --git a/otherlibs/num/test/test.ml b/otherlibs/num/test/test.ml
index 1458fdcb8..67d1d50b0 100644
--- a/otherlibs/num/test/test.ml
+++ b/otherlibs/num/test/test.ml
@@ -14,7 +14,8 @@ let test test_number eq_fun (answer, correct_answer) =
flush stdout;
flush stderr;
if not (eq_fun answer correct_answer) then begin
- fprintf stderr ">>> Bad result (%s, test %d)\n" !function_tested test_number;
+ fprintf stderr "*** Bad result (%s, test %d)\n" !function_tested test_number;
+ flush stderr;
error_occurred := true;
false
end else begin
@@ -27,8 +28,9 @@ let failure_test test_number fun_to_test arg =
flush stderr;
try
fun_to_test arg;
- fprintf stderr ">>> Failure expected (%s, test %d)\n"
+ fprintf stderr "*** Failure expected (%s, test %d)\n"
!function_tested test_number;
+ flush stderr;
error_occurred := true;
false
with _ ->
@@ -38,8 +40,9 @@ let failure_test test_number fun_to_test arg =
let failwith_test test_number fun_to_test arg correct_failure =
try
fun_to_test arg;
- fprintf stderr ">>> Failure expected (%s, test %d)\n"
+ fprintf stderr "*** Failure expected (%s, test %d)\n"
!function_tested test_number;
+ flush stderr;
error_occurred := true;
false
with x ->
@@ -47,8 +50,9 @@ let failwith_test test_number fun_to_test arg correct_failure =
printf " %d..." test_number;
true
end else begin
- fprintf stderr ">>> Bad failure (%s, test %d)\n"
+ fprintf stderr "*** Bad failure (%s, test %d)\n"
!function_tested test_number;
+ flush stderr;
error_occurred := true;
false
end
diff --git a/otherlibs/num/test/test_big_ints.ml b/otherlibs/num/test/test_big_ints.ml
index 5ccadfd02..858dba270 100644
--- a/otherlibs/num/test/test_big_ints.ml
+++ b/otherlibs/num/test/test_big_ints.ml
@@ -389,3 +389,12 @@ test 3
eq_big_int (base_power_big_int 10 1 (big_int_of_int 123), big_int_of_int 1230)
;;
+testing_function "square_big_int";;
+test 1 eq
+ (square_big_int (big_int_of_string "0"), big_int_of_string"0");;
+test 2 eq_big_int
+ (square_big_int (big_int_of_string "1"), big_int_of_string"1");;
+test 3 eq_big_int
+ (square_big_int (big_int_of_string "-1"), big_int_of_string"1");;
+test 4 eq_big_int
+ (square_big_int (big_int_of_string "-7"), big_int_of_string"49");;