USING: arrays kernel math ranges sequences sets tools.test ; { { } } [ 1 1 (a..b) >array ] unit-test { { } } [ 1 1 (a..b] >array ] unit-test { { } } [ 1 1 [a..b) >array ] unit-test { { 1 } } [ 1 1 [a..b] >array ] unit-test { { } } [ 1 2 (a..b) >array ] unit-test { { 2 } } [ 1 2 (a..b] >array ] unit-test { { 1 } } [ 1 2 [a..b) >array ] unit-test { { 1 2 } } [ 1 2 [a..b] >array ] unit-test { { } } [ 2 1 (a..b) >array ] unit-test { { 1 } } [ 2 1 (a..b] >array ] unit-test { { 2 } } [ 2 1 [a..b) >array ] unit-test { { 2 1 } } [ 2 1 [a..b] >array ] unit-test { { 1 2 3 4 5 } } [ 1 5 1 >array ] unit-test { { 5 4 3 2 1 } } [ 5 1 -1 >array ] unit-test { { 0 1/3 2/3 1 } } [ 0 1 1/3 >array ] unit-test { { 0 1/3 2/3 1 } } [ 1 0 -1/3 >array reverse ] unit-test { 0 } [ 0 -1 .0001 length ] unit-test { 0 } [ 0 -1 .5 length ] unit-test { 0 } [ 0 -1 1 length ] unit-test { 0 } [ 0 -1 2 length ] unit-test { 0 } [ 0 -1 3 length ] unit-test { 0 } [ 0 -1 4 length ] unit-test { 0 } [ 0 -2 .0001 length ] unit-test { 0 } [ 0 -2 1 length ] unit-test { 0 } [ 0 -2 2 length ] unit-test { 0 } [ 0 -2 3 length ] unit-test { 0 } [ 0 -2 4 length ] unit-test { 0 } [ -1 0 -.0001 length ] unit-test { 0 } [ -1 0 -.5 length ] unit-test { 0 } [ -1 0 -1 length ] unit-test { 0 } [ -1 0 -2 length ] unit-test { 0 } [ -1 0 -3 length ] unit-test { 0 } [ -1 0 -4 length ] unit-test { 0 } [ -2 0 -.0001 length ] unit-test { 0 } [ -2 0 -1 length ] unit-test { 0 } [ -2 0 -2 length ] unit-test { 0 } [ -2 0 -3 length ] unit-test { 0 } [ -2 0 -4 length ] unit-test { 100 } [ 1 100 [a..b] [ 2^ [1..b] ] map members length ] unit-test { t } [ -10 10 1 [ sum ] [ >array sum ] bi = ] unit-test { t } [ -10 10 2 [ sum ] [ >array sum ] bi = ] unit-test { t } [ 10 -10 -1 [ sum ] [ >array sum ] bi = ] unit-test { t } [ 10 -10 -2 [ sum ] [ >array sum ] bi = ] unit-test ! Empty range { 0 } [ 1 0 1 sum ] unit-test { t } [ 4 4 10 2 in? ] unit-test { t } [ 6 4 10 2 in? ] unit-test { t } [ 10 4 10 2 in? ] unit-test { t } [ -6 4 -10 -2 in? ] unit-test { t } [ 6 10 4 -1 in? ] unit-test { f } [ 5 4 10 2 in? ] unit-test { f } [ 3 4 10 2 in? ] unit-test { f } [ 4.0 4 10 2 in? ] unit-test { f } [ 6.0 4 10 2 in? ] unit-test { f } [ 10.0 4 10 2 in? ] unit-test { { } } [ 1 8 2 2 9 2 intersect >array ] unit-test { { } } [ 1 8 2 8 1 -2 intersect >array ] unit-test { { } } [ 1 -9 1 1 8 1 intersect >array ] unit-test { { 13 19 25 31 37 43 49 } } [ 1 100 3 11 50 2 intersect >array ] unit-test { { 6 } } [ 6 7 1 6 -20 -4 intersect >array ] unit-test { { 3 3+1/3 3+2/3 4 4+1/3 4+2/3 5 } } [ 2 5 1/3 3 10 1/3 intersect >array ] unit-test { { 1.0 1.5 2.0 } } [ 1.0 2.0 0.25 1.0 2.0 0.5 intersect >array ] unit-test { f } [ 1 8 2 2 9 2 intersects? ] unit-test { f } [ 1 8 2 8 1 -2 intersects? ] unit-test { f } [ 1 -9 1 1 8 1 intersects? ] unit-test { t } [ 1 100 3 11 50 2 intersects? ] unit-test { t } [ 6 7 1 6 -20 -4 intersects? ] unit-test { t } [ 6 9 2 6 8 2 set= ] unit-test { t } [ 2 9 2 8 1 -2 set= ] unit-test { t } [ 9 0 3 4 8 -2 set= ] unit-test { f } [ 1 8 1 1 8 2 set= ] unit-test { t } [ 3 10 4 1 10 2 subset? ] unit-test { t } [ 1 0 1 10 2 1 subset? ] unit-test { f } [ 1 10 2 3 10 4 subset? ] unit-test { { 1.5 2.5 3.5 } } [ 1.5 3.7 [a..b) >array ] unit-test { { 1+1/2 2+1/2 3+1/2 } } [ 3/2 37/10 [a..b) >array ] unit-test