summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Clerc <xavier.clerc@inria.fr>2010-01-29 13:01:31 +0000
committerXavier Clerc <xavier.clerc@inria.fr>2010-01-29 13:01:31 +0000
commitb50f60e1388e8583f0a21d0fea7140fefeef6d18 (patch)
treec293cf810806d887c3dabccd8cef5430091d299e
parentce9a2a9708feb08a57bf59b98a5fdf9342473b57 (diff)
downloadocaml-b50f60e1388e8583f0a21d0fea7140fefeef6d18.tar.gz
Tests moved to 'lib-num*'
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9603 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--otherlibs/num/test/.depend10
-rw-r--r--otherlibs/num/test/Makefile76
-rw-r--r--otherlibs/num/test/Makefile.nt61
-rw-r--r--test/test_bng.c (renamed from otherlibs/num/test/test_bng.c)2
-rw-r--r--testsuite/tests/lib-num-2/Makefile5
-rw-r--r--testsuite/tests/lib-num-2/pi_big_int.ml (renamed from otherlibs/num/test/pi_big_int.ml)0
-rw-r--r--testsuite/tests/lib-num-2/pi_big_int.reference100
-rw-r--r--testsuite/tests/lib-num-2/pi_num.ml (renamed from otherlibs/num/test/pi_num.ml)0
-rw-r--r--testsuite/tests/lib-num-2/pi_num.reference100
-rw-r--r--testsuite/tests/lib-num/Makefile7
-rw-r--r--testsuite/tests/lib-num/end_test.ml (renamed from otherlibs/num/test/end_test.ml)0
-rw-r--r--testsuite/tests/lib-num/end_test.reference162
-rw-r--r--testsuite/tests/lib-num/test.ml (renamed from otherlibs/num/test/test.ml)23
-rw-r--r--testsuite/tests/lib-num/test_big_ints.ml (renamed from otherlibs/num/test/test_big_ints.ml)1
-rw-r--r--testsuite/tests/lib-num/test_io.ml (renamed from otherlibs/num/test/test_io.ml)0
-rw-r--r--testsuite/tests/lib-num/test_nats.ml (renamed from otherlibs/num/test/test_nats.ml)2
-rw-r--r--testsuite/tests/lib-num/test_nums.ml (renamed from otherlibs/num/test/test_nums.ml)1
-rw-r--r--testsuite/tests/lib-num/test_ratios.ml (renamed from otherlibs/num/test/test_ratios.ml)1
18 files changed, 397 insertions, 154 deletions
diff --git a/otherlibs/num/test/.depend b/otherlibs/num/test/.depend
deleted file mode 100644
index 28fea1f58e..0000000000
--- a/otherlibs/num/test/.depend
+++ /dev/null
@@ -1,10 +0,0 @@
-end_test.cmo: test.cmo
-end_test.cmx: test.cmx
-test_big_ints.cmo: test.cmo
-test_big_ints.cmx: test.cmx
-test_nats.cmo: test.cmo
-test_nats.cmx: test.cmx
-test_nums.cmo: test.cmo
-test_nums.cmx: test.cmx
-test_ratios.cmo: test.cmo
-test_ratios.cmx: test.cmx
diff --git a/otherlibs/num/test/Makefile b/otherlibs/num/test/Makefile
deleted file mode 100644
index aa6e34206c..0000000000
--- a/otherlibs/num/test/Makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-#########################################################################
-# #
-# Objective Caml #
-# #
-# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
-# #
-# Copyright 1999 Institut National de Recherche en Informatique et #
-# en Automatique. All rights reserved. This file is distributed #
-# under the terms of the GNU Library General Public License, with #
-# the special exception on linking described in file ../../../LICENSE.#
-# #
-#########################################################################
-
-# $Id$
-
-include ../../../config/Makefile
-
-CAMLC=../../../boot/ocamlrun ../../../ocamlc -I ../../../stdlib -w A -warn-error A
-CAMLOPT=../../../boot/ocamlrun ../../../ocamlopt -I ../../../stdlib
-CC=$(BYTECC)
-CFLAGS=-I.. -I../../../byterun $(BYTECCCOMPOPTS)
-
-test: test.byt test.opt test_pi
- if $(SUPPORTS_SHARED_LIBRARIES); \
- then ../../../byterun/ocamlrun -I .. ./test.byt; else ./test.byt; fi
- ./test.opt
-
-TESTFILES=test.cmo \
- test_nats.cmo test_big_ints.cmo test_ratios.cmo test_nums.cmo \
- test_io.cmo end_test.cmo
-
-TESTOPTFILES=$(TESTFILES:.cmo=.cmx)
-
-test.byt: $(TESTFILES) ../nums.cma ../libnums.a
- $(CAMLC) -ccopt -L.. -I .. -o test.byt -g ../nums.cma $(TESTFILES)
-
-test.opt: $(TESTOPTFILES) ../nums.cmxa ../libnums.a
- $(CAMLOPT) -ccopt -L.. -I .. -o test.opt ../nums.cmxa $(TESTOPTFILES)
-
-test_bng: test_bng.o
- $(CC) $(CFLAGS) -o test_bng ../bng.o test_bng.o -lbignum
-
-$(TESTOPTFILES): ../../../ocamlopt
-
-test_pi: test_pi.byt test_pi.bin
-
-test_pi.byt: pi_big_int.cmo pi_num.cmo
- $(CAMLC) -ccopt -L.. -I .. -o pi_big_int.byt -g ../nums.cma pi_big_int.cmo
- $(CAMLC) -ccopt -L.. -I .. -o pi_num.byt -g ../nums.cma pi_num.cmo
- ./pi_big_int.byt 1000
- ./pi_num.byt 1000
-
-test_pi.bin: pi_big_int.cmx pi_num.cmx
- $(CAMLOPT) -ccopt -L.. -I .. -o pi_big_int.bin -g ../nums.cmxa pi_big_int.cmx
- $(CAMLOPT) -ccopt -L.. -I .. -o pi_num.bin -g ../nums.cmxa pi_num.cmx
- ./pi_big_int.bin 1000
- ./pi_num.bin 1000
-
-.SUFFIXES: .ml .cmo .cmx
-
-.ml.cmo:
- $(CAMLC) -I .. -c -g $<
-
-.ml.cmx:
- $(CAMLOPT) -I .. -c $<
-
-ocamlnum:
- ocamlmktop -o ocamlnum -custom ../nums.cma ../libnums.a
-
-clean:
- rm -f *.byt *.opt *.bin test_bng *.o *.cm? ocamlnum *~
-
-depend:
- ocamldep *.ml > .depend
-
-include .depend
diff --git a/otherlibs/num/test/Makefile.nt b/otherlibs/num/test/Makefile.nt
deleted file mode 100644
index 11faa025a9..0000000000
--- a/otherlibs/num/test/Makefile.nt
+++ /dev/null
@@ -1,61 +0,0 @@
-#########################################################################
-# #
-# Objective Caml #
-# #
-# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
-# #
-# Copyright 1999 Institut National de Recherche en Informatique et #
-# en Automatique. All rights reserved. This file is distributed #
-# under the terms of the GNU Library General Public License, with #
-# the special exception on linking described in file ../../../LICENSE.#
-# #
-#########################################################################
-
-# $Id$
-
-include ../../../config/Makefile
-
-CAMLC=../../../boot/ocamlrun ../../../ocamlc -I ../../../stdlib -I ..
-CAMLOPT=../../../boot/ocamlrun ../../../ocamlopt -I ../../../stdlib -I ..
-CC=$(BYTECC)
-CFLAGS=-I.. $(BYTECCCOMPOPTS)
-
-test: test.byt test.opt
- ../../../byterun/ocamlrun -I .. ./test.byt
- ./test.opt
-
-TESTFILES=test.cmo \
- test_nats.cmo test_big_ints.cmo test_ratios.cmo test_nums.cmo \
- test_io.cmo end_test.cmo
-
-TESTOPTFILES=$(TESTFILES:.cmo=.cmx)
-
-test.byt: $(TESTFILES) ../nums.cma ../libnums.$(A)
- $(CAMLC) -o test.byt nums.cma $(TESTFILES)
-
-test.opt: $(TESTOPTFILES) ../nums.cmxa ../libnums.$(A)
- $(CAMLOPT) -o test.opt nums.cmxa $(TESTOPTFILES)
-
-test_bng.exe: test_bng.o
- $(CC) $(CFLAGS) -o test_bng.exe ../bng.o test_bng.o -lbignum
-
-$(TESTOPTFILES): ../../../ocamlopt
-
-.SUFFIXES: .ml .cmo .cmx
-
-.ml.cmo:
- $(CAMLC) -c $<
-
-.ml.cmx:
- $(CAMLOPT) -c $<
-
-ocamltopnum.exe:
- ocamlmktop -o ocamltopnum.exe -custom ../nums.cma ../libnums.$(A)
-
-clean:
- rm -f test.byt test.opt test_bng.exe *.$(O) *.cm? ocamltopnum.exe
-
-depend:
- ocamldep *.ml > .depend
-
-include .depend
diff --git a/otherlibs/num/test/test_bng.c b/test/test_bng.c
index 4fedcdfd56..2d6a6e8088 100644
--- a/otherlibs/num/test/test_bng.c
+++ b/test/test_bng.c
@@ -11,7 +11,7 @@
/* */
/***********************************************************************/
-/* $Id$ */
+/* $Id: test_bng.c 5900 2003-11-07 07:59:10Z xleroy $ */
/* Test harness for the BNG primitives. Use BigNum as a reference. */
diff --git a/testsuite/tests/lib-num-2/Makefile b/testsuite/tests/lib-num-2/Makefile
new file mode 100644
index 0000000000..7b7ffec4f6
--- /dev/null
+++ b/testsuite/tests/lib-num-2/Makefile
@@ -0,0 +1,5 @@
+LIBRARIES=nums
+PROGRAM_ARGS=1000
+
+include ../../makefiles/Makefile.several
+include ../../makefiles/Makefile.common
diff --git a/otherlibs/num/test/pi_big_int.ml b/testsuite/tests/lib-num-2/pi_big_int.ml
index 22872ba483..22872ba483 100644
--- a/otherlibs/num/test/pi_big_int.ml
+++ b/testsuite/tests/lib-num-2/pi_big_int.ml
diff --git a/testsuite/tests/lib-num-2/pi_big_int.reference b/testsuite/tests/lib-num-2/pi_big_int.reference
new file mode 100644
index 0000000000..ad4dc9962b
--- /dev/null
+++ b/testsuite/tests/lib-num-2/pi_big_int.reference
@@ -0,0 +1,100 @@
+3141592653 :10
+5897932384 :20
+6264338327 :30
+9502884197 :40
+1693993751 :50
+0582097494 :60
+4592307816 :70
+4062862089 :80
+9862803482 :90
+5342117067 :100
+9821480865 :110
+1328230664 :120
+7093844609 :130
+5505822317 :140
+2535940812 :150
+8481117450 :160
+2841027019 :170
+3852110555 :180
+9644622948 :190
+9549303819 :200
+6442881097 :210
+5665933446 :220
+1284756482 :230
+3378678316 :240
+5271201909 :250
+1456485669 :260
+2346034861 :270
+0454326648 :280
+2133936072 :290
+6024914127 :300
+3724587006 :310
+6063155881 :320
+7488152092 :330
+0962829254 :340
+0917153643 :350
+6789259036 :360
+0011330530 :370
+5488204665 :380
+2138414695 :390
+1941511609 :400
+4330572703 :410
+6575959195 :420
+3092186117 :430
+3819326117 :440
+9310511854 :450
+8074462379 :460
+9627495673 :470
+5188575272 :480
+4891227938 :490
+1830119491 :500
+2983367336 :510
+2440656643 :520
+0860213949 :530
+4639522473 :540
+7190702179 :550
+8609437027 :560
+7053921717 :570
+6293176752 :580
+3846748184 :590
+6766940513 :600
+2000568127 :610
+1452635608 :620
+2778577134 :630
+2757789609 :640
+1736371787 :650
+2146844090 :660
+1224953430 :670
+1465495853 :680
+7105079227 :690
+9689258923 :700
+5420199561 :710
+1212902196 :720
+0864034418 :730
+1598136297 :740
+7477130996 :750
+0518707211 :760
+3499999983 :770
+7297804995 :780
+1059731732 :790
+8160963185 :800
+9502445945 :810
+5346908302 :820
+6425223082 :830
+5334468503 :840
+5261931188 :850
+1710100031 :860
+3783875288 :870
+6587533208 :880
+3814206171 :890
+7766914730 :900
+3598253490 :910
+4287554687 :920
+3115956286 :930
+3882353787 :940
+5937519577 :950
+8185778053 :960
+2171226806 :970
+6130019278 :980
+7661119590 :990
+9216420198 :1000
diff --git a/otherlibs/num/test/pi_num.ml b/testsuite/tests/lib-num-2/pi_num.ml
index b36250825a..b36250825a 100644
--- a/otherlibs/num/test/pi_num.ml
+++ b/testsuite/tests/lib-num-2/pi_num.ml
diff --git a/testsuite/tests/lib-num-2/pi_num.reference b/testsuite/tests/lib-num-2/pi_num.reference
new file mode 100644
index 0000000000..ad4dc9962b
--- /dev/null
+++ b/testsuite/tests/lib-num-2/pi_num.reference
@@ -0,0 +1,100 @@
+3141592653 :10
+5897932384 :20
+6264338327 :30
+9502884197 :40
+1693993751 :50
+0582097494 :60
+4592307816 :70
+4062862089 :80
+9862803482 :90
+5342117067 :100
+9821480865 :110
+1328230664 :120
+7093844609 :130
+5505822317 :140
+2535940812 :150
+8481117450 :160
+2841027019 :170
+3852110555 :180
+9644622948 :190
+9549303819 :200
+6442881097 :210
+5665933446 :220
+1284756482 :230
+3378678316 :240
+5271201909 :250
+1456485669 :260
+2346034861 :270
+0454326648 :280
+2133936072 :290
+6024914127 :300
+3724587006 :310
+6063155881 :320
+7488152092 :330
+0962829254 :340
+0917153643 :350
+6789259036 :360
+0011330530 :370
+5488204665 :380
+2138414695 :390
+1941511609 :400
+4330572703 :410
+6575959195 :420
+3092186117 :430
+3819326117 :440
+9310511854 :450
+8074462379 :460
+9627495673 :470
+5188575272 :480
+4891227938 :490
+1830119491 :500
+2983367336 :510
+2440656643 :520
+0860213949 :530
+4639522473 :540
+7190702179 :550
+8609437027 :560
+7053921717 :570
+6293176752 :580
+3846748184 :590
+6766940513 :600
+2000568127 :610
+1452635608 :620
+2778577134 :630
+2757789609 :640
+1736371787 :650
+2146844090 :660
+1224953430 :670
+1465495853 :680
+7105079227 :690
+9689258923 :700
+5420199561 :710
+1212902196 :720
+0864034418 :730
+1598136297 :740
+7477130996 :750
+0518707211 :760
+3499999983 :770
+7297804995 :780
+1059731732 :790
+8160963185 :800
+9502445945 :810
+5346908302 :820
+6425223082 :830
+5334468503 :840
+5261931188 :850
+1710100031 :860
+3783875288 :870
+6587533208 :880
+3814206171 :890
+7766914730 :900
+3598253490 :910
+4287554687 :920
+3115956286 :930
+3882353787 :940
+5937519577 :950
+8185778053 :960
+2171226806 :970
+6130019278 :980
+7661119590 :990
+9216420198 :1000
diff --git a/testsuite/tests/lib-num/Makefile b/testsuite/tests/lib-num/Makefile
new file mode 100644
index 0000000000..8b7b327a09
--- /dev/null
+++ b/testsuite/tests/lib-num/Makefile
@@ -0,0 +1,7 @@
+MODULES=test test_nats test_big_ints test_ratios test_nums test_io
+MAIN_MODULE=end_test
+ADD_COMPFLAGS=-w a
+LIBRARIES=nums
+
+include ../../makefiles/Makefile.one
+include ../../makefiles/Makefile.common
diff --git a/otherlibs/num/test/end_test.ml b/testsuite/tests/lib-num/end_test.ml
index 57e099eda5..57e099eda5 100644
--- a/otherlibs/num/test/end_test.ml
+++ b/testsuite/tests/lib-num/end_test.ml
diff --git a/testsuite/tests/lib-num/end_test.reference b/testsuite/tests/lib-num/end_test.reference
new file mode 100644
index 0000000000..274cef9058
--- /dev/null
+++ b/testsuite/tests/lib-num/end_test.reference
@@ -0,0 +1,162 @@
+
+num_digits_nat
+ -1... 0... 1...
+length_nat
+ 1...
+equal_nat
+ 1... 2... 3... 4...
+incr_nat
+ 1... 2... 3... 4...
+decr_nat
+ 1... 2... 3... 4...
+is_zero_nat
+ 1... 2... 3... 4...
+string_of_nat
+ 1... 2...
+string_of_nat && nat_of_string
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22...
+gcd_nat
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20...
+sqrt_nat
+ 1... 2... 3... 4... 5...
+compare_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13...
+pred_big_int
+ 1... 2... 3...
+succ_big_int
+ 1... 2... 3...
+add_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17...
+sub_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17...
+mult_int_big_int
+ 1... 2... 3... 4...
+mult_big_int
+ 1... 2... 3... 4... 5...
+quomod_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22... 23... 24... 25...
+gcd_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22... 23... 24... 25... 26... 27... 28...
+int_of_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8...
+is_int_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10...
+sys_string_of_big_int
+ 1...
+big_int_of_string
+ 1... 2... 4... 5... 6... 7... 9... 10...
+power_base_int
+ 1... 2... 3...
+base_power_big_int
+ 1... 2... 3...
+power_int_positive_big_int
+ 1... 2... 3... 4... 5... 6... 7...
+power_big_int_positive_int
+ 1... 2... 3... 4... 5...
+power_big_int_positive_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8... 9...
+square_big_int
+ 1... 2... 3... 4...
+big_int_of_nativeint
+ 1... 2... 3...
+nativeint_of_big_int
+ 1... 2... 2...
+big_int_of_int32
+ 1... 2... 3...
+int32_of_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8...
+big_int_of_int64
+ 1... 2... 3... 4... 5... 6... 7... 8...
+int64_of_big_int
+ 1... 2... 3... 4... 5... 6... 7... 8...
+and_big_int
+ 1... 2... 3... 4... 5... 6...
+or_big_int
+ 1... 2... 3... 4... 5... 6...
+xor_big_int
+ 1... 2... 3... 4... 5... 6...
+shift_left_big_int
+ 1... 2... 2... 3... 4... 5... 6...
+shift_right_big_int
+ 1... 2... 3... 4... 5...
+extract_big_int
+ 1... 2... 3... 4... 5... 6...
+create_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8...
+create_normalized_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10...
+null_denominator
+ 1... 2...
+sign_ratio
+ 1... 2... 3...
+normalize_ratio
+ 1... 2... 3... 4...
+report_sign_ratio
+ 1... 2...
+is_integer_ratio
+ 1... 2...
+add_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 1... 2... 3... 4...
+sub_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8...
+mult_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8...
+div_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8...
+integer_ratio
+ 1... 2... 3... 4... 5...
+floor_ratio
+ 1... 2... 3... 4... 5...
+round_ratio
+ 1... 2... 3... 4... 5...
+ceiling_ratio
+ 1... 2... 3... 4... 5... 6...
+eq_ratio
+ 1... 2... 3... 4... 5...
+compare_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22... 23... 24... 25... 26... 27... 28... 29... 30... 31... 32... 33... 34... 35... 36...
+eq_big_int_ratio
+ 1... 2... 3... 4... 5...
+compare_big_int_ratio
+ 1... 2... 3... 4... 5... 6... 7... 8... 9...
+int_of_ratio
+ 1... 2... 3... 4... 5...
+ratio_of_int
+ 1... 2...
+nat_of_ratio
+ 1... 2... 3... 4...
+ratio_of_big_int
+ 1...
+big_int_of_ratio
+ 1... 2... 3...
+string_of_ratio
+ 1... 2... 3... 4...
+ratio_of_string
+ 1... 6... 7... 8...
+round_futur_last_digit
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22... 23... 24...
+approx_ratio_fix
+ 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14...
+approx_ratio_exp
+ 1... 2... 3... 4... 5... 6... 7... 8... 9...
+add_num
+ 1... 2... 3... 4... 5... 6... 7... 8... 9...
+sub_num
+ 1... 2... 3... 4... 5... 7... 8... 9... 10...
+mult_num
+ 1... 2... 3... 4... 5... 6... 7... 8... 9...
+div_num
+ 1... 2... 3... 4... 5... 6... 7... 8... 9...
+is_integer_num
+ 1... 2... 3... 4...
+num_of_ratio
+ 1... 2... 3...
+num_of_string
+ 1... 7... 8... 11...
+output_value/input_value on nats
+ 1... 2... 3... 4... 5... 6... 7...
+output_value/input_value on big ints
+ 1... 2... 3... 4... 5...
+output_value/input_value on nums
+ 1... 2... 3... 4... 5... 6... 7... 8...
+************* TESTS COMPLETED SUCCESSFULLY ****************
diff --git a/otherlibs/num/test/test.ml b/testsuite/tests/lib-num/test.ml
index f26ea82c20..fce8e36360 100644
--- a/otherlibs/num/test/test.ml
+++ b/testsuite/tests/lib-num/test.ml
@@ -66,9 +66,9 @@ let end_tests () =
flush_all ();
print_newline ();
if !error_occurred then begin
- prerr_endline "************* TESTS FAILED ****************"; exit 2
+ print_endline "************* TESTS FAILED ****************"; exit 2
end else begin
- prerr_endline "************* TESTS COMPLETED SUCCESSFULLY ****************";
+ print_endline "************* TESTS COMPLETED SUCCESSFULLY ****************";
exit 0
end;;
@@ -80,3 +80,22 @@ let eq_int32 (i: int32) (j: int32) = (i = j);;
let eq_int64 (i: int64) (j: int64) = (i = j);;
let sixtyfour = (1 lsl 31) <> 0;;
+
+let rec gcd_int i1 i2 =
+ if i2 = 0 then abs i1 else gcd_int i2 (i1 mod i2);;
+
+let rec num_bits_int_aux n =
+ if n = 0 then 0 else succ(num_bits_int_aux (n lsr 1));;
+
+let num_bits_int n = num_bits_int_aux (abs n);;
+
+let sign_int i = if i = 0 then 0 else if i > 0 then 1 else -1;;
+
+let length_of_int = Sys.word_size - 2;;
+
+let monster_int = 1 lsl length_of_int;;
+let biggest_int = monster_int - 1;;
+let least_int = - biggest_int;;
+
+let compare_int n1 n2 =
+ if n1 == n2 then 0 else if n1 > n2 then 1 else -1;;
diff --git a/otherlibs/num/test/test_big_ints.ml b/testsuite/tests/lib-num/test_big_ints.ml
index 8fdd04b40e..3474dd414e 100644
--- a/otherlibs/num/test/test_big_ints.ml
+++ b/testsuite/tests/lib-num/test_big_ints.ml
@@ -1,7 +1,6 @@
open Test;;
open Nat;;
open Big_int;;
-open Int_misc;;
open List;;
testing_function "compare_big_int";;
diff --git a/otherlibs/num/test/test_io.ml b/testsuite/tests/lib-num/test_io.ml
index 1df11a5fe6..1df11a5fe6 100644
--- a/otherlibs/num/test/test_io.ml
+++ b/testsuite/tests/lib-num/test_io.ml
diff --git a/otherlibs/num/test/test_nats.ml b/testsuite/tests/lib-num/test_nats.ml
index 923086ec1b..b47b39f8ee 100644
--- a/otherlibs/num/test/test_nats.ml
+++ b/testsuite/tests/lib-num/test_nats.ml
@@ -126,7 +126,7 @@ for i = 1 to 20 do
let nat1 = nat_of_int n1
and nat2 = nat_of_int n2 in
ignore (gcd_nat nat1 0 1 nat2 0 1);
- ignore (test i eq (int_of_nat nat1, Int_misc.gcd_int n1 n2))
+ ignore (test i eq (int_of_nat nat1, gcd_int n1 n2))
done
;;
diff --git a/otherlibs/num/test/test_nums.ml b/testsuite/tests/lib-num/test_nums.ml
index 424285808b..b26001bc76 100644
--- a/otherlibs/num/test/test_nums.ml
+++ b/testsuite/tests/lib-num/test_nums.ml
@@ -2,7 +2,6 @@ open Test;;
open Nat;;
open Big_int;;
open Ratio;;
-open Int_misc;;
open Num;;
open Arith_status;;
diff --git a/otherlibs/num/test/test_ratios.ml b/testsuite/tests/lib-num/test_ratios.ml
index df2001f123..8896fb8646 100644
--- a/otherlibs/num/test/test_ratios.ml
+++ b/testsuite/tests/lib-num/test_ratios.ml
@@ -2,7 +2,6 @@ open Test;;
open Nat;;
open Big_int;;
open Ratio;;
-open Int_misc;;
open Arith_status;;
set_error_when_null_denominator false