-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
415 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
-GROUP TCKMap1 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# Statically access a field of a non-null map | ||
-CASE Scenario1 | ||
-STATEMENT WITH {existing: 42, notMissing: null} AS m | ||
RETURN m.notMissing, m.existing; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
|42 | ||
|
||
# Statically access a field of a null map | ||
-CASE Scenario2 | ||
-SKIP | ||
-STATEMENT WITH null AS m | ||
RETURN m.missing; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
# Statically access a field of a map resulting from an expression | ||
-CASE Scenario3 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT WITH [{existing: 42, notMissing: null}, {existing: 42, notMissing: null}] AS list | ||
RETURN (list[1]).notMissing, (list[1]).existing; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
|42 | ||
|
||
# Statically access a field is case-sensitive | ||
-CASE Scenario4 | ||
-STATEMENT WITH {name: 'Mats', nome: 'Pontus'} AS map | ||
RETURN map.name AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-STATEMENT WITH {name: 'Mats', Name: 'Pontus'} AS map | ||
RETURN map.name AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
|
||
-STATEMENT WITH {name: 'Mats', Name: 'Pontus'} AS map | ||
RETURN map.nAMe AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-CASE Scenario4_error | ||
-SKIP | ||
-STATEMENT WITH {name: 'Mats', Name: 'Pontus'} AS map | ||
RETURN map.Name AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Pontus | ||
|
||
-STATEMENT WITH {name: 'Mats', Name: 'Pontus'} AS map | ||
RETURN map.nAMe AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
|
||
|
||
# Statically access a field with a delimited identifier | ||
-CASE Scenario5 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT WITH {name: 'Mats', nome: 'Pontus'} AS map | ||
RETURN map.`name` AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-STATEMENT WITH {name: 'Mats', nome: 'Pontus'} AS map | ||
RETURN map.`nome` AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Pontus | ||
|
||
-STATEMENT WITH {name: 'Mats', nome: 'Pontus'} AS map | ||
RETURN map.`Mats` AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
-STATEMENT WITH {name: 'Mats', nome: 'Pontus'} AS map | ||
RETURN map.`null` AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
-STATEMENT WITH {null: 'Mats', NULL: 'Pontus'} AS map | ||
RETURN map.`null` AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-STATEMENT WITH {null: 'Mats', NULL: 'Pontus'} AS map | ||
RETURN map.NULL` AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Pontus | ||
|
||
# Fail when performing property access on a non-map | ||
-CASE Scenario6 | ||
-STATEMENT WITH 123 AS nonMap | ||
RETURN nonMap.num; | ||
## Outcome: an Error should be raised at compile time: InvalidArgumentType | ||
---- error | ||
Binder exception: nonMap has data type INT64 but (NODE,REL,STRUCT) was expected. | ||
|
||
-STATEMENT WITH 42.45 AS nonMap | ||
RETURN nonMap.num; | ||
## Outcome: an Error should be raised at compile time: InvalidArgumentType | ||
---- error | ||
Binder exception: nonMap has data type DOUBLE but (NODE,REL,STRUCT) was expected. | ||
|
||
-STATEMENT WITH True AS nonMap | ||
RETURN nonMap.num; | ||
## Outcome: an Error should be raised at compile time: InvalidArgumentType | ||
---- error | ||
Binder exception: nonMap has data type BOOL but (NODE,REL,STRUCT) was expected. | ||
|
||
-STATEMENT WITH False AS nonMap | ||
RETURN nonMap.num; | ||
## Outcome: an Error should be raised at compile time: InvalidArgumentType | ||
---- error | ||
Binder exception: nonMap has data type BOOL but (NODE,REL,STRUCT) was expected. | ||
|
||
-STATEMENT WITH 'string' AS nonMap | ||
RETURN nonMap.num; | ||
## Outcome: an Error should be raised at compile time: InvalidArgumentType | ||
---- error | ||
Binder exception: nonMap has data type STRING but (NODE,REL,STRUCT) was expected. | ||
|
||
-STATEMENT WITH [123, True] AS nonMap | ||
RETURN nonMap.num; | ||
## Outcome: an Error should be raised at compile time: InvalidArgumentType | ||
---- error | ||
Binder exception: Cannot bind LIST_CREATION with parameter type INT64 and BOOL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
-GROUP TCKMap2 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# Dynamically access a field based on parameters when there is no type information | ||
-CASE Scenario1 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
## Context: parameters are: | ||
#parameters are: | ||
#expr|{name: 'Apa'} | ||
#idx|'name' | ||
-STATEMENT WITH $expr AS expr, $idx AS idx | ||
RETURN expr[idx] AS value; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Apa | ||
|
||
# Dynamically access a field based on parameters when there is rhs type information | ||
-CASE Scenario2 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
## Context: parameters are: | ||
#parameters are: | ||
#expr|{name: 'Apa'} | ||
#idx|'name' | ||
-STATEMENT WITH $expr AS expr, $idx AS idx | ||
RETURN expr[toString(idx)] AS value; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Apa | ||
|
||
# Dynamically access a field on null results in null | ||
-CASE Scenario3 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT WITH null AS expr, 'x' AS idx | ||
RETURN expr[idx] AS value; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
# Dynamically access a field with null results in null | ||
-CASE Scenario4 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT WITH map(['name'], ['Mats']) AS expr, null AS idx | ||
RETURN expr[idx] AS value; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
# Dynamically access a field is case-sensitive | ||
-CASE Scenario5 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT WITH map(['name', 'nome'], ['Mats', 'Pontus']) AS map | ||
RETURN map['name'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-STATEMENT WITH map(['name', 'Name'], ['Mats', 'Pontus']) AS map | ||
RETURN map['name'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-STATEMENT WITH {name: 'Mats', Name: 'Pontus'} AS map | ||
RETURN map['Name'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Pontus | ||
|
||
-STATEMENT WITH {name: 'Mats', Name: 'Pontus'} AS map | ||
RETURN map['nAMe'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
-STATEMENT WITH {name: 'Mats', nome: 'Pontus'} AS map | ||
RETURN map['null'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
null | ||
|
||
-STATEMENT WITH {null: 'Mats', NULL: 'Pontus'} AS map | ||
RETURN map['null'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Mats | ||
|
||
-STATEMENT WITH {null: 'Mats', NULL: 'Pontus'} AS map | ||
RETURN map['NULL'] AS result; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
Pontus | ||
|
||
# Fail at runtime when attempting to index with an Int into a Map | ||
-CASE Scenario6 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
## Context: parameters are: | ||
#parameters are: | ||
#expr|{name: 'Apa'} | ||
#idx|0 | ||
-STATEMENT WITH $expr AS expr, $idx AS idx | ||
RETURN expr[idx]; | ||
## Outcome: an Error should be raised at runtime: MapElementAccessByNonString | ||
---- error | ||
1 | ||
|
||
# Fail at runtime when trying to index into a map with a non-string | ||
-CASE Scenario13 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
## Context: parameters are: | ||
#parameters are: | ||
#expr|{name: 'Apa'} | ||
#idx|12.3 | ||
-STATEMENT WITH $expr AS expr, $idx AS idx | ||
RETURN expr[idx]; | ||
## Outcome: a TypeError should be raised at runtime: MapElementAccessByNonString | ||
---- error | ||
TypeError: Map element access by non-string | ||
|
||
# Fail at runtime when trying to index something which is not a map | ||
-CASE Scenario7 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
## Context: parameters are: | ||
#parameters are: | ||
#expr|100 | ||
#idx|0 | ||
-STATEMENT WITH $expr AS expr, $idx AS idx | ||
RETURN expr[idx]; | ||
## Outcome: an Error should be raised at any time: InvalidArgumentType | ||
---- error | ||
Invalid argument type |
Oops, something went wrong.