diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/sort/GOPS.nq | 3 | ||||
-rw-r--r-- | test/sort/GOSP.nq | 3 | ||||
-rw-r--r-- | test/sort/GPSO.nq | 3 | ||||
-rw-r--r-- | test/sort/GSOP.nq | 3 | ||||
-rw-r--r-- | test/sort/GSPO.nq | 3 | ||||
-rw-r--r-- | test/sort/OPS.nq | 3 | ||||
-rw-r--r-- | test/sort/OSP.nq | 3 | ||||
-rw-r--r-- | test/sort/POS.nq | 3 | ||||
-rw-r--r-- | test/sort/PSO.nq | 3 | ||||
-rw-r--r-- | test/sort/SOP.nq | 3 | ||||
-rw-r--r-- | test/sort/SPO.nq | 3 | ||||
-rw-r--r-- | test/sort/input.trig | 27 | ||||
-rw-r--r-- | test/sort/pretty.nq | 3 | ||||
-rw-r--r-- | test/sort/untyped.nq | 12 | ||||
-rwxr-xr-x | test/test_sort.py | 16 |
15 files changed, 76 insertions, 15 deletions
diff --git a/test/sort/GOPS.nq b/test/sort/GOPS.nq index c7472e03..3d033b6e 100644 --- a/test/sort/GOPS.nq +++ b/test/sort/GOPS.nq @@ -1,10 +1,13 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . diff --git a/test/sort/GOSP.nq b/test/sort/GOSP.nq index c7472e03..3d033b6e 100644 --- a/test/sort/GOSP.nq +++ b/test/sort/GOSP.nq @@ -1,10 +1,13 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . diff --git a/test/sort/GPSO.nq b/test/sort/GPSO.nq index 1a858017..67e13aa7 100644 --- a/test/sort/GPSO.nq +++ b/test/sort/GPSO.nq @@ -7,4 +7,7 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/ _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . diff --git a/test/sort/GSOP.nq b/test/sort/GSOP.nq index fc073a00..dbfcb7c1 100644 --- a/test/sort/GSOP.nq +++ b/test/sort/GSOP.nq @@ -1,10 +1,13 @@ <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . diff --git a/test/sort/GSPO.nq b/test/sort/GSPO.nq index 726b1d42..5aab6e1e 100644 --- a/test/sort/GSPO.nq +++ b/test/sort/GSPO.nq @@ -1,10 +1,13 @@ <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . diff --git a/test/sort/OPS.nq b/test/sort/OPS.nq index 456ade7f..593760be 100644 --- a/test/sort/OPS.nq +++ b/test/sort/OPS.nq @@ -1,6 +1,9 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . diff --git a/test/sort/OSP.nq b/test/sort/OSP.nq index 456ade7f..593760be 100644 --- a/test/sort/OSP.nq +++ b/test/sort/OSP.nq @@ -1,6 +1,9 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . diff --git a/test/sort/POS.nq b/test/sort/POS.nq index 51c675de..20eabfe1 100644 --- a/test/sort/POS.nq +++ b/test/sort/POS.nq @@ -8,3 +8,6 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/ _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . diff --git a/test/sort/PSO.nq b/test/sort/PSO.nq index 0fb7bd68..113dd549 100644 --- a/test/sort/PSO.nq +++ b/test/sort/PSO.nq @@ -8,3 +8,6 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/ _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . diff --git a/test/sort/SOP.nq b/test/sort/SOP.nq index 1692689c..7867eb24 100644 --- a/test/sort/SOP.nq +++ b/test/sort/SOP.nq @@ -1,7 +1,10 @@ +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . diff --git a/test/sort/SPO.nq b/test/sort/SPO.nq index 508debc7..2b09a976 100644 --- a/test/sort/SPO.nq +++ b/test/sort/SPO.nq @@ -1,9 +1,12 @@ <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . diff --git a/test/sort/input.trig b/test/sort/input.trig index 154a9fb8..9561d9b8 100644 --- a/test/sort/input.trig +++ b/test/sort/input.trig @@ -1,19 +1,22 @@ @prefix eg: <http://example.org/> . eg:graph1 { -eg:s - eg:blank [ - eg:with eg:aProperty , - eg:orAnother - ] ; - eg:list ( - 1 - 2 - ) ; - eg:literal "s1" . + eg:s + a eg:Subject ; + eg:blank [ + a eg:Anonymous ; + eg:with eg:aProperty , + eg:orAnother + ] ; + eg:list ( + 1 + 2 + ) ; + eg:literal "s1" . } eg:graph2 { -eg:a - eg:b eg:c . + eg:a + a eg:OtherSubject ; + eg:b eg:c . } diff --git a/test/sort/pretty.nq b/test/sort/pretty.nq index 451247d4..97851b82 100644 --- a/test/sort/pretty.nq +++ b/test/sort/pretty.nq @@ -1,4 +1,6 @@ +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . <http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . +_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Anonymous> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . _:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . <http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . @@ -7,4 +9,5 @@ _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/ _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . _:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . <http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . <http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . diff --git a/test/sort/untyped.nq b/test/sort/untyped.nq new file mode 100644 index 00000000..74625d7d --- /dev/null +++ b/test/sort/untyped.nq @@ -0,0 +1,12 @@ +<http://example.org/s> <http://example.org/blank> _:b1 <http://example.org/graph1> . +_:b1 <http://example.org/with> <http://example.org/aProperty> <http://example.org/graph1> . +_:b1 <http://example.org/with> <http://example.org/orAnother> <http://example.org/graph1> . +<http://example.org/s> <http://example.org/list> _:b2 <http://example.org/graph1> . +_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . +_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 <http://example.org/graph1> . +_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> . +_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://example.org/graph1> . +<http://example.org/s> <http://example.org/literal> "s1" <http://example.org/graph1> . +<http://example.org/s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Subject> <http://example.org/graph1> . +<http://example.org/a> <http://example.org/b> <http://example.org/c> <http://example.org/graph2> . +<http://example.org/a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherSubject> <http://example.org/graph2> . diff --git a/test/test_sort.py b/test/test_sort.py index 4080b93c..04c8ba10 100755 --- a/test/test_sort.py +++ b/test/test_sort.py @@ -28,15 +28,17 @@ collations = [ ] -def check(test_dir, command_prefix, out_dir, input_path, name): +def check(test_dir, command_prefix, out_dir, input_path, name, flags=None): """Sort a single input in the named order and check the output. - The expected output is assumed to exist at test_dir/NAME.nq. + The expected output is assumed to exist at test_dir/NAME.untyped.nq. """ output_path = os.path.join(out_dir, name + ".nq") result_path = os.path.join(test_dir, name + ".nq") - options = [] if name == "pretty" else ["-c", name] + options = flags if flags is not None else [] + if name not in ["pretty", "untyped"]: + options += ["-c", name] # Randomly add irrelevant options just to cover them if random.choice([True, False]): @@ -68,10 +70,18 @@ def run_tests(test_dir, command_prefix, out_dir): input_trig = os.path.join(test_dir, "input.trig") n_failures = 0 + + # Test all the basic collations, and "pretty" with type first for name in collations: if not check(test_dir, command_prefix, out_dir, input_trig, name): n_failures += 1 + # Test "pretty" without type first + if not check( + test_dir, command_prefix, out_dir, input_trig, "untyped", ["-t"] + ): + n_failures += 1 + return n_failures |