1 ! Copyright (C) 2010 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: compiler.test compiler.tree.debugger kernel make math.parser sequences
4 sequences.unrolled tools.test ;
5 IN: sequences.unrolled.tests
7 { { "0" "1" "2" } } [ { 0 1 2 } 3 [ number>string ] unrolled-map ] unit-test
8 { { "0" "1" "2" } } [ { 0 1 2 } [ 3 [ number>string ] unrolled-map ] compile-call ] unit-test
10 { { "0" "1" "2" } } [ [ { 0 1 2 } 3 [ number>string , ] unrolled-each ] { } make ] unit-test
11 { { "0" "1" "2" } } [ [ { 0 1 2 } [ 3 [ number>string , ] unrolled-each ] compile-call ] { } make ] unit-test
13 { { "a0" "b1" "c2" } }
14 [ [ { "a" "b" "c" } 3 [ number>string append , ] unrolled-each-index ] { } make ] unit-test
16 { { "a0" "b1" "c2" } }
17 [ [ { "a" "b" "c" } [ 3 [ number>string append , ] unrolled-each-index ] compile-call ] { } make ] unit-test
19 { { "aI" "bII" "cIII" } }
20 [ [ { "a" "b" "c" } { "I" "II" "III" } [ 3 [ append , ] unrolled-2each ] compile-call ] { } make ] unit-test
22 { { "aI" "bII" "cIII" } }
23 [ { "a" "b" "c" } { "I" "II" "III" } 3 [ append ] unrolled-2map ] unit-test
25 { { "aI" "bII" "cIII" } }
26 [ { "a" "b" "c" } { "I" "II" "III" } [ 3 [ append ] unrolled-2map ] compile-call ] unit-test
28 { { "a0" "b1" "c2" } }
29 [ { "a" "b" "c" } 3 [ number>string append ] unrolled-map-index ] unit-test
31 { { "a0" "b1" "c2" } }
32 [ { "a" "b" "c" } [ 3 [ number>string append ] unrolled-map-index ] compile-call ] unit-test
34 [ { 0 1 2 } 4 [ number>string ] unrolled-map ] [ unrolled-bounds-error? ] must-fail-with
35 [ { 0 1 2 3 } { 0 1 2 } 4 [ number>string append ] unrolled-2map ] [ unrolled-2bounds-error? ] must-fail-with
38 [ [ 3 [ number>string ] unrolled-map ] { call } inlined? ] unit-test
41 [ [ 3 [ number>string , ] unrolled-each ] { call } inlined? ] unit-test
44 [ [ 3 [ number>string append , ] unrolled-each-index ] { call } inlined? ] unit-test
47 [ [ 3 [ append , ] unrolled-2each ] { call } inlined? ] unit-test
50 [ [ 3 [ append ] unrolled-2map ] { call } inlined? ] unit-test
53 [ [ 3 [ number>string append ] unrolled-map-index ] { call } inlined? ] unit-test