mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-12 12:49:13 +03:00
117 lines
3.0 KiB
Plaintext
117 lines
3.0 KiB
Plaintext
(load "Test.carp")
|
|
|
|
(use-all Double Test)
|
|
|
|
(deftest test
|
|
(assert-equal test
|
|
-1.0
|
|
(neg 1.0)
|
|
"neg works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(acos 1.0)
|
|
"acos works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(asin 0.0)
|
|
"asin works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(atan 0.0)
|
|
"atan works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(atan2 0.0 0.0)
|
|
"atan2 works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(cos 0.0)
|
|
"cos works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(cosh 0.0)
|
|
"cosh works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(cosh 0.0)
|
|
"cosh works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(sin 0.0)
|
|
"sin works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(sinh 0.0)
|
|
"sinh works as expected")
|
|
(assert-equal test
|
|
0.0
|
|
(tanh 0.0)
|
|
"tanh works as expected")
|
|
(assert-equal test
|
|
8.0
|
|
(ldexp 2.0 2)
|
|
"ldexp works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(log Double.e)
|
|
"log works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(log10 10.0)
|
|
"log10 works as expected")
|
|
(assert-equal test
|
|
256.0
|
|
(pow 2.0 8.0)
|
|
"pow works as expected")
|
|
(assert-equal test
|
|
3.0
|
|
(sqrt 9.0)
|
|
"sqrt works as expected")
|
|
(assert-equal test
|
|
2.0
|
|
(ceil 1.3)
|
|
"ceil works as expected")
|
|
(assert-equal test
|
|
2.0
|
|
(abs -2.0)
|
|
"abs works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(floor 1.9)
|
|
"floor works as expected")
|
|
(assert-equal test
|
|
1.0
|
|
(floor 1.9)
|
|
"floor works as expected")
|
|
(assert-op test
|
|
Double.e
|
|
(exp 1.0)
|
|
"exp works as expected"
|
|
Double.approx)
|
|
(assert-op test
|
|
0.3
|
|
(mod 9.3 3.0)
|
|
"mod works as expected"
|
|
Double.approx)
|
|
(assert-equal test
|
|
4607182418800017408l
|
|
(to-bytes 1.0)
|
|
"to-bytes works as expected I"
|
|
)
|
|
(assert-equal test
|
|
0l
|
|
(to-bytes 0.0)
|
|
"to-bytes works as expected II"
|
|
)
|
|
(assert-equal test
|
|
&(Maybe.Just 10.3)
|
|
&(from-string "10.3")
|
|
"from-string works as expected I"
|
|
)
|
|
(assert-equal test
|
|
&(Maybe.Nothing)
|
|
&(Double.from-string "abcd")
|
|
"from-string works as expected II"
|
|
)
|
|
)
|