From 016527549c68743184506954984917adccca7670 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 18 Oct 2011 18:19:32 -0700 Subject: [PATCH] add a big group of csv test cases --- tests/data/csv/blank_rows.csv | 9 +++++++++ tests/data/csv/empty_rows.csv | 5 +++++ tests/data/csv/fails/blank.csv | 1 + .../csv/{points.vrt => fails/cannot_read_a_vrt.vrt} | 0 tests/data/csv/fails/invalid_geometries.csv | 3 +++ tests/data/csv/fails/invalid_wkt.csv | 2 ++ tests/data/csv/fails/mixed_separators.csv | 2 ++ tests/data/csv/fails/no_geometry.csv | 2 ++ tests/data/csv/fails/no_headers.csv | 1 + tests/data/csv/has_attributes_with_slashes.csv | 4 ++++ tests/data/csv/mac_newlines.csv | 1 + tests/data/csv/tabs.tsv | 3 +++ tests/data/csv/tabs_in_csv.csv | 2 ++ tests/data/csv/unicode.tsv | 11 +++++++++++ tests/data/csv/untitled file | 0 tests/data/csv/warns/invalid_geometries.csv | 3 +++ tests/data/csv/windows_newlines.csv | 2 ++ tests/data/csv/wkt.csv | 9 +++++++++ tests/data/good_maps/point_csv.xml | 2 +- tests/data/vrt/points.vrt | 8 ++++++++ 20 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/data/csv/blank_rows.csv create mode 100644 tests/data/csv/empty_rows.csv create mode 100644 tests/data/csv/fails/blank.csv rename tests/data/csv/{points.vrt => fails/cannot_read_a_vrt.vrt} (100%) create mode 100644 tests/data/csv/fails/invalid_geometries.csv create mode 100644 tests/data/csv/fails/invalid_wkt.csv create mode 100644 tests/data/csv/fails/mixed_separators.csv create mode 100644 tests/data/csv/fails/no_geometry.csv create mode 100644 tests/data/csv/fails/no_headers.csv create mode 100644 tests/data/csv/has_attributes_with_slashes.csv create mode 100644 tests/data/csv/mac_newlines.csv create mode 100644 tests/data/csv/tabs.tsv create mode 100644 tests/data/csv/tabs_in_csv.csv create mode 100644 tests/data/csv/unicode.tsv create mode 100644 tests/data/csv/untitled file create mode 100644 tests/data/csv/warns/invalid_geometries.csv create mode 100644 tests/data/csv/windows_newlines.csv create mode 100644 tests/data/csv/wkt.csv create mode 100644 tests/data/vrt/points.vrt diff --git a/tests/data/csv/blank_rows.csv b/tests/data/csv/blank_rows.csv new file mode 100644 index 000000000..82698cacb --- /dev/null +++ b/tests/data/csv/blank_rows.csv @@ -0,0 +1,9 @@ + + + +x,y,name +0,0,a + + +0,0,b + diff --git a/tests/data/csv/empty_rows.csv b/tests/data/csv/empty_rows.csv new file mode 100644 index 000000000..d1d0cd26e --- /dev/null +++ b/tests/data/csv/empty_rows.csv @@ -0,0 +1,5 @@ +x,y,text,date,integer,boolean,float,time,datetime,empty_column +0,0,a b,1971-01-01,40,True,1.0,04:14:00,1971-01-01T04:14:00, +0,0,c d,1948-01-01,63,True,1.27,14:57:13,1948-01-01T14:57:13, +0,0,e f,1920-01-01,164,False,41800000.01,00:00:00,1920-01-01T00:00:00, +0,0,This row has empties,,,,,,, \ No newline at end of file diff --git a/tests/data/csv/fails/blank.csv b/tests/data/csv/fails/blank.csv new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tests/data/csv/fails/blank.csv @@ -0,0 +1 @@ + diff --git a/tests/data/csv/points.vrt b/tests/data/csv/fails/cannot_read_a_vrt.vrt similarity index 100% rename from tests/data/csv/points.vrt rename to tests/data/csv/fails/cannot_read_a_vrt.vrt diff --git a/tests/data/csv/fails/invalid_geometries.csv b/tests/data/csv/fails/invalid_geometries.csv new file mode 100644 index 000000000..6763f08dc --- /dev/null +++ b/tests/data/csv/fails/invalid_geometries.csv @@ -0,0 +1,3 @@ +x,y,z +-122a,48b,bogus +-122,48,fine \ No newline at end of file diff --git a/tests/data/csv/fails/invalid_wkt.csv b/tests/data/csv/fails/invalid_wkt.csv new file mode 100644 index 000000000..c4de2265d --- /dev/null +++ b/tests/data/csv/fails/invalid_wkt.csv @@ -0,0 +1,2 @@ +wkt,name +"POINT (a b)",one \ No newline at end of file diff --git a/tests/data/csv/fails/mixed_separators.csv b/tests/data/csv/fails/mixed_separators.csv new file mode 100644 index 000000000..323b95d64 --- /dev/null +++ b/tests/data/csv/fails/mixed_separators.csv @@ -0,0 +1,2 @@ +x y name +-122, 48, hello \ No newline at end of file diff --git a/tests/data/csv/fails/no_geometry.csv b/tests/data/csv/fails/no_geometry.csv new file mode 100644 index 000000000..dda0f126d --- /dev/null +++ b/tests/data/csv/fails/no_geometry.csv @@ -0,0 +1,2 @@ +a,b,c,d,e,f,g +1,2,3,4,5,6,7 \ No newline at end of file diff --git a/tests/data/csv/fails/no_headers.csv b/tests/data/csv/fails/no_headers.csv new file mode 100644 index 000000000..ae5344d22 --- /dev/null +++ b/tests/data/csv/fails/no_headers.csv @@ -0,0 +1 @@ +-122,48,place \ No newline at end of file diff --git a/tests/data/csv/has_attributes_with_slashes.csv b/tests/data/csv/has_attributes_with_slashes.csv new file mode 100644 index 000000000..b9ceb29f0 --- /dev/null +++ b/tests/data/csv/has_attributes_with_slashes.csv @@ -0,0 +1,4 @@ +x,y,name +0,0,a/a +1,4,b/b +10,2.5,c/c \ No newline at end of file diff --git a/tests/data/csv/mac_newlines.csv b/tests/data/csv/mac_newlines.csv new file mode 100644 index 000000000..f18abbd0b --- /dev/null +++ b/tests/data/csv/mac_newlines.csv @@ -0,0 +1 @@ +x,y,z 1,10,0 \ No newline at end of file diff --git a/tests/data/csv/tabs.tsv b/tests/data/csv/tabs.tsv new file mode 100644 index 000000000..be33ff870 --- /dev/null +++ b/tests/data/csv/tabs.tsv @@ -0,0 +1,3 @@ +x y name +-122 48 hello +0 0 "null island" \ No newline at end of file diff --git a/tests/data/csv/tabs_in_csv.csv b/tests/data/csv/tabs_in_csv.csv new file mode 100644 index 000000000..1137f4ae7 --- /dev/null +++ b/tests/data/csv/tabs_in_csv.csv @@ -0,0 +1,2 @@ +x, y,z +-122 , 48,0 \ No newline at end of file diff --git a/tests/data/csv/unicode.tsv b/tests/data/csv/unicode.tsv new file mode 100644 index 000000000..d3e2a3c54 --- /dev/null +++ b/tests/data/csv/unicode.tsv @@ -0,0 +1,11 @@ +geonameid name asciiname alternatenames latitude longitude feature_class feature_code country_code cc2 admin1 admin2 admin3 admin4 population elevation gtopo3 timezone mod_date +725712 Vratsa Vratsa Vraca,Vratca,Vratsa,Vrattsa,Vratza,Wraza,Враца 43.21 23.5625 P PPLA BG 64 VRC10 64941 341 Europe/Sofia 2011-10-10 +725816 Sveti Vlas Sveti Vlas Manasturkioy,Manastŭrkioy,Monasturkioy,Monastŭrkioy,Saint Vlas,Sveti Vlas,Sveti-Vlas,Sweti Wlas,Vlas,Влас,Свети-Влас 42.7136 27.75867 P PPL BG BG 39 BGS15 BGS15-02 3875 50 -9999 Europe/Sofia 2010-03-07 +725905 Vidin Vidin Vidin,Vidine,Widin,wydyn,Видин,ویدین 43.99 22.8725 P PPLA BG 63 VID09 54409 35 Europe/Sofia 2011-10-10 +725924 Vetrino Vetrino Asya-Tepe,Jasi Tepe,Vetrino,Vyetreno,Vyetrino,Wetrino,Yasa-Tepe,Yase-Tepe,Yasu-Tepe,Yasă-Tepe,Yasŭ-Tepe,Ветрино 43.31667 27.43333 P PPL BG BG 61 VAR08 1368 223 Europe/Sofia 2011-10-10 +725935 Vetovo Vetovo Vetova,Vetovo,Vjetevo,Vyetovo,Wetowo,Ветово 43.7 26.26667 P PPL BG 53 RSE05 5175 184 Europe/Sofia 2007-04-05 +725967 Venets Venets K'okledzha,K'oklyudzha,K'okyudzha,Kiokhudza,Kiokhudža,Kokedzha,K’okledzha,K’oklyudzha,K’okyudzha,Venec,Venets,Vyenets,Wenez,Венец 43.55 26.93333 P PPL BG BG 54 SHU07 1450 334 Europe/Sofia 2011-10-10 +725988 Velingrad Velingrad Velingrad,Велинград 42.02724 23.99569 P PPL BG 48 PAZ08 24036 745 Europe/Sofia 2010-05-28 +725993 Veliko Tŭrnovo Veliko Turnovo Tarnovo,Tarnowo,Ternovo,Tirnovo,Trnova,Trnovo,Turnovo,Tărnovo,Tărnowo,Tŭrnovo,Veliko T\"rnovo,Veliko Tarnovo,Veliko Tărnovo,Weliko Tarnowo,Weliko Tyrnowo,vu~erikotarunovu~o,Велико Търново,ヴェリコタルノヴォ 43.08124 25.62904 P PPLA BG 62 VTR04 66217 162 Europe/Sofia 2007-07-01 +726050 Varna Varna Barna,Odessos,Odessus,Stalin,Varna,Warna,farna,varna,vu~aruna,wa er na,wrnh,Βάρνα,Варна,ורנה,فارنا,ვარნა,ヴァルナ,瓦爾納 43.21667 27.91667 P PPLA BG 61 VAR06 312770 95 Europe/Sofia 2011-10-10 +726114 Ugŭrchin Ugurchin Ugarchin,Ugarcin,Ugartschin,Ugarčin,Ugirkin,Ugrchin,Ugrcin,Ugrčin,Ugurchin,Ugurcin,Ugürčin,Ugărchin,Ugărtschin,Угърчин 43.1 24.41667 P PPL BG 46 LOV36 2965 298 Europe/Sofia 2007-04-05 diff --git a/tests/data/csv/untitled file b/tests/data/csv/untitled file new file mode 100644 index 000000000..e69de29bb diff --git a/tests/data/csv/warns/invalid_geometries.csv b/tests/data/csv/warns/invalid_geometries.csv new file mode 100644 index 000000000..6763f08dc --- /dev/null +++ b/tests/data/csv/warns/invalid_geometries.csv @@ -0,0 +1,3 @@ +x,y,z +-122a,48b,bogus +-122,48,fine \ No newline at end of file diff --git a/tests/data/csv/windows_newlines.csv b/tests/data/csv/windows_newlines.csv new file mode 100644 index 000000000..3a6e88b89 --- /dev/null +++ b/tests/data/csv/windows_newlines.csv @@ -0,0 +1,2 @@ +x,y,z +0,0,0 \ No newline at end of file diff --git a/tests/data/csv/wkt.csv b/tests/data/csv/wkt.csv new file mode 100644 index 000000000..201ff899b --- /dev/null +++ b/tests/data/csv/wkt.csv @@ -0,0 +1,9 @@ +type,WKT +point, "POINT (30 10)" +linestring, "LINESTRING (30 10, 10 30, 40 40)" +polygon, "POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))" +polygon, "POLYGON ((35 10, 10 20, 15 40, 45 45, 35 10),(20 30, 35 35, 30 20, 20 30))" +multipoint, "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))" +multilinestring, "MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))" +multipolygon, "MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))" +multipolygon, "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),(30 20, 20 25, 20 15, 30 20)))" \ No newline at end of file diff --git a/tests/data/good_maps/point_csv.xml b/tests/data/good_maps/point_csv.xml index ef2cc4de3..fc36de8c7 100644 --- a/tests/data/good_maps/point_csv.xml +++ b/tests/data/good_maps/point_csv.xml @@ -22,7 +22,7 @@ 1 - ../csv/points.vrt + ../vrt/points.vrt 0 ogr diff --git a/tests/data/vrt/points.vrt b/tests/data/vrt/points.vrt new file mode 100644 index 000000000..e40d87086 --- /dev/null +++ b/tests/data/vrt/points.vrt @@ -0,0 +1,8 @@ + + + ../csv/points.csv + wkbPoint + WGS84 + + + \ No newline at end of file