@@ -1035,8 +1035,8 @@ TEST(cypher_bare_edge_return_exposes_properties_json) {
10351035 cbm_store_t * s = setup_cypher_multi_edge_store ();
10361036 cbm_cypher_result_t r = {0 };
10371037
1038- int rc = cbm_cypher_execute (
1039- s , "MATCH (a)-[r:HTTP_CALLS]->(b) WHERE r.method = 'POST' RETURN r" , "testproj" , 0 , & r );
1038+ int rc = cbm_cypher_execute (s , "MATCH (a)-[r:HTTP_CALLS]->(b) WHERE r.method = 'POST' RETURN r" ,
1039+ "testproj" , 0 , & r );
10401040 ASSERT_EQ (rc , 0 );
10411041 ASSERT_EQ (r .row_count , 1 );
10421042 const char * r_val = cypher_get_col (& r , 0 , "r" );
@@ -2106,6 +2106,62 @@ TEST(cypher_parse_unwind_var) {
21062106 PASS ();
21072107}
21082108
2109+ /* ── Issue #389 group: Cypher feature reproductions ─────────────────
2110+ * Each asserts the CORRECT behavior; a failure reproduces the bug. */
2111+
2112+ /* #240: labels() function */
2113+ TEST (cypher_issue240_labels_function ) {
2114+ cbm_store_t * s = setup_cypher_store ();
2115+ cbm_cypher_result_t r = {0 };
2116+ int rc = cbm_cypher_execute (s , "MATCH (n:Module) RETURN labels(n) AS lbl" , "test" , 0 , & r );
2117+ ASSERT_EQ (rc , 0 );
2118+ ASSERT_NULL (r .error );
2119+ ASSERT_EQ (r .row_count , 1 );
2120+ cbm_cypher_result_free (& r );
2121+ cbm_store_close (s );
2122+ PASS ();
2123+ }
2124+
2125+ /* #237: DISTINCT applied before ORDER BY + LIMIT */
2126+ TEST (cypher_issue237_distinct_order_limit ) {
2127+ cbm_store_t * s = setup_cypher_store ();
2128+ cbm_cypher_result_t r = {0 };
2129+ int rc = cbm_cypher_execute (
2130+ s , "MATCH (f:Function) RETURN DISTINCT f.label AS l ORDER BY l LIMIT 10" , "test" , 0 , & r );
2131+ ASSERT_EQ (rc , 0 );
2132+ ASSERT_NULL (r .error );
2133+ ASSERT_EQ (r .row_count , 1 );
2134+ cbm_cypher_result_free (& r );
2135+ cbm_store_close (s );
2136+ PASS ();
2137+ }
2138+
2139+ /* #252: toInteger() */
2140+ TEST (cypher_issue252_tointeger ) {
2141+ cbm_store_t * s = setup_cypher_store ();
2142+ cbm_cypher_result_t r = {0 };
2143+ int rc = cbm_cypher_execute (s , "MATCH (f:Function) RETURN toInteger(f.start_line) AS ln" ,
2144+ "test" , 0 , & r );
2145+ ASSERT_EQ (rc , 0 );
2146+ ASSERT_NULL (r .error );
2147+ cbm_cypher_result_free (& r );
2148+ cbm_store_close (s );
2149+ PASS ();
2150+ }
2151+
2152+ /* #305: count(*) + AS alias */
2153+ TEST (cypher_issue305_count_star_alias ) {
2154+ cbm_store_t * s = setup_cypher_store ();
2155+ cbm_cypher_result_t r = {0 };
2156+ int rc = cbm_cypher_execute (s , "MATCH (n) RETURN count(*) AS total" , "test" , 0 , & r );
2157+ ASSERT_EQ (rc , 0 );
2158+ ASSERT_NULL (r .error );
2159+ ASSERT_EQ (r .row_count , 1 );
2160+ cbm_cypher_result_free (& r );
2161+ cbm_store_close (s );
2162+ PASS ();
2163+ }
2164+
21092165/* ══════════════════════════════════════════════════════════════════ */
21102166
21112167SUITE (cypher ) {
@@ -2139,6 +2195,10 @@ SUITE(cypher) {
21392195 RUN_TEST (cypher_parse_error );
21402196 /* Execution */
21412197 RUN_TEST (cypher_exec_match_all_functions );
2198+ RUN_TEST (cypher_issue240_labels_function );
2199+ RUN_TEST (cypher_issue237_distinct_order_limit );
2200+ RUN_TEST (cypher_issue252_tointeger );
2201+ RUN_TEST (cypher_issue305_count_star_alias );
21422202 RUN_TEST (cypher_exec_where_eq );
21432203 RUN_TEST (cypher_exec_where_regex );
21442204 RUN_TEST (cypher_exec_where_contains );
0 commit comments