]> gitweb.factorcode.org Git - factor.git/blob - basis/circular/circular-tests.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / circular / circular-tests.factor
1 ! Copyright (C) 2005, 2006 Alex Chapman, Daniel Ehrenberg
2 ! See http;//factorcode.org/license.txt for BSD license
3 USING: arrays kernel tools.test sequences sequences.private
4 circular strings ;
5 IN: circular.tests
6
7 [ 0 ] [ { 0 1 2 3 4 } <circular> 0 swap virtual@ drop ] unit-test
8 [ 2 ] [ { 0 1 2 3 4 } <circular> 2 swap virtual@ drop ] unit-test
9
10 [ CHAR: t ] [ "test" <circular> 0 swap nth ] unit-test
11 [ "test"  ] [ "test" <circular> >string ] unit-test
12
13 [ CHAR: e ] [ "test" <circular> 5 swap nth-unsafe ] unit-test
14  
15 [ [ 1 2 3 ] ] [ { 1 2 3 } <circular> [ ] like ] unit-test
16 [ [ 2 3 1 ] ] [ { 1 2 3 } <circular> [ rotate-circular ] keep [ ] like ] unit-test
17 [ [ 3 1 2 ] ] [ { 1 2 3 } <circular> [ rotate-circular ] keep [ rotate-circular ] keep [ ] like ] unit-test
18 [ [ 2 3 1 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start [ ] like ] unit-test
19 [ [ 3 1 2 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start 1 over change-circular-start [ ] like ] unit-test
20 [ [ 3 1 2 ] ] [ { 1 2 3 } <circular> -100 over change-circular-start [ ] like ] unit-test
21
22 [ "fob" ] [ "foo" <circular> CHAR: b 2 pick set-nth >string ] unit-test
23 [ "boo" ] [ "foo" <circular> CHAR: b 3 pick set-nth-unsafe >string ] unit-test
24 [ "ornact" ] [ "factor" <circular> 4 over change-circular-start CHAR: n 2 pick set-nth >string ] unit-test
25
26 [ "bcd" ] [ 3 <circular-string> "abcd" [ over push-circular ] each >string ] unit-test
27
28 [ { 0 0 } ] [ { 0 0 } <circular> -1 over change-circular-start >array ] unit-test
29
30 ! This no longer fails
31 ! [ "test" <circular> 5 swap nth ] must-fail
32 ! [ "foo" <circular> CHAR: b 3 rot set-nth ] must-fail
33
34 [ { } ] [ 3 <growing-circular> >array ] unit-test
35 [ { 1 2 } ] [
36     3 <growing-circular>
37     [ 1 swap push-growing-circular ] keep
38     [ 2 swap push-growing-circular ] keep >array
39 ] unit-test
40 [ { 3 4 5 } ] [
41     3 <growing-circular> dup { 1 2 3 4 5 } [
42         swap push-growing-circular
43     ] with each >array
44 ] unit-test