Skip to content

Commit

Permalink
update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
alyaa999 committed Jun 15, 2024
1 parent 8da8e4a commit b819164
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
16 changes: 1 addition & 15 deletions dbms/src/test/java/org/polypheny/db/cypher/AggregateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,6 @@ assert containsRows( res, true, false,

}

@Test
public void countFieldRenameFieldAggregateTest() {
execute( SINGLE_NODE_PERSON_1 );
execute( SINGLE_NODE_PERSON_2);

GraphResult res = execute( "MATCH (n) RETURN n.name, count(n.age) AS c" );


assert containsRows(res, true, false,
Row.of(TestLiteral.from("Hans") , TestLiteral.from( 0 )),
Row.of( TestLiteral.from( "Max"), TestLiteral.from( 1 ) ));

}


@Test
public void doubleCountRenameAggregateTest() {
Expand Down Expand Up @@ -178,7 +164,7 @@ public void singleAvgAggregateTest() {
String[][] data = res.getData();
System.out.println( Arrays.deepToString(data));
assert containsRows( res, true, false,
Row.of( TestLiteral.from( 26.333333333333333333333333333333 ) ) );
Row.of( TestLiteral.from( 26.33333333333333 ) ) );

}

Expand Down
40 changes: 36 additions & 4 deletions dbms/src/test/java/org/polypheny/db/cypher/DmlDeleteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,61 @@ assert containsRows( res, true, false,

@Test
public void relationshipWithPropertiesDeleteTest() {
execute( SINGLE_EDGE_2 );
execute( "MATCH (p:Person) -[rel:OWNER_OF]->(A:Animal) \n"
+ "DELETE rel" );

GraphResult res = execute( "MATCH (p:Person) -[rel:OWNER_OF]->(A:Animal)");
assertEmpty( res );

}


@Test
public void pathDeleteTest()
{
execute( "MATCH (p:Person {name: 'Alice'})-[r:WORKS_AT]->(c:Company {name: 'TechCorp'})\n"
+ "DELETE r, p\n" );

execute( SINGLE_EDGE_1 );

execute( "MATCH p = (person:Person {name: 'Max'})-[rel:OWNER_OF]->( animal :Animal {name: 'Kira'})\n"
+ "DELETE p\n" );

GraphResult res = matchAndReturnAllNodes() ;
GraphResult edges = execute( "MATCH (p:Person) -[rel:OWNER_OF]->(A:Animal)");
assert res.getData().length == 0 && edges.getData().length == 0 ;


}

@Test
public void NodeWithRelationshipsDeleteTest()
public void NodeWithAllRelationshipsDeleteTest()
{
execute( "MATCH (n:Person {name: 'Carrie-Anne Moss'})\n"
execute( SINGLE_EDGE_2 );
execute( "MATCH (n:Person {name: 'MAX'})\n"
+ "DETACH DELETE n" );


GraphResult res = execute( "MATCH (p:Person) -[rel:OWNER_OF]->(A:Animal)");
assert res.getData().length == 0 ;

}
@Test
public void allNodesAndRelationshipsDeleteTest ()
{
execute( SINGLE_NODE_PERSON_1 );
execute( SINGLE_NODE_PERSON_2 );
execute( SINGLE_EDGE_1 );
execute( "MATCH (n)\n"
+ "DETACH DELETE n" ) ;


GraphResult res = matchAndReturnAllNodes() ;
GraphResult edges = execute( "MATCH (p:Person) -[rel:OWNER_OF]->(A:Animal)");
assert res.getData().length == 0 && edges.getData().length == 0 ;

}




}

0 comments on commit b819164

Please sign in to comment.