Carp/test/tuples.carp
2019-05-05 11:49:30 +02:00

30 lines
1.0 KiB
Plaintext

(load "core/Tuples.carp") ;; specified path to avoid loading itself on case insensitive file systems
(load "Test.carp")
(use Test)
(deftest test
(assert-true test
(< (Pair.init 1 2) (Pair.init 2 2))
"comparison works I")
(assert-true test
(< (Pair.init 2 1) (Pair.init 2 2))
"comparison works II")
(assert-true test
(< (Pair.init 1 100) (Pair.init 2 2))
"comparison works III")
(assert-false test
(< (Pair.init 1 100) (Pair.init 1 100))
"comparison works IV")
(assert-true test
(< &(Pair.init @"a" 2) &(Pair.init @"b" 1))
"comparison works with (Ref (Pair String Int)) I")
(assert-false test
(< &(Pair.init @"a" 2) &(Pair.init @"a" 1))
"comparison works with (Ref (Pair String Int)) II")
(assert-equal test
&(Pair.init 2 @"a")
&(Pair.reverse &(Pair.init @"a" 2))
"reverse works")
)