Files
TheRock/rocm-systems/projects/rocprofiler-sdk/external/sqlite/test/lemon-test01.y
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

81 lines
1.9 KiB
Plaintext

// A test case for the LEMON parser generator. Run as follows:
//
// lemon lemon-test01.y && gcc -g lemon-test01.c && ./a.out
//
// This testcase was made obsolete by check-in 7cca80808cef192f on
// 2021-08-17 (associated with Forum Thread
// https://sqlite.org/forum/forumpost/bd91fd965c9803c4) and no longer
// works. It is retained for historical reference only.
//
%token_prefix TK_
%token_type int
%default_type int
%include {
static int nSyntaxError = 0;
static int nAccept = 0;
static int nFailure = 0;
}
all ::= A B.
all ::= error B.
%syntax_error {
nSyntaxError++;
}
%parse_accept {
nAccept++;
}
%parse_failure {
nFailure++;
}
%code {
#include <assert.h>
#include "lemon-test01.h"
static int nTest = 0;
static int nErr = 0;
static void testCase(int testId, int shouldBe, int actual){
nTest++;
if( shouldBe==actual ){
printf("test %d: ok\n", testId);
}else{
printf("test %d: got %d, expected %d\n", testId, actual, shouldBe);
nErr++;
}
}
int main(int argc, char **argv){
yyParser xp;
ParseInit(&xp);
Parse(&xp, TK_A, 0);
Parse(&xp, TK_B, 0);
Parse(&xp, 0, 0);
ParseFinalize(&xp);
testCase(100, 0, nSyntaxError);
testCase(110, 1, nAccept);
testCase(120, 0, nFailure);
nSyntaxError = nAccept = nFailure = 0;
ParseInit(&xp);
Parse(&xp, TK_B, 0);
Parse(&xp, TK_B, 0);
Parse(&xp, 0, 0);
ParseFinalize(&xp);
testCase(200, 1, nSyntaxError);
testCase(210, 1, nAccept);
testCase(220, 0, nFailure);
nSyntaxError = nAccept = nFailure = 0;
ParseInit(&xp);
Parse(&xp, TK_A, 0);
Parse(&xp, TK_A, 0);
Parse(&xp, 0, 0);
ParseFinalize(&xp);
testCase(200, 1, nSyntaxError);
testCase(210, 0, nAccept);
testCase(220, 0, nFailure);
if( nErr==0 ){
printf("%d tests pass\n", nTest);
}else{
printf("%d errors out %d tests\n", nErr, nTest);
}
return nErr;
}
}