Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Add spec test for plus-1-corrected plus-2-corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
wschella committed May 16, 2019
1 parent 1f432f4 commit c95bc34
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if (stream.length === 0) {
| >= ||| ? | | |
| * ||| ? | | |
| / ||| I | | Occurs in coalesce |
| + ||| X | | |
| + ||| X | | Depends on #28 |
| - ||| ? | | |
| _Notes_ | | | | | Spec compliance depends on #13 and #14 |
| [Functional Forms](https://www.w3.org/TR/sparql11-query/#func-forms)
Expand Down
21 changes: 19 additions & 2 deletions test/spec/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,25 @@ export function data4() {
// :x7 :p "1"^^xsd:string ; :q "2" .
// :x8 :p "1"^^xsd:string ; :q 2 .

export function dataBuiltin() {

export function dataBuiltin3() {
return {
x1p: '"a"',
x1q: '1',
// x2p: '"1"',
x2q: '"1"',
// x3p: '',
x3q: '"1"',
x4p: '1',
x4q: '2',
x5p: '1.0',
x5q: '2',
x6p: '"1"',
x6q: '"2"',
x7p: '"1"^^xsd:string',
x7q: '"2"',
x8p: '"1"^^xsd:string',
x8q: '2',
};
}

// hash unicode ----------------------------------------------------------------
Expand Down
42 changes: 31 additions & 11 deletions test/spec/plus-1-corrected.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Data from './_data';

import { aliases as a, testAll } from '../util/utils';
import { aliases as a, testAll, int, testAllErrors, decimal } from '../util/utils';

/**
* REQUEST: plus-1-corrected.rq
Expand All @@ -26,9 +26,29 @@ import { aliases as a, testAll } from '../util/utils';
*/

describe.skip('We should respect the plus-1-corrected spec', () => {
const { } = Data.data();
const {
x1p, x1q,
x2q,
x3q,
x4p, x4q,
x5p, x5q,
x6p, x6q,
x7p, x7q,
x8p, x8q,
} = Data.dataBuiltin3();

testAll([
'BNODE() = "foo"',
`${x4p} + ${x4q} = ${int('3')}`,
`${x5p} + ${x5q} = ${decimal('3.0')}`,
]);

testAllErrors([
`${x1p} + ${x1q} = error`,
`BNODE() + ${x2q} = error`,
`<http://example/a> + ${x3q} = error`,
`${x6p} + ${x6q} = error`,
`${x7p} + ${x7q} = error`,
`${x8p} + ${x8q} = error`,
]);
});

Expand All @@ -43,31 +63,31 @@ describe.skip('We should respect the plus-1-corrected spec', () => {
* <variable name="sum"/>
* </head>
* <results>
* <result>
* <result> //x2
* <binding name="x">
* <bnode>b0</bnode>
* </binding>
* <binding name="y">
* <literal>1</literal>
* </binding>
* </result>
* <result>
* <result> //x3
* <binding name="x">
* <uri>http://example/a</uri>
* </binding>
* <binding name="y">
* <literal>1</literal>
* </binding>
* </result>
* <result>
* <result> //x6
* <binding name="x">
* <literal>1</literal>
* </binding>
* <binding name="y">
* <literal>2</literal>
* </binding>
* </result>
* <result>
* <result> //x4
* <binding name="x">
* <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
* </binding>
Expand All @@ -77,7 +97,7 @@ describe.skip('We should respect the plus-1-corrected spec', () => {
* <binding name="sum">
* <literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal>
* </binding>
* </result>
* </result> //x7
* <result>
* <binding name="x">
* <literal datatype="http://www.w3.org/2001/XMLSchema#string">1</literal>
Expand All @@ -86,15 +106,15 @@ describe.skip('We should respect the plus-1-corrected spec', () => {
* <literal>2</literal>
* </binding>
* </result>
* <result>
* <result> //x8
* <binding name="x">
* <literal datatype="http://www.w3.org/2001/XMLSchema#string">1</literal>
* </binding>
* <binding name="y">
* <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal>
* </binding>
* </result>
* <result>
* <result> //x5
* <binding name="x">
* <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.0</literal>
* </binding>
Expand All @@ -104,7 +124,7 @@ describe.skip('We should respect the plus-1-corrected spec', () => {
* <binding name="sum">
* <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">3.0</literal>
* </binding>
* </result>
* </result> //x1
* <result>
* <binding name="x">
* <literal>a</literal>
Expand Down
27 changes: 22 additions & 5 deletions test/spec/plus-2-corrected.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Data from './_data';

import { aliases as a, testAll } from '../util/utils';
import { aliases as a, testAll, testAllErrors, int, decimal } from '../util/utils';

/**
* REQUEST: plus-2-corrected.rq
Expand All @@ -26,10 +26,27 @@ import { aliases as a, testAll } from '../util/utils';
* .
*/

describe.skip('We should respect the plus-2-corrected spec', () => {
const { } = Data.data();
testAll([
'BNODE() = "foo"',
describe('We should respect the plus-2-corrected spec', () => {
const {
x1p, x1q,
x2q,
x3q,
x4p, x4q,
x5p, x5q,
x6p, x6q,
x7p, x7q,
x8p, x8q,
} = Data.dataBuiltin3();

testAllErrors([
`str(${x1p}) + str(${x1q}) = error`,
`str(BNODE()) + str(${x2q}) = error`,
`str(<http://example/a>) + str(${x3q}) = error`,
`str(${x4p}) + str(${x4q}) = error`,
`str(${x5p}) + str(${x5q}) = error`,
`str(${x6p}) + str(${x6q}) = error`,
`str(${x7p}) + str(${x7q}) = error`,
`str(${x8p}) + str(${x8q}) = error`,
]);
});

Expand Down

0 comments on commit c95bc34

Please sign in to comment.