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