Login
7 branches 0 tags
Ben (X13/Arch) Update bootstrap library c572c8a 3 years ago 572 Commits
nujel / testsuite / predicates.nuj
[test/add #t [numeric? 0.1]]
[test/add #t [> 5 1]]
[test/add #t [not [< 5 1]]]
[test/add #t [>= 5 5]]
[test/add #t [<= 5 5]]
[test/add #t [== #t #t]]
[test/add #t [not [== #f #t]]]
[test/add #t [== 2 2]]
[test/add #t [neg? -1]]
[test/add #t [neg? -0.01]]
[test/add #t [pos? 0]]
[test/add #t [pos? 0.01]]
[test/add #t [not [neg? 0]]]
[test/add #t [not [pos? -0.01]]]
[test/add #f [pos? "asd"]]
[test/add #f [neg? "asd"]]
[test/add #f [pos? #t]]
[test/add #f [neg? #f]]
[test/add #t [numeric?   1]]
[test/add #t [numeric?  -1]]
[test/add #t [numeric?   0]]
[test/add #t [numeric? 0.1]]
[test/add #t [numeric? [vec 1 2 3]]]
[test/add #f [numeric? #[1 2 3]]]
[test/add #f [numeric? '[1 2 3]]]
[test/add #f [numeric? @[:a 1 :b 2 :c 3]]]
[test/add #t [and [numeric? [vec 1]] [not [numeric? #f]] [not [numeric? "123"]]]]
[test/add #t [and [numeric? 1] [numeric? -1] [numeric? 0] [numeric? 0.1] [numeric? [vec 1]] [not [numeric? #f]] [not [numeric? "123"]]]]
[test/add #t [not [< 3 2]]]
[test/add #t [zero? 0]]
[test/add #t [> 3.1 2.1]]
[test/add #t [> 3 2]]
[test/add #f [>= 4 "3"]]
[test/add #t [>= 3 3]]
[test/add #t [<= 3 3]]
[test/add #t [not [>= "2" 3]]]
[test/add #t [and [not [< 3 2]] [zero? 0] [> 3.1 2.1] [> 3 2] [not [>= 4 "3"]] [>= 3 3] [<= 3 3] [not [>= "2" 3]]]]
[test/add #t [even? 2]]
[test/add #f [even? 9]]
[test/add #t [odd? 7]]
[test/add #f [odd? 4]]
[test/add #t [zero-neg?    0]]
[test/add #t [zero-neg? -4.0]]
[test/add #f [zero-neg?  0.1]]
[test/add #t [list/equal? '[] '[]]]
[test/add #f [list/equal? '[] '[1]]]
[test/add #f [list/equal? '[1] '[]]]
[test/add #t [list/equal? '[1 "asd"] '[1 "asd"]]]
[test/add #f [list/equal? '[1 "asd"] '[1 "as"]]]
[test/add #f [list/equal? '[1 :asd] '[1 :as]]]
[test/add #t [list/equal? '[1 :asd] '[1 :asd]]]
[test/add #t [list/equal? '[1 asd] '[1 asd]]]
[test/add #t [list/equal? '[1 #f] '[1 #f]]]
[test/add #f [list/equal? '[1 #t] '[1 #f]]]
[test/add #t [list/equal? '[1 2 3] '[1 2 3]]]
[test/add #f [list/equal? '[1 2 3] '[1 2 4]]]
[test/add #f [list/equal? '[1 2 3] '[1 2]]]
[test/add #f [list/equal? '[1 2 3] '[1 2 [3 4]]]]
[test/add #t [list/equal? '[1 2 [3 4]] '[1 2 [3 4]]]]
[test/add #t [list/equal? '[1 2 [3 4]] '[1 2 [3 4]]]]
[test/add #t [< 1 10]]
[test/add #f [> 1 10]]
[test/add #t [> 10 1]]
[test/add #f [< 10 1]]
[test/add #t [!= 1 10]]
[test/add #f [!= 1 1]]
[test/add #f [== 1 10]]
[test/add #t [== 1 1]]
[test/add #t [>= 1 1]]
[test/add #t [<= 1 1]]
[test/add #t [<= 1 4]]
[test/add #t [>= 4 1]]
[test/add #t [== #nil #nil]]
[test/add #t [== #t #t]]
[test/add #f [== #t #f]]
[test/add #t [== #f #f]]
[test/add #f [== '[] #f]]
[test/add #f [== #f '[]]]
[test/add #f [== '[] #t]]
[test/add #f [== #t '[]]]
[test/add #t [== '[] '[]]]
[test/add #f [== '[] '[1]]]
[test/add #f [== '[1] '[1]]]
[test/add #t [list/equal? '[1] '[1]]]
[test/add #f [== '[] #nil]]
[test/add #t [macro? [macro [] #f]]]
[test/add #t [macro? +1]]
[test/add #f [macro? min]]
[test/add #f [macro? 123]]
[test/add #t [in-range? 3 1 5]]
[test/add #f [in-range? -3 1 5]]
[test/add #f [in-range? 9 1 5]]
[test/add #t [in-range? -3 -10 5]]
[test/add #t [in-range? -3.0 -10.0 5.0]]
[test/add #t [[path/ext?! "nuj"] "tests.nuj"]]
[test/add #f [[path/ext?! "nuj"] "tests.nu"]]
[test/add #t [resolves? '+]]
[test/add #t [resolves? 'map]]
[test/add #t [resolves? 'π]]
[test/add #f [resolves? :asd]]
[test/add #f [resolves? 'asdqwe]]
[test/add #t [> [length [symbol-search "abs"]] 0]]
[test/add #t [tree? @[:asd 123]]]
[test/add #f [tree? #[123]]]
[test/add #f [tree? '[:asd 123]]]
[test/add #f [tree? #nil]]
[test/add #f [tree? 123]]
[test/add #f [tree? "asd"]]
[test/add #f [tree? #t]]
[test/add #t [tree? [closure +]]]
[test/add #t [last? '[]]]
[test/add #t [last? '[1]]]
[test/add #f [last? '[1 2]]]
[test/add #t [native? +]]
[test/add #f [native? min]]
[test/add #f [lambda? +]]
[test/add #t [lambda? min]]
[test/add #t [special-form? if]]
[test/add #f [special-form? when]]
[test/add #f [> #nil 1.0]]
[test/add #f [> #nil 1]]
[test/add #f [> #nil 0]]
[test/add #f [> #nil -1]]
[test/add #f [> #nil -1.0]]
[test/add #f [< #nil 1.0]]
[test/add #f [< #nil 1]]
[test/add #f [< #nil 0]]
[test/add #f [< #nil -1]]
[test/add #f [< #nil -1.0]]
[test/add #f [== #nil 1]]
[test/add #f [== #nil 0]]
[test/add #f [== #nil -1]]
[test/add #t [case 'quote [['quote] #t] [otherwise #f]]]
[test/add #t [case 'quote ['quote #t] [otherwise #f]]]
[test/add #t [case 'otherwise [['otherwise] #t] [otherwise #f]]]
[test/add #t [case 'otherwise ['otherwise #t] [otherwise #f]]]
[test/add #f [== 0 'asd]]
[test/add #f [== 0 :asd]]
[test/add #f [== 0 "asd"]]
[test/add #f [== 0 #f]]
[test/add #f [== 0 #t]]
[test/add #f [== 0 0.1]]
[test/add #f [== 0 #[0]]]
[test/add #f [== 0 @[:asd 0]]]
[test/add #f [== 0.0 'asd]]
[test/add #f [== 0.0 :asd]]
[test/add #f [== 0.0 "asd"]]
[test/add #f [== 0.0 #f]]
[test/add #f [== 0.0 #t]]
[test/add #f [== 0.0 0.1]]
[test/add #f [== 0.0 #[0]]]
[test/add #f [== 0.0 @[:asd 0]]]
[test/add #t [equal? 1 1]]
[test/add #t [equal? 2.0 2.0]]
[test/add #f [equal? 2.0 2.1]]
[test/add #t [equal? :a :a]]
[test/add #f [equal? :a :b]]
[test/add #t [equal? '[1 :b "c"] '[1 :b "c"]]]
[test/add #f [equal? '[1 :b "c" #[4.0]] '[1 :b "c"]]]
[test/add #t [equal? '[1 :b "c" #[4.0]] '[1 :b "c" #[4.0]]]]
[test/add #t [equal? #['[1 #o2 #x3] '[4.0 5.0 @[:a 1 :b 2]] '["7" #[8 88] :9]] #['[1 #o2 #x3] '[4.0 5.0 @[:a 1 :b 2]] '["7" #[8 88] :9]]]]
[test/add #t [inequal? #['[1 #o2 #x3] '[4.0 5.0 @[:a 1 :b 2]] '["7" #[8 88] :9]] #['[1 #o2 #x3] '[4.0 5.0 @[:a 1 :a 2]] '["7" #[8 88] :9]]]]
[test/add #f [inequal? :a :a]]
[test/add #t [inequal? :a :b]]
[test/add #t [inequal? '[1 :b "c" #[4.0]] '[1 :b "c"]]]
[test/add #t [inequal? #['[1 #o2 #x3] '[4.0 5.0 6.0] '["7" #[8 88] :9]] #['[1 #o2 #x3] '[4.0 5.0 6.0] '["7" #[8 88] :99]]]]
[test/add #t [tree/equal? @[:a 1] @[:a 1]]]
[test/add #t [tree/equal? @[:a 1 :b 2] @[:a 1 :b 2]]]
[test/add #f [tree/equal? @[:a 1 :b 2] @[:a 1 :b 3]]]
[test/add #f [tree/equal? @[:a 1 :b 2] @[:c 1 :b 2]]]
[test/add #f [tree/equal? @[:a 1 :b 2] @[:b 1 :b 2]]]
[test/add #t [procedure? car]]
[test/add #t [procedure? eval*]]
[test/add #t [procedure? procedure?]]
[test/add #t [keyword? [read/single ":asd"]]]
[test/add #t [keyword? [read/single "asd:"]]]
[test/add #t [keyword? [read/single ":asd:"]]]
[test/add #t [== :asd asd:]]
[test/add #t [== :asd :asd:]]
[test/add #t [symbol? 'asd]]
[test/add #t [keyword? :asd]]
[test/add #t [symbol? [gensym]]]
[test/add #t [!= [gensym] [gensym]]]
[test/add #f [symbol? 123]]
[test/add #f [symbol? "asd"]]
[test/add #f [symbol? #[123 'asd]]]
[test/add #f [symbol? @[:a 123]]]
[test/add #t [== :asd :asd]]
[test/add #t [== :bool [type-of #f]]]
[test/add #t [== :int [type-of 123]]]
[test/add #f [== :int [type-of 123.123]]]
[test/add #t [== :float [type-of 123.123]]]
[test/add #t [== :vec [type-of [vec 1]]]]
[test/add #t [== :native-function [type-of +]]]
[test/add #t [== :lambda [type-of test/add*]]]
[test/add #t [== :string [type-of "asd"]]]
[test/add #t [nil? #nil]]
[test/add #f [nil? "NotNil"]]
[test/add #t [not [nil? "NotNil"]]]
[test/add #t [vec? [vec 1]]]
[test/add #t [not [vec? "NotVec"]]]