Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Nov 8, 2021
1 parent c5e51d2 commit 002cfc3
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 50 deletions.
12 changes: 6 additions & 6 deletions src/graph/visitor/test/FilterTransformTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) {
auto expr =
ltExpr(minusExpr(laExpr("v", "age"), constantExpr(1)), constantExpr(9223372036854775807));
auto res = ExpressionUtils::filterTransform(expr);
auto expected = Status::Error(
auto expected = Status::SemanticError(
"result of (9223372036854775807+1) cannot be represented as an "
"integer");
ASSERT(!res.status().ok());
Expand All @@ -39,7 +39,7 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) {
{
auto expr = ltExpr(addExpr(laExpr("v", "age"), constantExpr(1)), constantExpr(INT64_MIN));
auto res = ExpressionUtils::filterTransform(expr);
auto expected = Status::Error(
auto expected = Status::SemanticError(
"result of (-9223372036854775808-1) cannot be represented as an "
"integer");
ASSERT(!res.status().ok());
Expand All @@ -50,7 +50,7 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) {
auto expr = ltExpr(minusExpr(laExpr("v", "age"), constantExpr(1)),
addExpr(constantExpr(9223372036854775807), constantExpr(1)));
auto res = ExpressionUtils::filterTransform(expr);
auto expected = Status::Error(
auto expected = Status::SemanticError(
"result of (9223372036854775807+1) cannot be represented as an "
"integer");
ASSERT(!res.status().ok());
Expand All @@ -61,7 +61,7 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) {
auto expr = ltExpr(addExpr(laExpr("v", "age"), constantExpr(1)),
minusExpr(constantExpr(INT64_MIN), constantExpr(1)));
auto res = ExpressionUtils::filterTransform(expr);
auto expected = Status::Error(
auto expected = Status::SemanticError(
"result of (-9223372036854775808-1) cannot be represented as an "
"integer");
ASSERT(!res.status().ok());
Expand All @@ -72,7 +72,7 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) {
auto expr = notExpr(notExpr(notExpr(ltExpr(minusExpr(laExpr("v", "age"), constantExpr(1)),
constantExpr(9223372036854775807)))));
auto res = ExpressionUtils::filterTransform(expr);
auto expected = Status::Error(
auto expected = Status::SemanticError(
"result of (9223372036854775807+1) cannot be represented as an "
"integer");
ASSERT(!res.status().ok());
Expand All @@ -83,7 +83,7 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) {
auto expr = notExpr(notExpr(
notExpr(ltExpr(addExpr(laExpr("v", "age"), constantExpr(1)), constantExpr(INT64_MIN)))));
auto res = ExpressionUtils::filterTransform(expr);
auto expected = Status::Error(
auto expected = Status::SemanticError(
"result of (-9223372036854775808-1) cannot be represented as an "
"integer");
ASSERT(!res.status().ok());
Expand Down
12 changes: 6 additions & 6 deletions tests/tck/features/expression/Null.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ Feature: NULL related operations
| NULL | NULL | NULL | NULL | NULL |
When executing query:
"""
RETURN cos(NULL) AS value1, acos(NULL) AS value2, tan(NULL) AS value3, atan(NULL) AS value4, rand32(NULL) AS value5
RETURN cos(NULL) AS value1, acos(NULL) AS value2, tan(NULL) AS value3, atan(NULL) AS value4
"""
Then the result should be, in any order:
| value1 | value2 | value3 | value4 | value5 |
| NULL | NULL | NULL | NULL | BAD_TYPE |
| value1 | value2 | value3 | value4 |
| NULL | NULL | NULL | NULL |
When executing query:
"""
RETURN collect(NULL) AS value1, avg(NULL) AS value2, count(NULL) AS value3, max(NULL) AS value4, rand64(NULL,NULL) AS value5
RETURN collect(NULL) AS value1, avg(NULL) AS value2, count(NULL) AS value3, max(NULL) AS value4
"""
Then the result should be, in any order:
| value1 | value2 | value3 | value4 | value5 |
| [] | NULL | 0 | NULL | BAD_TYPE |
| value1 | value2 | value3 | value4 |
| [] | NULL | 0 | NULL |
When executing query:
"""
RETURN min(NULL) AS value1, std(NULL) AS value2, sum(NULL) AS value3, bit_and(NULL) AS value4, bit_or(NULL,NULL) AS value5
Expand Down
8 changes: 2 additions & 6 deletions tests/tck/features/expression/StartsWith.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ Feature: Starts With Expression
"""
YIELD 123 STARTS WITH 1
"""
Then the result should be, in any order:
| (123 STARTS WITH 1) |
| BAD_TYPE |
Then a SemanticError should be raised at runtime: Type error `(123 STARTS WITH 1)'
Scenario: yield not starts with
When executing query:
Expand Down Expand Up @@ -90,9 +88,7 @@ Feature: Starts With Expression
"""
YIELD 123 NOT STARTS WITH 1
"""
Then the result should be, in any order:
| (123 NOT STARTS WITH 1) |
| BAD_TYPE |
Then a SemanticError should be raised at runtime: Type error `(123 NOT STARTS WITH 1)'
Scenario: starts with go
When executing query:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Feature: Mathematical function Expression
"""
return [bit_and(5,true),bit_or(2,1.3),bit_xor("5",1)] as error_test
"""
Then a SemanticError should be raised at runtime: Type error Type error `bit_and(5,true)'
Then a SemanticError should be raised at runtime: Type error `bit_and(5,true)'
45 changes: 27 additions & 18 deletions tests/tck/features/expression/function/TypeConversion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,72 +9,81 @@ Feature: TypeConversion Expression
Scenario: toBoolean
When executing query:
"""
YIELD [toBoolean(true), toBoolean(false), toBoolean(1), toBoolean(3.14),
YIELD [toBoolean(true), toBoolean(false),
toBoolean("trUe"), toBoolean("3.14"), toBoolean(null)] AS yield_toBoolean
"""
Then the result should be, in any order:
| yield_toBoolean |
| [true, false, BAD_TYPE, BAD_TYPE, true, NULL, NULL] |
| yield_toBoolean |
| [true, false, true, NULL, NULL] |
When executing query:
"""
UNWIND [true, false, 1, 3.14, "trUe", "3.14", null] AS b
UNWIND [true, false, "trUe", "3.14", null] AS b
RETURN toBoolean(b) AS unwind_toBoolean
"""
Then the result should be, in any order:
| unwind_toBoolean |
| true |
| false |
| BAD_TYPE |
| BAD_TYPE |
| true |
| NULL |
| NULL |
When executing query:
"""
YIELD [toBoolean(1), toBoolean(3.14)] AS yield_toBoolean
"""
Then a SemanticError should be raised at runtime: Type error `toBoolean(1)'
Scenario: toFloat
When executing query:
"""
YIELD [toFloat(true), toFloat(false), toFloat(1), toFloat(3.14),
YIELD [toFloat(1), toFloat(3.14),
toFloat("trUe"), toFloat("3.14"), toFloat(null)] AS yield_toFloat
"""
Then the result should be, in any order:
| yield_toFloat |
| [BAD_TYPE, BAD_TYPE, 1.0, 3.14, NULL, 3.14, NULL] |
| yield_toFloat |
| [1.0, 3.14, NULL, 3.14, NULL] |
When executing query:
"""
UNWIND [true, false, 1, 3.14, "trUe", "3.14", null] AS b
UNWIND [1, 3.14, "trUe", "3.14", null] AS b
RETURN toFloat(b) AS unwind_toFloat
"""
Then the result should be, in any order:
| unwind_toFloat |
| BAD_TYPE |
| BAD_TYPE |
| 1.0 |
| 3.14 |
| NULL |
| 3.14 |
| NULL |
When executing query:
"""
YIELD [toFloat(true), toFloat(false)] AS yield_toFloat
"""
Then a SemanticError should be raised at runtime: Type error `toFloat(true)'

Scenario: toInteger
When executing query:
"""
YIELD [toInteger(true), toInteger(false), toInteger(1), toInteger(3.14),
YIELD [toInteger(1), toInteger(3.14),
toInteger("trUe"), toInteger("3.14"), toInteger(null), toInteger("1e3"),
toInteger("1E3"), toInteger("1.5E4")] AS yield_toInteger
"""
Then the result should be, in any order:
| yield_toInteger |
| [BAD_TYPE, BAD_TYPE, 1, 3, NULL, 3, NULL, 1000, 1000, 15000] |
| yield_toInteger |
| [1, 3, NULL, 3, NULL, 1000, 1000, 15000] |
When executing query:
"""
UNWIND [true, false, 1, 3.14, "trUe", "3.14", null] AS b
UNWIND [1, 3.14, "trUe", "3.14", null] AS b
RETURN toInteger(b) AS unwind_toInteger
"""
Then the result should be, in any order:
| unwind_toInteger |
| BAD_TYPE |
| BAD_TYPE |
| 1 |
| 3 |
| NULL |
| 3 |
| NULL |
When executing query:
"""
YIELD [toInteger(true), toInteger(false)] AS yield_toInteger
"""
Then a SemanticError should be raised at runtime: Type error `toInteger(true)'
4 changes: 2 additions & 2 deletions tests/tck/features/lookup/ByIndex.feature
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ Feature: Lookup by index itself
"""
LOOKUP ON player WHERE player.age > 9223372036854775807+1
"""
Then a ExecutionError should be raised at runtime: result of (9223372036854775807+1) cannot be represented as an integer
Then a SemanticError should be raised at runtime: result of (9223372036854775807+1) cannot be represented as an integer
When executing query:
"""
LOOKUP ON player WHERE player.age > -9223372036854775808-1
"""
Then a ExecutionError should be raised at runtime: result of (-9223372036854775808-1) cannot be represented as an integer
Then a SemanticError should be raised at runtime: result of (-9223372036854775808-1) cannot be represented as an integer

Scenario: [2] edge index
Given a graph with space named "nba"
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/lookup/ByIndex.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ Feature: Lookup by index itself in integer vid
"""
LOOKUP ON player WHERE player.age > 9223372036854775807+1
"""
Then a ExecutionError should be raised at runtime: result of (9223372036854775807+1) cannot be represented as an integer
Then a SemanticError should be raised at runtime: result of (9223372036854775807+1) cannot be represented as an integer
When executing query:
"""
LOOKUP ON player WHERE player.age > -9223372036854775808-1
"""
Then a ExecutionError should be raised at runtime: result of (-9223372036854775808-1) cannot be represented as an integer
Then a SemanticError should be raised at runtime: result of (-9223372036854775808-1) cannot be represented as an integer

Scenario: [2] edge index
Given a graph with space named "nba_int_vid"
Expand Down
9 changes: 3 additions & 6 deletions tests/tck/features/match/Base.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,9 @@ Feature: Basic match
match (v:player)-[e:like{likeness:4*20+5}]->() return e
"""
Then the result should be, in any order, with relax comparison:
| e |
| [:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}] |
| [:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}] |
| [:like "Paul George"->"Russell Westbrook" @0 {likeness: 95}] |
| [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}] |
| [:like "Tony Parker"->"Tim Duncan" @0 {likeness: 95}] |
| e |
| [:like "Jason Kidd"->"Dirk Nowitzki"@0{likeness:85}] |
| [:like "Steve Nash"->"Jason Kidd"@0{likeness:85}] |
When executing query:
"""
match (v:player)-[e:like{likeness:"99"}]->() return e
Expand Down
3 changes: 1 addition & 2 deletions tests/tck/features/match/Base.feature
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,7 @@ Feature: Basic match
"""
match (v:player{age:"24"-1}) return v
"""
Then the result should be, in any order, with relax comparison:
| v |
Then a SemanticError should be raised at runtime: Type error `("24"-1)'
Scenario: No return
When executing query:
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/yield/yield.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Feature: Yield Sentence
"""
YIELD --9223372036854775808
"""
Then a ExecutionError should be raised at runtime: result of -(-9223372036854775808) cannot be represented as an integer
Then a SemanticError should be raised at runtime: result of -(-9223372036854775808) cannot be represented as an integer
When executing query:
"""
YIELD -9223372036854775809
Expand Down

0 comments on commit 002cfc3

Please sign in to comment.