]> gitweb.factorcode.org Git - factor.git/blob - extra/math/compare/compare-tests.factor
more test IN: cleanup.
[factor.git] / extra / math / compare / compare-tests.factor
1 USING: kernel math math.compare math.functions sequences
2 tools.test ;
3
4 { -1 } [ -1 5 absmin ] unit-test
5 { -1 } [ -1 -5 absmin ] unit-test
6
7 { -5 } [ 1 -5 absmax ] unit-test
8 { 5 } [ 1 5 absmax ] unit-test
9
10 { 0 } [ -1 -3 posmax ] unit-test
11 { 1 } [ 1 -3 posmax ] unit-test
12 { 3 } [ -1 3 posmax ] unit-test
13
14 { 0 } [ 1 3 negmin ] unit-test
15 { -3 } [ 1 -3 negmin ] unit-test
16 { -1 } [ -1 3 negmin ] unit-test
17
18 { 1 } [ 1 2 [ ] min-by ] unit-test
19 { 1 } [ 2 1 [ ] min-by ] unit-test
20 { 42.0 } [ 42.0 1/0. [ ] min-by ] unit-test
21 { 42.0 } [ 1/0. 42.0 [ ] min-by ] unit-test
22 { 2 } [ 1 2 [ ] max-by ] unit-test
23 { 2 } [ 2 1 [ ] max-by ] unit-test
24 { 1/0. } [ 42.0 1/0. [ ] max-by ] unit-test
25 { 1/0. } [ 1/0. 42.0 [ ] max-by ] unit-test
26 { "12345" } [ "123" "12345" [ length ] max-by ] unit-test
27 { "123" } [ "123" "12345" [ length ] min-by ] unit-test