]> gitweb.factorcode.org Git - factor.git/blob - basis/images/tessellation/tessellation-tests.factor
factor: Move math.ranges => ranges.
[factor.git] / basis / images / tessellation / tessellation-tests.factor
1 USING: images accessors kernel tools.test literals ranges
2 byte-arrays ;
3 IN: images.tessellation
4
5 ! Check an invariant we depend on
6 { t } [
7     <image> B{ 1 2 3 } >>bitmap dup clone [ bitmap>> ] bi@ eq?
8 ] unit-test
9
10 {
11     {
12         {
13             T{ image f { 2 2 } L ubyte-components f f B{ 1 2 5 6 } }
14             T{ image f { 2 2 } L ubyte-components f f B{ 3 4 7 8 } }
15         }
16         {
17             T{ image f { 2 2 } L ubyte-components f f B{ 9 10 13 14 } }
18             T{ image f { 2 2 } L ubyte-components f f B{ 11 12 15 16 } }
19         }
20     }
21 } [
22     <image>
23         1 16 [a..b] >byte-array >>bitmap
24         { 4 4 } >>dim
25         L >>component-order
26         ubyte-components >>component-type
27     { 2 2 } tesselate
28 ] unit-test
29
30 {
31     {
32         {
33             T{ image f { 2 2 } L ubyte-components f f B{ 1 2 4 5 } }
34             T{ image f { 1 2 } L ubyte-components f f B{ 3 6 } }
35         }
36         {
37             T{ image f { 2 1 } L ubyte-components f f B{ 7 8 } }
38             T{ image f { 1 1 } L ubyte-components f f B{ 9 } }
39         }
40     }
41 } [
42     <image>
43         1 9 [a..b] >byte-array >>bitmap
44         { 3 3 } >>dim
45         L >>component-order
46         ubyte-components >>component-type
47     { 2 2 } tesselate
48 ] unit-test