@@ -1757,6 +1757,32 @@ TEST(cypher_exists_has_outgoing_calls) {
17571757 ASSERT_EQ (rc , 0 );
17581758 ASSERT_EQ (r .row_count , 2 );
17591759 cbm_cypher_result_free (& r );
1760+
1761+ rc = cbm_cypher_execute (s ,
1762+ "MATCH (a)-[:CALLS]->(b) WHERE b.name <> \"SubmitOrder\" "
1763+ "RETURN a.name, b.name" ,
1764+ "test" , 0 , & r );
1765+ ASSERT_EQ (rc , 0 );
1766+ ASSERT_EQ (r .row_count , 2 );
1767+ cbm_cypher_result_free (& r );
1768+
1769+ rc = cbm_cypher_execute (s ,
1770+ "MATCH (a)-[:CALLS]->(b) WHERE b.name = \"SubmitOrder\" OR "
1771+ "NOT b.name = \"SubmitOrder\" RETURN count(*)" ,
1772+ "test" , 0 , & r );
1773+ ASSERT_EQ (rc , 0 );
1774+ ASSERT_EQ (r .row_count , 1 );
1775+ ASSERT_STR_EQ (r .rows [0 ][0 ], "3" );
1776+ cbm_cypher_result_free (& r );
1777+
1778+ rc = cbm_cypher_execute (s ,
1779+ "MATCH (a)-[:CALLS]->(b) WITH a, b WHERE NOT b.name = "
1780+ "\"SubmitOrder\" RETURN a.name, b.name" ,
1781+ "test" , 0 , & r );
1782+ ASSERT_EQ (rc , 0 );
1783+ ASSERT_EQ (r .row_count , 2 );
1784+ cbm_cypher_result_free (& r );
1785+
17601786 cbm_store_close (s );
17611787 PASS ();
17621788}
@@ -3150,6 +3176,65 @@ TEST(cypher_exec_where_not) {
31503176 PASS ();
31513177}
31523178
3179+ TEST (cypher_exec_where_not_target_node ) {
3180+ cbm_store_t * s = setup_cypher_store ();
3181+ cbm_cypher_result_t r = {0 };
3182+ int rc = cbm_cypher_execute (s ,
3183+ "MATCH (a)-[:CALLS]->(b) WHERE NOT b.name = \"SubmitOrder\" "
3184+ "RETURN a.name, b.name" ,
3185+ "test" , 0 , & r );
3186+ ASSERT_EQ (rc , 0 );
3187+ ASSERT_EQ (r .row_count , 2 );
3188+ cbm_cypher_result_free (& r );
3189+ cbm_store_close (s );
3190+ PASS ();
3191+ }
3192+
3193+ TEST (cypher_exec_where_not_target_relationship ) {
3194+ cbm_store_t * s = setup_cypher_multi_edge_store ();
3195+ cbm_cypher_result_t r = {0 };
3196+ int rc = cbm_cypher_execute (s ,
3197+ "MATCH (a)-[r:HTTP_CALLS]->(b) WHERE NOT r.url_path = "
3198+ "\"/health\" RETURN r.url_path" ,
3199+ "testproj" , 0 , & r );
3200+ ASSERT_EQ (rc , 0 );
3201+ ASSERT_EQ (r .row_count , 1 );
3202+ ASSERT_STR_EQ (r .rows [0 ][0 ], "/api/orders" );
3203+ cbm_cypher_result_free (& r );
3204+ cbm_store_close (s );
3205+ PASS ();
3206+ }
3207+
3208+ TEST (cypher_exec_where_not_source_node ) {
3209+ cbm_store_t * s = setup_cypher_store ();
3210+ cbm_cypher_result_t r = {0 };
3211+ int rc = cbm_cypher_execute (s ,
3212+ "MATCH (a)-[:CALLS]->(b) WHERE NOT a.name = "
3213+ "\"HandleOrder\" RETURN a.name, b.name" ,
3214+ "test" , 0 , & r );
3215+ ASSERT_EQ (rc , 0 );
3216+ ASSERT_EQ (r .row_count , 1 );
3217+ ASSERT_STR_EQ (r .rows [0 ][0 ], "ValidateOrder" );
3218+ cbm_cypher_result_free (& r );
3219+ cbm_store_close (s );
3220+ PASS ();
3221+ }
3222+
3223+ TEST (cypher_exec_where_not_target_node_count ) {
3224+ cbm_store_t * s = setup_cypher_store ();
3225+ cbm_cypher_result_t r = {0 };
3226+ int rc = cbm_cypher_execute (s ,
3227+ "MATCH (a)-[:CALLS]->(b) WHERE NOT b.name = "
3228+ "\"SubmitOrder\" RETURN count(*)" ,
3229+ "test" , 0 , & r );
3230+ ASSERT_EQ (rc , 0 );
3231+ ASSERT_EQ (r .row_count , 1 );
3232+ ASSERT_STR_EQ (r .rows [0 ][0 ], "2" );
3233+ cbm_cypher_result_free (& r );
3234+ cbm_store_close (s );
3235+ PASS ();
3236+ }
3237+
31533238TEST (cypher_exec_where_in ) {
31543239 cbm_store_t * s = setup_cypher_store ();
31553240 cbm_cypher_result_t r = {0 };
@@ -5005,6 +5090,10 @@ SUITE(cypher) {
50055090 RUN_TEST (cypher_exec_where_neq_bang );
50065091 RUN_TEST (cypher_exec_where_ends_with );
50075092 RUN_TEST (cypher_exec_where_not );
5093+ RUN_TEST (cypher_exec_where_not_target_node );
5094+ RUN_TEST (cypher_exec_where_not_target_relationship );
5095+ RUN_TEST (cypher_exec_where_not_source_node );
5096+ RUN_TEST (cypher_exec_where_not_target_node_count );
50085097 RUN_TEST (cypher_exec_where_in );
50095098 RUN_TEST (cypher_exec_where_not_in );
50105099 RUN_TEST (cypher_exec_where_is_null );
0 commit comments