Skip to content

Commit

Permalink
Organize exceptions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rfdavid committed Jun 5, 2023
1 parent f8c2cdc commit dd0be51
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 88 deletions.
1 change: 0 additions & 1 deletion test/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ add_kuzu_test(main_test
config_test.cpp
connection_test.cpp
csv_output_test.cpp
exception_test.cpp
prepare_test.cpp
result_value_test.cpp
storage_driver_test.cpp)
52 changes: 0 additions & 52 deletions test/main/exception_test.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Binder exception: Variable a is not in scope.
---- error
Binder exception: Variable foo is not in scope.

-CASE BindVariableNotInScope3
-QUERY MATCH (a:person) RETURN b
---- error
Binder exception: Variable b is not in scope.

-CASE BindPropertyLookUpOnExpression
-QUERY MATCH (a:person)-[e1:knows]->(b:person) RETURN (a.age + 2).age
Expand Down Expand Up @@ -156,11 +160,6 @@ Binder exception: Cannot match a built-in function for given function +(TIMESTAM
(TIMESTAMP,INTERVAL) -> TIMESTAMP
(INTERVAL,TIMESTAMP) -> TIMESTAMP

-CASE BindNonExistingFunction
-QUERY MATCH (a:person) WHERE dummy() < 2 RETURN COUNT(*)
---- error
Catalog exception: DUMMY function does not exist.


-CASE BindFunctionWithWrongNumParams
-QUERY MATCH (a:person) WHERE date() < 2 RETURN COUNT(*);
Expand Down Expand Up @@ -270,12 +269,6 @@ Binder exception: Node person already exists.
Binder exception: Primary key dummyColName does not match any of the predefined node properties.


-CASE CreateNodeTableInvalidDataType
-QUERY CREATE NODE TABLE PERSON(NAME BIGINT, PRIMARY KEY(NAME))
---- error
Cannot parse dataTypeID: BIGINT


-CASE CreateNodeTableDuplicatedColumnName
-QUERY CREATE NODE TABLE student (id INT64, eyesight double, eyesight double, PRIMARY KEY(id))
---- error
Expand Down Expand Up @@ -312,18 +305,6 @@ Binder exception: Rel knows already exists.
Binder exception: Node table post does not exist.


-CASE CreateRelTableInvalidRelMultiplicity
-QUERY CREATE REL TABLE knows_post ( FROM person TO person, MANY_LOT)
---- error
Catalog exception: Invalid relMultiplicity string 'MANY_LOT'.


-CASE CreateRelTableInvalidDataType
-QUERY CREATE REL TABLE knows_post ( FROM person TO person, ID SMALLINT, MANY_MANY)
---- error
Cannot parse dataTypeID: SMALLINT


-CASE CreateRelTableDuplicatedColumnName
-QUERY CREATE REL TABLE teaches (FROM person TO person, date DATE, date TIMESTAMP)
---- error
Expand Down Expand Up @@ -471,18 +452,6 @@ Binder exception: The number of elements in a fixed list must be greater than 0.
Binder exception: Cannot store a fixed list of size 4096 in a page.


-CASE MissingStructFieldType
-QUERY create node table test1(ID INT64, description STRUCT(name INT64, age INT35), PRIMARY KEY(ID))
---- error
Cannot parse dataTypeID: INT35


-CASE MissingStructFields
-QUERY create node table test1(ID INT64, description STRUCT, PRIMARY KEY(ID))
---- error
Cannot parse struct type: STRUCT


-CASE NonPKSerialType
-QUERY CREATE NODE TABLE test(ID INT64, seq SERIAL, PRIMARY KEY(ID))
---- error
Expand All @@ -499,3 +468,21 @@ Binder exception: Serial property in node table must be the primary key.
-QUERY CREATE REL TABLE test(FROM person TO person, seq SERIAL)
---- error
Binder exception: Serial property is not supported in rel table.

-CASE MatchBuildIn
-QUERY MATCH (a:person) RETURN a.age + 'hh'
---- error
Binder exception: Cannot match a built-in function for given function +(INT64,STRING). Supported inputs are
(INT64,INT64) -> INT64
(INT32,INT32) -> INT32
(INT16,INT16) -> INT16
(DOUBLE,DOUBLE) -> DOUBLE
(FLOAT,FLOAT) -> FLOAT
(SERIAL,SERIAL) -> SERIAL
(INTERVAL,INTERVAL) -> INTERVAL
(DATE,INT64) -> DATE
(INT64,DATE) -> DATE
(DATE,INTERVAL) -> DATE
(INTERVAL,DATE) -> DATE
(TIMESTAMP,INTERVAL) -> TIMESTAMP
(INTERVAL,TIMESTAMP) -> TIMESTAMP
21 changes: 21 additions & 0 deletions test/test_files/exceptions/catalog/catalog.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-GROUP CatalogErrorTest
-DATASET tinysnb

--

-QUERY MATCH (a:person) RETURN dummy(n)
---- error
Catalog exception: DUMMY function does not exist.


-CASE BindNonExistingFunction
-QUERY MATCH (a:person) WHERE dummy() < 2 RETURN COUNT(*)
---- error
Catalog exception: DUMMY function does not exist.


-CASE CreateRelTableInvalidRelMultiplicity
-QUERY CREATE REL TABLE knows_post ( FROM person TO person, MANY_LOT)
---- error
Catalog exception: Invalid relMultiplicity string 'MANY_LOT'.

27 changes: 27 additions & 0 deletions test/test_files/exceptions/parser/parse_type.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-GROUP SyntaxErrorTest
-DATASET dummy

--

-CASE MissingStructFieldType
-QUERY create node table test1(ID INT64, description STRUCT(name INT64, age INT35), PRIMARY KEY(ID))
---- error
Cannot parse dataTypeID: INT35


-CASE MissingStructFields
-QUERY create node table test1(ID INT64, description STRUCT, PRIMARY KEY(ID))
---- error
Cannot parse struct type: STRUCT


-CASE CreateNodeTableInvalidDataType
-QUERY CREATE NODE TABLE PERSON(NAME BIGINT, PRIMARY KEY(NAME))
---- error
Cannot parse dataTypeID: BIGINT


-CASE CreateRelTableInvalidDataType
-QUERY CREATE REL TABLE knows_post ( FROM person TO person, ID SMALLINT, MANY_MANY)
---- error
Cannot parse dataTypeID: SMALLINT
File renamed without changes.

0 comments on commit dd0be51

Please sign in to comment.