Login
7 branches 0 tags
Ben (X13/Arch) Cleaned up the allocators by using more macros 83d6672 3 years ago 735 Commits
nujel / testsuite / arithmetic.nuj
[test/add 3 [+ 1 2]]
[test/add -1 [+ 1 -2]]
[test/add 3 [- 4 1]]
[test/add 5 [- 4 -1]]
[test/add 8 [* 4 2]]
[test/add 16 [* 4 4]]
[test/add 2 [/ 4 2]]
[test/add 2 [do 2]]
[test/add 4 [/ 8 2]]
[test/add 1 [rem 5 2]]
[test/add 0 [rem 4 2]]
[test/add 1 [int [round [rem 4.6 2]]]]
[test/add 0 [int [round [rem 4.4 2]]]]
[test/add 3 [int [vec/x [+ [vec 1.1 1.2 1.3] [vec 2 2 2]]]]]
[test/add 39 [+ 42 [- 3]]]
[test/add 24 [* 4 [- [+ 1 [+ 1 1]] [- 3 3 3]]]]
[test/add 3 [/ 9 3]]
[test/add 3 [let [[vier -4]] [+ [rem 9 4] [/ -9 vier]]]]
[test/add 69 [+ [* 2 [/ 32 8] [- 16 8]] 5]]
[test/add #nil [max]]
[test/add #nil [min]]
[test/add 1 [max 1]]
[test/add 4 [min 4]]
[test/add 4 [min 4 9]]
[test/add 9 [max 4 9]]
[test/add 25 [max 1 4 9 25]]
[test/add 25 [max '[1 4 9 25]]]
[test/add 25 [max #[1 4 9 25]]]
[test/add 25 [max 25 4 9 1]]
[test/add 25 [max '[25 4 9 1]]]
[test/add 25 [max #[25 4 9 1]]]
[test/add 1 [min 1 4 9 25]]
[test/add 1 [min '[1 4 9 25]]]
[test/add 1 [min #[1 4 9 25]]]
[test/add 1 [min 25 4 9 1]]
[test/add 1 [min '[25 4 9 1]]]
[test/add 1 [min #[25 4 9 1]]]
[test/add 256 [int [pow 2 8]]]
[test/add 256 [int [pow/int 2 8]]]
[test/add 1 [int [pow 1 8]]]
[test/add 1 [int [pow 1.0 8]]]
[test/add "0.5" [string/write [pow 2.0 -1.0]]]
[test/add "0.25" [string/write [pow 2.0 -2.0]]]
[test/add "0.125" [string/write [pow 2.0 -3.0]]]
[test/add 2 [int [sqrt 4]]]
[test/add 3 [int [sqrt 9]]]
[test/add 16 [int [* [sqrt 16] [sqrt 16]]]]
[test/add "3.0" [string/write [sqrt 9]]]
[test/add "#v[1.0 1.0 1.0 0.0]"[string/write  [floor [vec 1.3 1.3 1.3 0.3]]]]
[test/add "2.0" [string/write [ceil 1.3]]]
[test/add "#v[2.0 2.0 2.0 2.0]" [string/write [ceil [vec 1.3 1.3 1.3]]]]
[test/add "1.0" [string/write [round 1.3]]]
[test/add "2.0" [string/write [round 1.51]]]
[test/add "#v[5.0 5.0 5.0 5.0]" [string/write [sqrt [vec 25 25 25]]]]
[test/add "256.0" [string/write [pow 2.0 8]]]
[test/add "#v[4.0 8.0 16.0 16.0]" [string/write [pow 2.0 [vec 2.0 3.0 4.0]]]]
[test/add "2.0" [string/write [/ 1.0 0.5]]]
[test/add "0.5" [string/write [/ 1.0 2]]]
[test/add "0.1" [string/write [/ 1.0 10]]]
[test/add "0.1" [string/write [/ 1.0 10.0]]]
[test/add :arity-error [try car [string/write [/ 0.5]]]]
[test/add 2.0 [cbrt  8]]
[test/add "3.0" [string/write [cbrt 27]]]
[test/add 2.0 [cbrt 8.0]]
[test/add "3.0" [string/write [cbrt 27.0]]]
[test/add 2.0 [vec/x [cbrt [vec 8]]]]
[test/add 14 [def abs [fn [a] [if [neg? a] [- 0 a] a]]] [+ [abs -7] [abs 7]]]
[test/add 3 [abs -3]]
[test/add 3 [abs 3]]
[test/add 0 [abs 0]]
[test/add 0 [abs -0]]
[test/add 2.0 [abs -2.0]]
[test/add "1.0" [string/write [sin [/ PI 2]]]]
[test/add "-1.0" [string/write [sin [/ PI -2]]]]
[test/add "-1.0" [string/write [cos π]]]
[test/add "1.0" [string/write [cos [* π 2]]]]
[test/add "0.0" [string/write [atan2 0.0 0.0]]]
[test/add :type-error [try car [atan2]]]
[test/add :type-error [try car [atan2 0]]]
[test/add :type-error [try car [atan2 0 "0"]]]
[test/add "0.0" [string/write [atan2 0 0]]]
[test/add "0.0" [string/write [round [abs [- PI [* [atan2 1.0 0.0] 2.0]]]]]]
[test/add "0.0" [string/write [round [abs [atan2 0.0 1.0]]]]]
[test/add "10.0" [string/write [* [sin [atan2 10.0 10.0]] [sqrt [+ [* 10.0 10.0] [* 10.0 10.0]]]]]]