Add more tests

This commit is contained in:
Alexey Ilyukhov 2020-06-22 21:04:42 +03:00 committed by Nikita Mikhaylov
parent f7019cf589
commit 373b429e61
6 changed files with 196 additions and 0 deletions

View File

@ -0,0 +1,16 @@
(0,0)
[[(1,0),(10,0),(10,10),(0,10),(1,0)]]
[[(0,0),(10,0),(10,10),(0,10),(0,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]]
[[[(2,0),(10,0),(10,10),(0,10),(2,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]],[[(-10,-10),(-10,-9),(-9,10),(-10,-10)]]]
(0,0)
(1,0)
(2,0)
[[(1,0),(10,0),(10,10),(0,10),(1,0)]]
[[(0,0),(10,0),(10,10),(0,10),(0,0)]]
[[(2,0),(10,0),(10,10),(0,10),(2,0)]]
[[(0,0),(10,0),(10,10),(0,10),(0,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]]
[[(2,0),(10,0),(10,10),(0,10),(2,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]]
[[(1,0),(10,0),(10,10),(0,10),(1,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]]
[[[(1,0),(10,0),(10,10),(0,10),(1,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]],[[(-10,-10),(-10,-9),(-9,10),(-10,-10)]]]
[[[(0,0),(10,0),(10,10),(0,10),(0,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]],[[(-10,-10),(-10,-9),(-9,10),(-10,-10)]]]
[[[(2,0),(10,0),(10,10),(0,10),(2,0)],[(4,4),(5,4),(5,5),(4,5),(4,4)]],[[(-10,-10),(-10,-9),(-9,10),(-10,-10)]]]

View File

@ -0,0 +1,28 @@
SELECT readWktPoint('POINT(0 0)');
SELECT readWktPolygon('POLYGON((1 0,10 0,10 10,0 10,1 0))');
SELECT readWktPolygon('POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4))');
SELECT readWktMultiPolygon('MULTIPOLYGON(((2 0,10 0,10 10,0 10,2 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))');
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (s String, id Int) engine=Memory();
INSERT INTO geo VALUES ('POINT(0 0)', 1);
INSERT INTO geo VALUES ('POINT(1 0)', 2);
INSERT INTO geo VALUES ('POINT(2 0)', 3);
SELECT readWktPoint(s) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (s String, id Int) engine=Memory();
INSERT INTO geo VALUES ('POLYGON((1 0,10 0,10 10,0 10,1 0))', 1);
INSERT INTO geo VALUES ('POLYGON((0 0,10 0,10 10,0 10,0 0))', 2);
INSERT INTO geo VALUES ('POLYGON((2 0,10 0,10 10,0 10,2 0))', 3);
INSERT INTO geo VALUES ('POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4))', 4);
INSERT INTO geo VALUES ('POLYGON((2 0,10 0,10 10,0 10,2 0),(4 4,5 4,5 5,4 5,4 4))', 5);
INSERT INTO geo VALUES ('POLYGON((1 0,10 0,10 10,0 10,1 0),(4 4,5 4,5 5,4 5,4 4))', 6);
SELECT readWktPolygon(s) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (s String, id Int) engine=Memory();
INSERT INTO geo VALUES ('MULTIPOLYGON(((1 0,10 0,10 10,0 10,1 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))', 1);
INSERT INTO geo VALUES ('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))', 2);
INSERT INTO geo VALUES ('MULTIPOLYGON(((2 0,10 0,10 10,0 10,2 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))', 3);
SELECT readWktMultiPolygon(s) FROM geo ORDER BY id;

View File

@ -0,0 +1,56 @@
<circle cx="0" cy="0" r="5" style=""/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style=""/>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style=""/></g>
<circle cx="0" cy="0" r="5" style="b"/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style="b"/>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="b"/></g>
<circle cx="0" cy="0" r="5" style=""/>
<circle cx="1" cy="0" r="5" style=""/>
<circle cx="2" cy="0" r="5" style=""/>
<circle cx="0" cy="0" r="5" style="b"/>
<circle cx="1" cy="0" r="5" style="b"/>
<circle cx="2" cy="0" r="5" style="b"/>
<circle cx="0" cy="0" r="5" style="b"/>
<circle cx="0" cy="0" r="5" style="c"/>
<circle cx="0" cy="0" r="5" style="d"/>
<circle cx="0" cy="0" r="5" style="b"/>
<circle cx="1" cy="0" r="5" style="c"/>
<circle cx="2" cy="0" r="5" style="d"/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style=""/>
<polygon points="1,0 10,0 10,10 0,10 1,0" style=""/>
<polygon points="2,0 10,0 10,10 0,10 2,0" style=""/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style="b"/>
<polygon points="1,0 10,0 10,10 0,10 1,0" style="b"/>
<polygon points="2,0 10,0 10,10 0,10 2,0" style="b"/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style="b"/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style="c"/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style="d"/>
<polygon points="0,0 10,0 10,10 0,10 0,0" style="b"/>
<polygon points="1,0 10,0 10,10 0,10 1,0" style="c"/>
<polygon points="2,0 10,0 10,10 0,10 2,0" style="d"/>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 1,0 L 10,0 L 10,10 L 0,10 L 1,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 2,0 L 10,0 L 10,10 L 0,10 L 2,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 1,0 L 10,0 L 10,10 L 0,10 L 1,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 2,0 L 10,0 L 10,10 L 0,10 L 2,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="c"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="d"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 1,0 L 10,0 L 10,10 L 0,10 L 1,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="c"/></g>
<g fill-rule="evenodd"><path d="M 2,0 L 10,0 L 10,10 L 0,10 L 2,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="d"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 1,0 L 10,0 L 10,10 L 0,10 L 1,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 2,0 L 10,0 L 10,10 L 0,10 L 2,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style=""/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 1,0 L 10,0 L 10,10 L 0,10 L 1,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 2,0 L 10,0 L 10,10 L 0,10 L 2,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="c"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="c"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="d"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="d"/></g>
<g fill-rule="evenodd"><path d="M 0,0 L 10,0 L 10,10 L 0,10 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="b"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="b"/></g>
<g fill-rule="evenodd"><path d="M 1,0 L 10,0 L 10,10 L 0,10 L 1,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="c"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="c"/></g>
<g fill-rule="evenodd"><path d="M 2,0 L 10,0 L 10,10 L 0,10 L 2,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style="d"/></g><g fill-rule="evenodd"><path d="M -10,-10 L -10,-9 L -9,10 L -10,-10 z " style="d"/></g>

View File

@ -0,0 +1,48 @@
SELECT svg((0, 0));
SELECT svg([(0, 0), (10, 0), (10, 10), (0, 10)]);
SELECT svg([[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]]);
SELECT svg([[[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]]);
SELECT svg((0, 0), 'b');
SELECT svg([(0, 0), (10, 0), (10, 10), (0, 10)], 'b');
SELECT svg([[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 'b');
SELECT svg([[[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 'b');
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Tuple(Float64, Float64), s String, id Int) engine=Memory();
INSERT INTO geo VALUES ((0, 0), 'b', 1);
INSERT INTO geo VALUES ((1, 0), 'c', 2);
INSERT INTO geo VALUES ((2, 0), 'd', 3);
SELECT svg(p) FROM geo ORDER BY id;
SELECT svg(p, 'b') FROM geo ORDER BY id;
SELECT svg((0, 0), s) FROM geo ORDER BY id;
SELECT svg(p, s) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Array(Tuple(Float64, Float64)), s String, id Int) engine=Memory();
INSERT INTO geo VALUES ([(0, 0), (10, 0), (10, 10), (0, 10)], 'b', 1);
INSERT INTO geo VALUES ([(1, 0), (10, 0), (10, 10), (0, 10)], 'c', 2);
INSERT INTO geo VALUES ([(2, 0), (10, 0), (10, 10), (0, 10)], 'd', 3);
SELECT svg(p) FROM geo ORDER BY id;
SELECT svg(p, 'b') FROM geo ORDER BY id;
SELECT svg([(0, 0), (10, 0), (10, 10), (0, 10)], s) FROM geo ORDER BY id;
SELECT svg(p, s) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Array(Array(Tuple(Float64, Float64))), s String, id Int) engine=Memory();
INSERT INTO geo VALUES ([[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 'b', 1);
INSERT INTO geo VALUES ([[(1, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 'c', 2);
INSERT INTO geo VALUES ([[(2, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 'd', 3);
SELECT svg(p) FROM geo ORDER BY id;
SELECT svg(p, 'b') FROM geo ORDER BY id;
SELECT svg([[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], s) FROM geo ORDER BY id;
SELECT svg(p, s) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Array(Array(Array(Tuple(Float64, Float64)))), s String, id Int) engine=Memory();
INSERT INTO geo VALUES ([[[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 'b', 1);
INSERT INTO geo VALUES ([[[(1, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 'c', 2);
INSERT INTO geo VALUES ([[[(2, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 'd', 3);
SELECT svg(p) FROM geo ORDER BY id;
SELECT svg(p, 'b') FROM geo ORDER BY id;
SELECT svg([[[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], s) FROM geo ORDER BY id;
SELECT svg(p, s) FROM geo ORDER BY id;

View File

@ -0,0 +1,16 @@
POINT(0 0)
POLYGON((0 0,10 0,10 10,0 10,0 0))
POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4))
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))
POINT(0 0)
POINT(1 0)
POINT(2 0)
POLYGON((0 0,10 0,10 10,0 10,0 0))
POLYGON((1 0,10 0,10 10,0 10,1 0))
POLYGON((2 0,10 0,10 10,0 10,2 0))
POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4))
POLYGON((1 0,10 0,10 10,0 10,1 0),(4 4,5 4,5 5,4 5,4 4))
POLYGON((2 0,10 0,10 10,0 10,2 0),(4 4,5 4,5 5,4 5,4 4))
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))
MULTIPOLYGON(((1 0,10 0,10 10,0 10,1 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))
MULTIPOLYGON(((2 0,10 0,10 10,0 10,2 0),(4 4,5 4,5 5,4 5,4 4)),((-10 -10,-10 -9,-9 10,-10 -10)))

View File

@ -0,0 +1,32 @@
SELECT wkt((0, 0));
SELECT wkt([(0, 0), (10, 0), (10, 10), (0, 10)]);
SELECT wkt([[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]]);
SELECT wkt([[[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]]);
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Tuple(Float64, Float64), id Int) engine=Memory();
INSERT INTO geo VALUES ((0, 0), 1);
INSERT INTO geo VALUES ((1, 0), 2);
INSERT INTO geo VALUES ((2, 0), 3);
SELECT wkt(p) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Array(Tuple(Float64, Float64)), id Int) engine=Memory();
INSERT INTO geo VALUES ([(0, 0), (10, 0), (10, 10), (0, 10)], 1);
INSERT INTO geo VALUES ([(1, 0), (10, 0), (10, 10), (0, 10)], 2);
INSERT INTO geo VALUES ([(2, 0), (10, 0), (10, 10), (0, 10)], 3);
SELECT wkt(p) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Array(Array(Tuple(Float64, Float64))), id Int) engine=Memory();
INSERT INTO geo VALUES ([[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 1);
INSERT INTO geo VALUES ([[(1, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 2);
INSERT INTO geo VALUES ([[(2, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], 3);
SELECT wkt(p) FROM geo ORDER BY id;
DROP TABLE IF EXISTS geo;
CREATE TABLE geo (p Array(Array(Array(Tuple(Float64, Float64)))), id Int) engine=Memory();
INSERT INTO geo VALUES ([[[(0, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 1);
INSERT INTO geo VALUES ([[[(1, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 2);
INSERT INTO geo VALUES ([[[(2, 0), (10, 0), (10, 10), (0, 10)], [(4, 4), (5, 4), (5, 5), (4, 5)]], [[(-10, -10), (-10, -9), (-9, 10)]]], 3);
SELECT wkt(p) FROM geo ORDER BY id;