-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to automatically try all parse modes
- Loading branch information
1 parent
db39825
commit 5e8e676
Showing
9 changed files
with
352 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <pg_query.h> | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdbool.h> | ||
|
||
#include "normalize_opts_tests.c" | ||
|
||
int main() { | ||
size_t i; | ||
bool ret_code = 0; | ||
|
||
for (i = 0; i < testsLength; i += 3) { | ||
PgQueryParseMode mode = atoi(tests[i + 1]); | ||
PgQueryNormalizeResult result = pg_query_normalize_opts(tests[i], mode); | ||
|
||
if (result.error) { | ||
ret_code = -1; | ||
printf("%s\n", result.error->message); | ||
} else if (strcmp(result.normalized_query, tests[i + 2]) == 0) { | ||
printf("."); | ||
} else { | ||
ret_code = -1; | ||
printf("INVALID result for \"%s\" with %d mode\nexpected: %s\nactual: %s\n", tests[i], mode, tests[i + 2], result.normalized_query); | ||
} | ||
|
||
pg_query_free_normalize_result(result); | ||
} | ||
|
||
printf("\n"); | ||
|
||
pg_query_exit(); | ||
|
||
return ret_code; | ||
} |
Oops, something went wrong.