Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Sep 26, 2021
1 parent 570d5f4 commit e2d5779
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 10 deletions.
1 change: 0 additions & 1 deletion tests/tck/features/delete/DeleteEdge.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
@jmq
Feature: Delete int vid of edge

Scenario: delete edges
Expand Down
69 changes: 65 additions & 4 deletions tests/tck/features/fetch/FetchEdges.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,23 @@ Feature: Fetch Int Vid Edges
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |

Scenario: Fetch prop Semantic Error
Scenario: Fetch prop Error
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD $^.serve.start_year
"""
Then a SemanticError should be raised at runtime:
Then a ExecutionError should be raised at runtime:
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD $$.serve.start_year
"""
Then a SemanticError should be raised at runtime:
Then a ExecutionError should be raised at runtime:
# yield not existing edgetype
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD abc.start_year
"""
Then a SemanticError should be raised at runtime:
Then a ExecutionError should be raised at runtime:
# Fetch prop returns not existing property
When executing query:
"""
Expand Down Expand Up @@ -246,3 +246,64 @@ Feature: Fetch Int Vid Edges
Then the result should be, in any order, and the columns 0,1,3,4 should be hashed:
| serve._src | serve._dst | serve._rank | serve._src | serve._dst | serve._rank |
| "Boris Diaw" | "Spurs" | 0 | "Boris Diaw" | "Spurs" | 0 |

Scenario: yield edge
When executing query:
"""
FETCH PROP ON serve hash('Boris Diaw') -> hash('Hawks') YIELD serve.start_year, serve.end_year, edge as relationship
"""
Then the result should be, in any order, and the columns 0, 1 should be hashed:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year | relationship |
| "Boris Diaw" | "Hawks" | 0 | 2003 | 2005 | [:serve hash("Boris Diaw")->hash("Hawks") @0 {end_year: 2005, start_year: 2003}] |
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD edge as relationship, src(edge) as src_edge, dst(edge) as dst_edge, type(edge) as type, rank(edge) as rank
"""
Then the result should be, in any order, and the columns 0, 1, 4, 5 should be hashed:
| serve._src | serve._dst | serve._rank | relationship | src_edge | dst_edge | type | rank |
| "Boris Diaw" | "Spurs" | 0 | [:serve hash("Boris Diaw")->hash("Spurs") @0 {end_year: 2016, start_year: 2012}] | "Boris Diaw" | "Spurs" | "serve" | 0 |
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Not Exist") YIELD src(edge) as a
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | a |
When executing query:
"""
FETCH PROP ON like hash("Tony Parker")->hash("Tim Duncan"), hash("Grant Hill") -> hash("Tracy McGrady") YIELD edge as relationship |
YIELD properties($-.relationship)
"""
Then the result should be, in any order:
| properties($-.relationship) |
| {likeness: 95} |
| {likeness: 90} |
When executing query:
"""
FETCH PROP ON like hash("Tony Parker")->hash("Tim Duncan"), hash("Grant Hill") -> hash("Tracy McGrady") YIELD edge as relationship |
YIELD startNode($-.relationship) AS node
"""
Then the result should be, in any order, with relax comparison:
| node |
| ("Tony Parker") |
| ("Grant Hill") |
When executing query:
"""
FETCH PROP ON like hash("Tony Parker")->hash("Tim Duncan"), hash("Grant Hill") -> hash("Tracy McGrady") YIELD edge as relationship |
YIELD endNode($-.relationship) AS node
"""
Then the result should be, in any order, with relax comparison:
| node |
| ("Tim Duncan") |
| ("Tracy McGrady") |
When executing query:
"""
$var = GO FROM hash('Boris Diaw'),hash('Boris Diaw') OVER serve YIELD serve._src AS src, serve._dst AS dst;
FETCH PROP ON serve $var.src->$var.dst YIELD DISTINCT serve.start_year, serve.end_year, edge as relationship
"""
Then the result should be, in any order, and the columns 0, 1 should be hashed:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year | relationship |
| "Boris Diaw" | "Suns" | 0 | 2005 | 2008 | [:serve hash("Boris Diaw")->hash("Suns") @0 {end_year: 2008, start_year: 2005}] |
| "Boris Diaw" | "Hawks" | 0 | 2003 | 2005 | [:serve hash("Boris Diaw")->hash("Hawks") @0 {end_year: 2005, start_year: 2003}] |
| "Boris Diaw" | "Spurs" | 0 | 2012 | 2016 | [:serve hash("Boris Diaw")->hash("Spurs") @0 {end_year: 2016, start_year: 2012}] |
| "Boris Diaw" | "Hornets" | 0 | 2008 | 2012 | [:serve hash("Boris Diaw")->hash("Hornets") @0 {end_year: 2012, start_year: 2008}] |
| "Boris Diaw" | "Jazz" | 0 | 2016 | 2017 | [:serve hash("Boris Diaw")->hash("Jazz") @0 {end_year: 2017, start_year: 2016}] |
70 changes: 65 additions & 5 deletions tests/tck/features/fetch/FetchEdges.strVid.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@jmq
Feature: Fetch String Vid Edges

Background:
Expand Down Expand Up @@ -228,22 +227,22 @@ Feature: Fetch String Vid Edges
| ("Tim Duncan") |
| ("Tracy McGrady") |

Scenario: Fetch prop Semantic Error
Scenario: Fetch prop Error
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD $^.serve.start_year
"""
Then a SemanticError should be raised at runtime:
Then a ExecutionError should be raised at runtime:
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD $$.serve.start_year
"""
Then a SemanticError should be raised at runtime:
Then a ExecutionError should be raised at runtime:
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD abc.start_year
"""
Then a SemanticError should be raised at runtime:
Then a ExecutionError should be raised at runtime:
# Fetch prop on illegal input
When executing query:
"""
Expand All @@ -257,3 +256,64 @@ Feature: Fetch String Vid Edges
FETCH PROP ON serve 'Boris Diaw'->'Hawks' YIELD serve.not_exist_prop
"""
Then a SemanticError should be raised at runtime:

Scenario: yield edge
When executing query:
"""
FETCH PROP ON serve 'Boris Diaw' -> 'Hawks' YIELD serve.start_year, serve.end_year, edge as relationship
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year | relationship |
| "Boris Diaw" | "Hawks" | 0 | 2003 | 2005 | [:serve "Boris Diaw"->"Hawks" @0 {end_year: 2005, start_year: 2003}] |
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD edge as relationship, src(edge) as src_edge, dst(edge) as dst_edge, type(edge) as type, rank(edge) as rank
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | relationship | src_edge | dst_edge | type | rank |
| "Boris Diaw" | "Spurs" | 0 | [:serve "Boris Diaw"->"Spurs" @0 {end_year: 2016, start_year: 2012}] | "Boris Diaw" | "Spurs" | "serve" | 0 |
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Not Exist" YIELD src(edge) as a
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | a |
When executing query:
"""
FETCH PROP ON like "Tony Parker"->"Tim Duncan", "Grant Hill" -> "Tracy McGrady" YIELD edge as relationship |
YIELD properties($-.relationship)
"""
Then the result should be, in any order:
| properties($-.relationship) |
| {likeness: 95} |
| {likeness: 90} |
When executing query:
"""
FETCH PROP ON like "Tony Parker"->"Tim Duncan", "Grant Hill" -> "Tracy McGrady" YIELD edge as relationship |
YIELD startNode($-.relationship) AS node
"""
Then the result should be, in any order, with relax comparison:
| node |
| ("Tony Parker") |
| ("Grant Hill") |
When executing query:
"""
FETCH PROP ON like "Tony Parker"->"Tim Duncan", "Grant Hill" -> "Tracy McGrady" YIELD edge as relationship |
YIELD endNode($-.relationship) AS node
"""
Then the result should be, in any order, with relax comparison:
| node |
| ("Tim Duncan") |
| ("Tracy McGrady") |
When executing query:
"""
$var = GO FROM 'Boris Diaw','Boris Diaw' OVER serve YIELD serve._src AS src, serve._dst AS dst;
FETCH PROP ON serve $var.src->$var.dst YIELD DISTINCT serve.start_year, serve.end_year, edge as relationship
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year | relationship |
| "Boris Diaw" | "Suns" | 0 | 2005 | 2008 | [:serve "Boris Diaw"->"Suns" @0 {end_year: 2008, start_year: 2005}] |
| "Boris Diaw" | "Hawks" | 0 | 2003 | 2005 | [:serve "Boris Diaw"->"Hawks" @0 {end_year: 2005, start_year: 2003}] |
| "Boris Diaw" | "Spurs" | 0 | 2012 | 2016 | [:serve "Boris Diaw"->"Spurs" @0 {end_year: 2016, start_year: 2012}] |
| "Boris Diaw" | "Hornets" | 0 | 2008 | 2012 | [:serve "Boris Diaw"->"Hornets" @0 {end_year: 2012, start_year: 2008}] |
| "Boris Diaw" | "Jazz" | 0 | 2016 | 2017 | [:serve "Boris Diaw"->"Jazz" @0 {end_year: 2017, start_year: 2016}] |

0 comments on commit e2d5779

Please sign in to comment.