aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/canon/bad-boolean.ttl5
-rw-r--r--test/canon/bad-decimal-leading.ttl4
-rw-r--r--test/canon/bad-decimal-trailing.ttl4
-rw-r--r--test/canon/bad-empty-boolean.ttl5
-rw-r--r--test/canon/bad-integer-leading.ttl4
-rw-r--r--test/canon/bad-integer-trailing.ttl4
-rw-r--r--test/canon/manifest.ttl58
-rw-r--r--test/canon/test-canon.nt70
-rw-r--r--test/canon/test-canon.ttl76
-rw-r--r--test/meson.build8
-rw-r--r--test/test_string.c2
11 files changed, 239 insertions, 1 deletions
diff --git a/test/canon/bad-boolean.ttl b/test/canon/bad-boolean.ttl
new file mode 100644
index 00000000..c4fc3eb5
--- /dev/null
+++ b/test/canon/bad-boolean.ttl
@@ -0,0 +1,5 @@
+@base <http://example.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[] <boolean> " ja "^^xsd:boolean .
+
diff --git a/test/canon/bad-decimal-leading.ttl b/test/canon/bad-decimal-leading.ttl
new file mode 100644
index 00000000..0d18eac7
--- /dev/null
+++ b/test/canon/bad-decimal-leading.ttl
@@ -0,0 +1,4 @@
+@base <http://example.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[] <decimal> " junk 1234.5678 "^^xsd:decimal .
diff --git a/test/canon/bad-decimal-trailing.ttl b/test/canon/bad-decimal-trailing.ttl
new file mode 100644
index 00000000..10882ef5
--- /dev/null
+++ b/test/canon/bad-decimal-trailing.ttl
@@ -0,0 +1,4 @@
+@base <http://example.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[] <decimal> " 1234.5678 junk "^^xsd:decimal .
diff --git a/test/canon/bad-empty-boolean.ttl b/test/canon/bad-empty-boolean.ttl
new file mode 100644
index 00000000..9a390c46
--- /dev/null
+++ b/test/canon/bad-empty-boolean.ttl
@@ -0,0 +1,5 @@
+@base <http://example.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[] <boolean> ""^^xsd:boolean .
+
diff --git a/test/canon/bad-integer-leading.ttl b/test/canon/bad-integer-leading.ttl
new file mode 100644
index 00000000..80c1a6af
--- /dev/null
+++ b/test/canon/bad-integer-leading.ttl
@@ -0,0 +1,4 @@
+@base <http://example.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[] <integer> " junk 987654321 "^^xsd:integer .
diff --git a/test/canon/bad-integer-trailing.ttl b/test/canon/bad-integer-trailing.ttl
new file mode 100644
index 00000000..a94a9ec4
--- /dev/null
+++ b/test/canon/bad-integer-trailing.ttl
@@ -0,0 +1,4 @@
+@base <http://example.org/> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[] <integer> " 987654321 junk "^^xsd:integer .
diff --git a/test/canon/manifest.ttl b/test/canon/manifest.ttl
new file mode 100644
index 00000000..e2195212
--- /dev/null
+++ b/test/canon/manifest.ttl
@@ -0,0 +1,58 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+
+<>
+ a mf:Manifest ;
+ rdfs:comment "Serd canonical literal test cases" ;
+ mf:entries (
+ <#bad-boolean>
+ <#bad-decimal-leading>
+ <#bad-decimal-trailing>
+ <#bad-empty-boolean>
+ <#bad-integer-leading>
+ <#bad-integer-trailing>
+ <#test-canon>
+ ) .
+
+<#bad-boolean>
+ a rdft:TestTurtleNegativeEval ;
+ mf:name "bad-boolean" ;
+ rdfs:comment "Invalid xsd::boolean syntax" ;
+ mf:action <bad-boolean.ttl> .
+
+<#bad-decimal-leading>
+ a rdft:TestTurtleNegativeEval ;
+ mf:name "bad-decimal-leading" ;
+ rdfs:comment "Invalid xsd::decimal syntax (leading garbage)" ;
+ mf:action <bad-decimal-leading.ttl> .
+
+<#bad-decimal-trailing>
+ a rdft:TestTurtleNegativeEval ;
+ mf:name "bad-decimal-trailing" ;
+ rdfs:comment "Invalid xsd::decimal syntax (trailing garbage)" ;
+ mf:action <bad-decimal-trailing.ttl> .
+
+<#bad-empty-boolean>
+ a rdft:TestTurtleNegativeEval ;
+ mf:name "bad-empty-boolean" ;
+ rdfs:comment "Invalid xsd::boolean syntax (no value)" ;
+ mf:action <bad-empty-boolean.ttl> .
+
+<#bad-integer-leading>
+ a rdft:TestTurtleNegativeEval ;
+ mf:name "bad-integer-leading" ;
+ rdfs:comment "Invalid xsd::integer syntax (leading garbage)" ;
+ mf:action <bad-integer-leading.ttl> .
+
+<#bad-integer-trailing>
+ a rdft:TestTurtleNegativeEval ;
+ mf:name "bad-integer-trailing" ;
+ rdfs:comment "Invalid xsd::integer syntax (trailing garbage)" ;
+ mf:action <bad-integer-trailing.ttl> .
+
+<#test-canon>
+ a rdft:TestTurtleEval ;
+ mf:name "test-canon" ;
+ mf:action <test-canon.ttl> ;
+ mf:result <test-canon.nt> .
diff --git a/test/canon/test-canon.nt b/test/canon/test-canon.nt
new file mode 100644
index 00000000..ff492890
--- /dev/null
+++ b/test/canon/test-canon.nt
@@ -0,0 +1,70 @@
+_:b1 <http://example.org/boolean> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+_:b1 <http://example.org/boolean> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+_:b1 <http://example.org/boolean> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+_:b1 <http://example.org/boolean> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
+_:b1 <http://example.org/ieee754> "1.0E2"^^<http://www.w3.org/2001/XMLSchema#float> .
+_:b1 <http://example.org/ieee754> "-1.0E2"^^<http://www.w3.org/2001/XMLSchema#float> .
+_:b1 <http://example.org/ieee754> "1.0E3"^^<http://www.w3.org/2001/XMLSchema#double> .
+_:b1 <http://example.org/ieee754> "-1.0E3"^^<http://www.w3.org/2001/XMLSchema#double> .
+_:b1 <http://example.org/machine> "9223372036854775807"^^<http://www.w3.org/2001/XMLSchema#long> .
+_:b1 <http://example.org/machine> "-9223372036854775808"^^<http://www.w3.org/2001/XMLSchema#long> .
+_:b1 <http://example.org/machine> "2147483647"^^<http://www.w3.org/2001/XMLSchema#int> .
+_:b1 <http://example.org/machine> "-2147483648"^^<http://www.w3.org/2001/XMLSchema#int> .
+_:b1 <http://example.org/machine> "32767"^^<http://www.w3.org/2001/XMLSchema#short> .
+_:b1 <http://example.org/machine> "-32768"^^<http://www.w3.org/2001/XMLSchema#short> .
+_:b1 <http://example.org/machine> "127"^^<http://www.w3.org/2001/XMLSchema#byte> .
+_:b1 <http://example.org/machine> "-128"^^<http://www.w3.org/2001/XMLSchema#byte> .
+_:b1 <http://example.org/machine> "1"^^<http://www.w3.org/2001/XMLSchema#unsignedLong> .
+_:b1 <http://example.org/machine> "18446744073709551615"^^<http://www.w3.org/2001/XMLSchema#unsignedLong> .
+_:b1 <http://example.org/machine> "1"^^<http://www.w3.org/2001/XMLSchema#unsignedInt> .
+_:b1 <http://example.org/machine> "4294967295"^^<http://www.w3.org/2001/XMLSchema#unsignedInt> .
+_:b1 <http://example.org/machine> "1"^^<http://www.w3.org/2001/XMLSchema#unsignedShort> .
+_:b1 <http://example.org/machine> "65535"^^<http://www.w3.org/2001/XMLSchema#unsignedShort> .
+_:b1 <http://example.org/machine> "1"^^<http://www.w3.org/2001/XMLSchema#unsignedByte> .
+_:b1 <http://example.org/machine> "255"^^<http://www.w3.org/2001/XMLSchema#unsignedByte> .
+_:b1 <http://example.org/decimal> "0.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "0.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-0.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "36893488147419103232.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-36893488147419103232.0"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-36893488147419103232.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "0.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "0.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "0.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "0.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-0.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/decimal> "-0.123"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+_:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://example.org/integer> "-36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://example.org/integer> "-36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#integer> .
+_:b1 <http://example.org/integer> "0"^^<http://www.w3.org/2001/XMLSchema#nonPositiveInteger> .
+_:b1 <http://example.org/integer> "-36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#nonPositiveInteger> .
+_:b1 <http://example.org/integer> "-1"^^<http://www.w3.org/2001/XMLSchema#negativeInteger> .
+_:b1 <http://example.org/integer> "-36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#negativeInteger> .
+_:b1 <http://example.org/integer> "0"^^<http://www.w3.org/2001/XMLSchema#nonNegativeInteger> .
+_:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#nonNegativeInteger> .
+_:b1 <http://example.org/integer> "1"^^<http://www.w3.org/2001/XMLSchema#positiveInteger> .
+_:b1 <http://example.org/integer> "36893488147419103232"^^<http://www.w3.org/2001/XMLSchema#positiveInteger> .
+_:b1 <http://example.org/langString> "no language tag" .
+_:b1 <http://example.org/taggedString> "english"@en-ca .
+_:b1 <http://example.org/time> "P1Y6M"^^<http://www.w3.org/2001/XMLSchema#duration> .
+_:b1 <http://example.org/time> "12:15:01Z"^^<http://www.w3.org/2001/XMLSchema#time> .
+_:b1 <http://example.org/time> "2004-04-12Z"^^<http://www.w3.org/2001/XMLSchema#date> .
+_:b1 <http://example.org/binary> "A1B7F080"^^<http://www.w3.org/2001/XMLSchema#hexBinary> .
+_:b1 <http://example.org/binary> "Zm9vYmF="^^<http://www.w3.org/2001/XMLSchema#base64Binary> .
+_:b1 <http://example.org/other> "untyped" .
+_:b1 <http://example.org/other> <http://example.org/uri> .
+_:b1 <http://example.org/other> "notxsd"^^<http://example.org/sometype> .
+_:b1 <http://example.org/other> "unsupported"^^<http://www.w3.org/2001/XMLSchema#name> .
diff --git a/test/canon/test-canon.ttl b/test/canon/test-canon.ttl
new file mode 100644
index 00000000..0d0b4682
--- /dev/null
+++ b/test/canon/test-canon.ttl
@@ -0,0 +1,76 @@
+@base <http://example.org/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+[
+ <boolean> " false "^^xsd:boolean ,
+ " 0 "^^xsd:boolean ,
+ " true "^^xsd:boolean ,
+ " 1 "^^xsd:boolean ;
+ <ieee754> " +0100.0 "^^xsd:float ,
+ " -0100.0 "^^xsd:float ,
+ " +01000.0 "^^xsd:double ,
+ " -01000.0 "^^xsd:double ;
+ <machine> " +09223372036854775807 "^^xsd:long ,
+ " -09223372036854775808 "^^xsd:long ,
+ " +02147483647 "^^xsd:int ,
+ " -02147483648 "^^xsd:int ,
+ " +032767 "^^xsd:short ,
+ " -032768 "^^xsd:short ,
+ " +0127 "^^xsd:byte ,
+ " -0128 "^^xsd:byte ,
+ " 01 "^^xsd:unsignedLong ,
+ " 018446744073709551615 "^^xsd:unsignedLong ,
+ " 01 "^^xsd:unsignedInt ,
+ " 04294967295 "^^xsd:unsignedInt ,
+ " 01 "^^xsd:unsignedShort ,
+ " 065535 "^^xsd:unsignedShort ,
+ " 01 "^^xsd:unsignedByte ,
+ " 0255 "^^xsd:unsignedByte ;
+ <decimal> " 00 "^^xsd:decimal ,
+ " +0 "^^xsd:decimal ,
+ " -0 "^^xsd:decimal ,
+ " 36893488147419103232 "^^xsd:decimal ,
+ " 0036893488147419103232 "^^xsd:decimal ,
+ " +36893488147419103232 "^^xsd:decimal ,
+ " +0036893488147419103232 "^^xsd:decimal ,
+ " +0036893488147419103232. "^^xsd:decimal ,
+ " +0036893488147419103232.00 "^^xsd:decimal ,
+ " +0036893488147419103232.12300 "^^xsd:decimal ,
+ " -36893488147419103232 "^^xsd:decimal ,
+ " -0036893488147419103232 "^^xsd:decimal ,
+ " -0036893488147419103232. "^^xsd:decimal ,
+ " -0036893488147419103232.00 "^^xsd:decimal ,
+ " -0036893488147419103232.12300 "^^xsd:decimal ,
+ " 00.12300 "^^xsd:decimal ,
+ " .12300 "^^xsd:decimal ,
+ " +.12300 "^^xsd:decimal ,
+ " +00.12300 "^^xsd:decimal ,
+ " -.12300 "^^xsd:decimal ,
+ " -00.12300 "^^xsd:decimal ;
+ <integer> " 36893488147419103232 "^^xsd:integer ,
+ " 0036893488147419103232 "^^xsd:integer ,
+ " +36893488147419103232 "^^xsd:integer ,
+ " +0036893488147419103232 "^^xsd:integer ,
+ " -36893488147419103232 "^^xsd:integer ,
+ " -0036893488147419103232 "^^xsd:integer ,
+ " 00 "^^xsd:nonPositiveInteger ,
+ " -036893488147419103232 "^^xsd:nonPositiveInteger ,
+ " -01 "^^xsd:negativeInteger ,
+ " -036893488147419103232 "^^xsd:negativeInteger ,
+ " 00 "^^xsd:nonNegativeInteger ,
+ " 036893488147419103232 "^^xsd:nonNegativeInteger ,
+ " +01 "^^xsd:positiveInteger ,
+ " 036893488147419103232 "^^xsd:positiveInteger ;
+ <langString> "no language tag"^^rdf:langString ;
+ <taggedString> "english"@EN-CA ;
+ <time> " P1Y6M0D "^^xsd:duration ,
+ " 12:15:01+00:00 "^^xsd:time ,
+ " 02004-04-12+00:00 "^^xsd:date ;
+ <binary> "A 1 B7 F080"^^xsd:hexBinary ,
+ " Zm 9v Y m F="^^xsd:base64Binary ;
+ <other> "untyped" ,
+ <uri> ,
+ "notxsd"^^<sometype> ,
+ "unsupported"^^xsd:name
+] .
diff --git a/test/meson.build b/test/meson.build
index c4dc4b3b..e8392559 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -249,6 +249,14 @@ if get_option('utils')
suite: ['rdf', 'serd'],
timeout: 240)
+ manifest = files('canon' / 'manifest.ttl')
+ base_uri = serd_base + 'canon' + '/'
+ test('canon', run_test_suite,
+ args: script_args + [manifest, base_uri, '--', '-C'],
+ env: test_env,
+ suite: ['rdf', 'serd'],
+ timeout: 240)
+
### The lax suite is special because it is run twice...
lax_manifest = files('lax/manifest.ttl')
lax_base_uri = serd_base + name + '/'
diff --git a/test/test_string.c b/test/test_string.c
index 2bd47680..f8534001 100644
--- a/test/test_string.c
+++ b/test/test_string.c
@@ -32,7 +32,7 @@ test_strerror(void)
{
const char* msg = serd_strerror(SERD_SUCCESS);
assert(!strcmp(msg, "Success"));
- for (int i = SERD_FAILURE; i <= SERD_ERR_BAD_INDEX; ++i) {
+ for (int i = SERD_FAILURE; i <= SERD_ERR_INVALID; ++i) {
msg = serd_strerror((SerdStatus)i);
assert(strcmp(msg, "Success"));
}