Skip to content

Commit

Permalink
Covers equality of float and boolean
Browse files Browse the repository at this point in the history
Both was not covered
  • Loading branch information
Tpt authored and gkellogg committed Feb 22, 2024
1 parent f16fdd5 commit 131c80f
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 1 deletion.
26 changes: 26 additions & 0 deletions sparql/sparql10/expr-equals/data-eq-bool.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix : <http://example.org/things#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:xi1 :pl "1"^^xsd:integer ; :pr "1"^^xsd:boolean .

:xd1 :pl "1"^^xsd:decimal ; :pr "1"^^xsd:boolean .

:xf1 :pl "1"^^xsd:float ; :pr "1"^^xsd:boolean .

:xdo1 :pl "1"^^xsd:double ; :pr "1"^^xsd:boolean .

:xb1 :pl "0"^^xsd:boolean ; :pr "false"^^xsd:boolean .
:xb2 :pl "1"^^xsd:boolean ; :pr "true"^^xsd:boolean .
:xb3 :pl "false"^^xsd:boolean ; :pr "0"^^xsd:boolean .
:xb4 :pl "true"^^xsd:boolean ; :pr "1"^^xsd:boolean .
:xb5 :pl "false"^^xsd:boolean ; :pr "false"^^xsd:boolean .
:xb6 :pl "true"^^xsd:boolean ; :pr "true"^^xsd:boolean .
:xb7 :pl "true"^^xsd:boolean ; :pr "yes"^^xsd:boolean .
:xb9 :pl "true"^^xsd:boolean ; :pr "false"^^xsd:boolean .

:xt1 :pl "zzz"^^:myType ; :pr "true"^^xsd:boolean .

:xp1 :p "zzz" ; :pr "true"^^xsd:boolean .
:xp2 :p "1" ; :pr "true"^^xsd:boolean .

:xu :p :z ; :pr "true"^^xsd:boolean .
30 changes: 30 additions & 0 deletions sparql/sparql10/expr-equals/data-eq-float.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@prefix : <http://example.org/things#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:xi1 :pl "1"^^xsd:integer ; :pr "1"^^xsd:float .
:xi2 :pl "01"^^xsd:integer ; :pr "1"^^xsd:float .
:xi3 :pl "2"^^xsd:integer ; :pr "1"^^xsd:float .

:xd1 :pl "1"^^xsd:decimal ; :pr "1"^^xsd:float .
:xd2 :pl "1.0"^^xsd:decimal ; :pr "1"^^xsd:float .
:xd3 :pl "2"^^xsd:decimal ; :pr "1"^^xsd:float .

:xf1 :pl "1"^^xsd:float ; :pr "1"^^xsd:float .
:xf2 :pl "1.0"^^xsd:float ; :pr "1"^^xsd:float .
:xf3 :pl "1"^^xsd:float ; :pr "1"^^xsd:integer .
:xf4 :pl "1"^^xsd:float ; :pr "1"^^xsd:decimal .
:xf5 :pl "1"^^xsd:float ; :pr "1"^^xsd:double .
:xf6 :pl "1"^^xsd:float ; :pr "1" .
:xf7 :pl "1"^^xsd:float ; :pr :z .
:xf8 :pl "1"^^xsd:float ; :pr "2"^^xsd:float .

:xdo1 :pl "1"^^xsd:double ; :pr "1"^^xsd:float .
:xdo2 :pl "1.0"^^xsd:double ; :pr "1"^^xsd:float .
:xdo3 :pl "2"^^xsd:double ; :pr "1"^^xsd:float .

:xt1 :pl "zzz"^^:myType ; :pr "1"^^xsd:float .

:xp1 :p "zzz" ; :pr "1"^^xsd:float .
:xp2 :p "1" ; :pr "1"^^xsd:float .

:xu :p :z ; :pr "1"^^xsd:float .
18 changes: 17 additions & 1 deletion sparql/sparql10/expr-equals/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
(
:eq-1 :eq-2 :eq-3 :eq-4 :eq-5 :eq-2-1 :eq-2-2
:eq-graph-1 :eq-graph-2 :eq-graph-3 :eq-graph-4 :eq-graph-5
:eq-float :eq-bool
).

:eq-1 a mf:QueryEvaluationTest ;
Expand Down Expand Up @@ -140,5 +141,20 @@
qt:data <data-eq.ttl> ] ;
mf:result <result-eq-graph-5.ttl>
.

:eq-float a mf:QueryEvaluationTest ;
rdfs:comment "= with float" ;
mf:name "Equality with float" ;
mf:action
[ qt:query <query-eq-float.rq> ;
qt:data <data-eq-float.ttl> ] ;
mf:result <result-eq-float.ttl>
.
:eq-bool a mf:QueryEvaluationTest ;
rdfs:comment "= with bool" ;
mf:name "Equality with bool" ;
mf:action
[ qt:query <query-eq-bool.rq> ;
qt:data <data-eq-bool.ttl> ] ;
mf:result <result-eq-bool.ttl>
.

7 changes: 7 additions & 0 deletions sparql/sparql10/expr-equals/query-eq-bool.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://example.org/things#>
SELECT ?x
WHERE
{ ?x :pr ?vr ; :pl ?vl .
FILTER ( ?vr = ?vl ) .
}
7 changes: 7 additions & 0 deletions sparql/sparql10/expr-equals/query-eq-float.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://example.org/things#>
SELECT ?x
WHERE
{ ?x :pr ?vr ; :pl ?vl .
FILTER ( ?vr = ?vl ) .
}
37 changes: 37 additions & 0 deletions sparql/sparql10/expr-equals/result-eq-bool.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://example.org/things#> .

[] rdf:type rs:ResultSet ;
rs:resultVariable "x" ;
rs:solution
[ rs:binding [ rs:value :xb1 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xb2 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xb3 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xb4 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xb5 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xb6 ;
rs:variable "x"
]
] .
62 changes: 62 additions & 0 deletions sparql/sparql10/expr-equals/result-eq-float.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://example.org/things#> .

[] rdf:type rs:ResultSet ;
rs:resultVariable "x" ;
rs:solution
[ rs:binding [ rs:value :xi1 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xi2 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xd1 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xd2 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xf1 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xf2 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xf3 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xf4 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xf5 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xdo1 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :xdo2 ;
rs:variable "x"
]
] .

0 comments on commit 131c80f

Please sign in to comment.