PageRenderTime 58ms CodeModel.GetById 32ms app.highlight 24ms RepoModel.GetById 1ms app.codeStats 0ms

/core/math/math-tests.factor

http://github.com/abeaumont/factor
Unknown | 88 lines | 71 code | 17 blank | 0 comment | 0 complexity | eab54bbb61c9c21169c4b158e825c26d MD5 | raw file
 1USING: kernel math namespaces make tools.test ;
 2IN: math.tests
 3
 4[ ] [ 5 [ ] times ] unit-test
 5[ ] [ 0 [ ] times ] unit-test
 6[ ] [ -1 [ ] times ] unit-test
 7
 8[ ] [ 5 [ drop ] each-integer ] unit-test
 9[ [ 0 1 2 3 4 ] ] [ [ 5 [ , ] each-integer ] [ ] make ] unit-test
10[ [ ] ] [ [ -1 [ , ] each-integer ] [ ] make ] unit-test
11
12[ f ] [ 1/0. fp-nan? ] unit-test
13[ f ] [ -1/0. fp-nan? ] unit-test
14[ t ] [ -0/0. fp-nan? ] unit-test
15[ t ] [ 1 <fp-nan> fp-nan? ] unit-test
16! [ t ] [ 1 <fp-nan> fp-snan? ] unit-test
17! [ f ] [ 1 <fp-nan> fp-qnan? ] unit-test
18[ t ] [ 0x8000000000001 <fp-nan> fp-nan? ] unit-test
19[ f ] [ 0x8000000000001 <fp-nan> fp-snan? ] unit-test
20[ t ] [ 0x8000000000001 <fp-nan> fp-qnan? ] unit-test
21
22[ t ] [ 1/0. fp-infinity? ] unit-test
23[ t ] [ -1/0. fp-infinity? ] unit-test
24[ f ] [ -0/0. fp-infinity? ] unit-test
25
26[ f ] [ 0 <fp-nan> fp-nan? ] unit-test
27[ t ] [ 0 <fp-nan> fp-infinity? ] unit-test
28
29[ t ] [  0.0 neg -0.0 fp-bitwise= ] unit-test
30[ t ] [ -0.0 neg  0.0 fp-bitwise= ] unit-test
31
32[ 0.0 ] [ -0.0 next-float ] unit-test
33[ t ] [ 1.0 dup next-float < ] unit-test
34[ t ] [ -1.0 dup next-float < ] unit-test
35
36[ -0.0 ] [ 0.0 prev-float ] unit-test
37[ t ] [ 1.0 dup prev-float > ] unit-test
38[ t ] [ -1.0 dup prev-float > ] unit-test
39
40[ f ] [ 0/0.  0/0. = ] unit-test
41[ f ] [ 0/0.  1.0  = ] unit-test
42[ f ] [ 0/0.  1/0. = ] unit-test
43[ f ] [ 0/0. -1/0. = ] unit-test
44
45[ f ] [  0/0. 0/0. = ] unit-test
46[ f ] [  1.0  0/0. = ] unit-test
47[ f ] [ -1/0. 0/0. = ] unit-test
48[ f ] [  1/0. 0/0. = ] unit-test
49
50[ f ] [ 0/0.  0/0. < ] unit-test
51[ f ] [ 0/0.  1.0  < ] unit-test
52[ f ] [ 0/0.  1/0. < ] unit-test
53[ f ] [ 0/0. -1/0. < ] unit-test
54
55[ f ] [ 0/0.  0/0. <= ] unit-test
56[ f ] [ 0/0.  1.0  <= ] unit-test
57[ f ] [ 0/0.  1/0. <= ] unit-test
58[ f ] [ 0/0. -1/0. <= ] unit-test
59
60[ f ] [  0/0. 0/0. > ] unit-test
61[ f ] [  1.0  0/0. > ] unit-test
62[ f ] [ -1/0. 0/0. > ] unit-test
63[ f ] [  1/0. 0/0. > ] unit-test
64
65[ f ] [  0/0. 0/0. >= ] unit-test
66[ f ] [  1.0  0/0. >= ] unit-test
67[ f ] [ -1/0. 0/0. >= ] unit-test
68[ f ] [  1/0. 0/0. >= ] unit-test
69
70[ f ] [ 0 neg? ] unit-test
71[ f ] [ 1/2 neg? ] unit-test
72[ f ] [ 1 neg? ] unit-test
73[ t ] [ -1/2 neg? ] unit-test
74[ t ] [ -1 neg? ] unit-test
75
76[ f ] [ 0.0 neg? ] unit-test
77[ f ] [ 1.0 neg? ] unit-test
78[ f ] [ 1/0. neg? ] unit-test
79[ t ] [ -0.0 neg? ] unit-test
80[ t ] [ -1.0 neg? ] unit-test
81[ t ] [ -1/0. neg? ] unit-test
82
83{ -0x3fffffff } [ 0x3ffffffe >bignum bitnot ] unit-test
84{ -0x40000000 } [ 0x3fffffff >bignum bitnot ] unit-test
85{ -0x40000001 } [ 0x40000000 >bignum bitnot ] unit-test
86{ -0x3fffffffffffffff } [ 0x3ffffffffffffffe >bignum bitnot ] unit-test
87{ -0x4000000000000000 } [ 0x3fffffffffffffff >bignum bitnot ] unit-test
88{ -0x4000000000000001 } [ 0x4000000000000000 >bignum bitnot ] unit-test