| 456 | } |
| 457 | |
| 458 | void test_namePath() { |
| 459 | char *q = "MATCH p=()"; |
| 460 | AST *ast = buildAST(q); |
| 461 | uint *segmentIndices = getASTSegmentIndices(ast); |
| 462 | TEST_ASSERT(1 == array_len(segmentIndices)); |
| 463 | |
| 464 | AST *astSegment = AST_NewSegment(ast, 0, segmentIndices[0]); |
| 465 | TEST_ASSERT(1 == raxSize(astSegment->referenced_entities)); |
| 466 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"@anon_0", 7)); |
| 467 | array_free(segmentIndices); |
| 468 | AST_Free(astSegment); |
| 469 | AST_Free(ast); |
| 470 | |
| 471 | q = "MATCH p =()-[]-()"; |
| 472 | ast = buildAST(q); |
| 473 | segmentIndices = getASTSegmentIndices(ast); |
| 474 | TEST_ASSERT(1 == array_len(segmentIndices)); |
| 475 | |
| 476 | astSegment = AST_NewSegment(ast, 0, segmentIndices[0]); |
| 477 | TEST_ASSERT(3 == raxSize(astSegment->referenced_entities)); |
| 478 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"@anon_0", 7)); |
| 479 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"@anon_1", 7)); |
| 480 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"@anon_2", 7)); |
| 481 | array_free(segmentIndices); |
| 482 | AST_Free(astSegment); |
| 483 | AST_Free(ast); |
| 484 | |
| 485 | q = "MATCH p =(n)-[e]-(m)"; |
| 486 | ast = buildAST(q); |
| 487 | segmentIndices = getASTSegmentIndices(ast); |
| 488 | TEST_ASSERT(1 == array_len(segmentIndices)); |
| 489 | |
| 490 | astSegment = AST_NewSegment(ast, 0, segmentIndices[0]); |
| 491 | TEST_ASSERT(3 == raxSize(astSegment->referenced_entities)); |
| 492 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"n", 1)); |
| 493 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"e", 1)); |
| 494 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"m", 1)); |
| 495 | array_free(segmentIndices); |
| 496 | AST_Free(astSegment); |
| 497 | AST_Free(ast); |
| 498 | |
| 499 | q = "MATCH p =(:Label1 {value:1})-[e:Rel*]-(m:Label2 {value:2})"; |
| 500 | ast = buildAST(q); |
| 501 | segmentIndices = getASTSegmentIndices(ast); |
| 502 | TEST_ASSERT(1 == array_len(segmentIndices)); |
| 503 | |
| 504 | astSegment = AST_NewSegment(ast, 0, segmentIndices[0]); |
| 505 | TEST_ASSERT(3 == raxSize(astSegment->referenced_entities)); |
| 506 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"@anon_0", 7)); |
| 507 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"e", 1)); |
| 508 | TEST_ASSERT(raxNotFound != raxFind(astSegment->referenced_entities, (unsigned char *)"m", 1)); |
| 509 | array_free(segmentIndices); |
| 510 | AST_Free(astSegment); |
| 511 | AST_Free(ast); |
| 512 | } |
| 513 | |
| 514 | TEST_LIST = { |
| 515 | {"match", test_match}, |
nothing calls this directly
no test coverage detected