]> gitweb.factorcode.org Git - factor.git/blob - extra/shapefiles/shapefiles-tests.factor
git: fix tests
[factor.git] / extra / shapefiles / shapefiles-tests.factor
1 USING: kernel sequences shapefiles tools.test ;
2 IN: shapefiles.tests
3
4 : save-and-load? ( shapes -- ? )
5     [
6         [ save-shapes ] [ load-shapes sequence= ] 2bi
7     ] with-test-file ;
8
9 { t } [
10     { null-shape } save-and-load?
11 ] unit-test
12
13 { t } [
14     { null-shape T{ point f 1.0 2.0 } } save-and-load?
15 ] unit-test
16
17 { t } [
18     { T{ point-m f 1.0 2.0 3.0 } } save-and-load?
19 ] unit-test
20
21 { t } [
22     { T{ point-z f 1.0 2.0 3.0 4.0 } } save-and-load?
23 ] unit-test
24
25 { t } [
26     { T{ polygon
27         { box { 1.0 3.0 2.0 4.0 } }
28         { parts { } }
29         { points { T{ point f 1.0 2.0 } T{ point f 3.0 4.0 } } } }
30     } save-and-load?
31 ] unit-test
32
33 { t } [
34     { T{ polygon-m
35         { box { 1.0 3.0 2.0 4.0 } }
36         { parts { } }
37         { points { T{ point f 1.0 2.0 } T{ point f 3.0 4.0 } } }
38         { m-range { 10.0 20.0 } }
39         { m-array { 10.0 20.0 } } }
40     } save-and-load?
41 ] unit-test
42
43 { t } [
44     { T{ polygon-z
45         { box { 1.0 3.0 2.0 4.0 } }
46         { parts { } }
47         { points { T{ point f 1.0 2.0 } T{ point f 3.0 4.0 } } }
48         { z-range { -10.0 -20.0 } }
49         { z-array { -10.0 -20.0 } }
50         { m-range { 10.0 20.0 } }
51         { m-array { 10.0 20.0 } } }
52     } save-and-load?
53 ] unit-test