Skip to content

Commit

Permalink
Add chinses char tests
Browse files Browse the repository at this point in the history
Add more tests

Add mero delete edge tests
  • Loading branch information
Aiee committed Jan 17, 2023
1 parent c814148 commit d423964
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
72 changes: 72 additions & 0 deletions tests/tck/features/delete/DeleteEdge.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,78 @@ Feature: Delete int vid of edge
| "Zhangsan" | 50 | "Jack" |
Then drop the used space

Scenario: delete edges delete the edge with rank 0 by default
Given an empty graph
And create a space with following options:
| partition_num | 1 |
| replica_factor | 1 |
| vid_type | int |
And having executed:
"""
CREATE TAG IF NOT EXISTS person(name string, age int);
CREATE EDGE IF NOT EXISTS friend(intimacy int);
"""
And having executed:
"""
INSERT VERTEX
person(name, age)
VALUES
hash("Zhangsan"):("Zhangsan", 22),
hash("Lisi"):("Lisi", 23);
INSERT EDGE
friend(intimacy)
VALUES
hash("Zhangsan")->hash("Lisi"):(1),
hash("Zhangsan")->hash("Lisi")@15:(2),
hash("Zhangsan")->hash("Lisi")@25:(3),
hash("Zhangsan")->hash("Lisi")@35:(4);
"""
# before delete get result by go
When executing query:
"""
GO FROM hash("Zhangsan") OVER friend
YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._rank | friend._dst |
| "Zhangsan" | 1 | 0 | hash("Lisi") |
| "Zhangsan" | 2 | 15 | hash("Lisi") |
| "Zhangsan" | 3 | 25 | hash("Lisi") |
| "Zhangsan" | 4 | 35 | hash("Lisi") |
# delete edge friend, by default only the edge with rank of 0 will be deleted
When executing query:
"""
DELETE EDGE friend hash("Zhangsan")->hash("Lisi");
"""
Then the execution should be successful
# check result
When executing query:
"""
GO FROM hash("Zhangsan") OVER friend
YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._rank | friend._dst |
| "Zhangsan" | 2 | 15 | hash("Lisi") |
| "Zhangsan" | 3 | 25 | hash("Lisi") |
| "Zhangsan" | 4 | 35 | hash("Lisi") |
# delete all edges with different ranks
When executing query:
"""
GO FROM hash("Zhangsan") OVER friend YIELD id($^) AS src, friend._rank AS rank, friend._dst AS dst
| DELETE EDGE friend $-.src -> $-.dst @ $-.rank;
"""
Then the execution should be successful
# check result
When executing query:
"""
GO FROM hash("Zhangsan") OVER friend
YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._rank | friend._dst |
Then drop the used space

Scenario: delete edges use pipe
Given load "nba_int_vid" csv data to a new space
# test delete with pipe wrong vid type
Expand Down
72 changes: 72 additions & 0 deletions tests/tck/features/delete/DeleteEdge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,78 @@ Feature: Delete string vid of edge
| "Zhangsan" | 50 | "Jack" |
Then drop the used space

Scenario: delete edges delete the edge with rank 0 by default
Given an empty graph
And create a space with following options:
| partition_num | 1 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(20) |
And having executed:
"""
CREATE TAG IF NOT EXISTS person(name string, age int);
CREATE EDGE IF NOT EXISTS friend(intimacy int);
"""
And having executed:
"""
INSERT VERTEX
person(name, age)
VALUES
"Zhangsan":("Zhangsan", 22),
"Lisi":("Lisi", 23);
INSERT EDGE
friend(intimacy)
VALUES
"Zhangsan"->"Lisi":(1),
"Zhangsan"->"Lisi"@15:(2),
"Zhangsan"->"Lisi"@25:(3),
"Zhangsan"->"Lisi"@35:(4);
"""
# before delete get result by go
When executing query:
"""
GO FROM "Zhangsan" OVER friend
YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._rank | friend._dst |
| "Zhangsan" | 1 | 0 | "Lisi" |
| "Zhangsan" | 2 | 15 | "Lisi" |
| "Zhangsan" | 3 | 25 | "Lisi" |
| "Zhangsan" | 4 | 35 | "Lisi" |
# delete edge friend, by default only the edge with rank of 0 will be deleted
When executing query:
"""
DELETE EDGE friend "Zhangsan"->"Lisi";
"""
Then the execution should be successful
# check result
When executing query:
"""
GO FROM "Zhangsan" OVER friend
YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._rank | friend._dst |
| "Zhangsan" | 2 | 15 | "Lisi" |
| "Zhangsan" | 3 | 25 | "Lisi" |
| "Zhangsan" | 4 | 35 | "Lisi" |
# delete all edges with different ranks
When executing query:
"""
GO FROM "Zhangsan" OVER friend YIELD id($^) AS src, friend._rank AS rank, friend._dst AS dst
| DELETE EDGE friend $-.src -> $-.dst @ $-.rank;
"""
Then the execution should be successful
# check result
When executing query:
"""
GO FROM "Zhangsan" OVER friend
YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._rank | friend._dst |
Then drop the used space

Scenario: delete edges use pipe
Given load "nba" csv data to a new space
# test delete with pipe wrong vid type
Expand Down
12 changes: 12 additions & 0 deletions tests/tck/features/insert/Insert.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -614,3 +614,15 @@ Feature: Insert int vid of vertex and edge
| src | dst |
| 300 | 400 |
Then drop the used space

Scenario: insert vertex with non existent tag
Given an empty graph
And create a space with following options:
| partition_num | 1 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(10) |
When try to execute query:
"""
INSERT VERTEX invalid_vertex VALUES "non_existed_tag":()
"""
Then a SemanticError should be raised at runtime: No schema found
29 changes: 29 additions & 0 deletions tests/tck/features/insert/Insert.feature
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,22 @@ Feature: Insert string vid of vertex and edge
Then the result should be, in any order, with relax comparison:
| node |
| ('English') |
# insert Chinese character
# if the Chinese character is out of the fixed_string's size, it will be truncated,
# and no invalid char should be inserted
When executing query:
"""
INSERT VERTEX course(name) VALUES "Chinese":("中文字符")
"""
Then the execution should be successful
# check result
When executing query:
"""
FETCH PROP ON course "Chinese" YIELD vertex as node
"""
Then the result should be, in any order, with relax comparison:
| node |
| ('Chinese') |
# check result
When executing query:
"""
Expand All @@ -551,6 +567,7 @@ Feature: Insert string vid of vertex and edge
| course.name | course.introduce |
| 'Engli' | NULL |
| 'Math' | NULL |
| '中' | NULL |
When executing query:
"""
LOOKUP ON student YIELD student.name, student.age
Expand Down Expand Up @@ -658,3 +675,15 @@ Feature: Insert string vid of vertex and edge
"""
Then a ExecutionError should be raised at runtime: Storage Error: The VID must be a 64-bit integer or a string fitting space vertex id length limit.
Then drop the used space

Scenario: insert vertex with non existent tag
Given an empty graph
And create a space with following options:
| partition_num | 1 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(10) |
When try to execute query:
"""
INSERT VERTEX invalid_vertex VALUES "non_existed_tag":()
"""
Then a SemanticError should be raised at runtime: No schema found

0 comments on commit d423964

Please sign in to comment.