Test parameter types
To test parameter type checks implement a TypeParameterTestGenerator.
Pseudocode:
-
Read input file https://spec.ottr.xyz/rOTTR/0.2.0/types.owl.ttl
-
for each type T in file, generate a base template:
BaseTemplate-T[ T ?x ] :: BASE
(use a method to generate the base template (using strings directly is fine), and use a method to generate template name from type name. -
run SPARQL query over input file: (untested)
SELECT ?sub ?super { ?sub ottr:subType* ?super }
-
for each (?sub, ?super) in query result,
- make a template
Template-sub-super [sub ?x] :: BaseTemplate-Super(?x) }
- make a positive test case and add to manifest file
- make a template
-
run SPARQL query over input file: (untested)
SELECT ?sub ?super { ?sub a ottr:Type. ?super a ottr:Type . FILTER NOT EXISTS {?sub ottr:subType* ?super }}
-
for each (?sub, ?super) in query result,
- make a template
Template-sub-super [sub ?x] :: BaseTemplate-Super(?x) }
- make a negative test case and add to manifest file
- make a template
-
for a bit of organisation, write the following to different folders:
- base templates
- "positive" templates
- "negative" templates
-
all test cases can be written to the same manifest file.
-
for positive tests,
- generate a base template with one parameter for each type.
- For each subtype of each type X, make a template with one parameter that instantiates the base template with X as parameter type.
-
for negative tests, do the opposite