Carp/test/tuples.carp
2019-03-22 20:33:06 +01:00

25 lines
888 B
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"))