static int Test_verifierParseConstants(void) { char* file; struct reader r; struct verifier vrf; #define testparse(f, e) \ do { \ file = f; \ readerInitString(&r, file); \ verifierInit(&vrf); \ verifierBeginReadingFile(&vrf, &r); \ verifierParseConstants(&vrf); \ check_err(vrf.err, e); \ readerClean(&r); \ verifierClean(&vrf); \ } while (0) testparse("", error_unterminatedStatement); testparse("A savage place! c as holy and enchanted $.\n", error_none); readerInitString(&r, "savage $.\n"); charArrayAppend(&r.filename, "file1", 5 + 1); verifierInit(&vrf); verifierBeginReadingFile(&vrf, &r); verifierParseConstants(&vrf); readerClean(&r); readerInitString(&r, "savage $.\n"); charArrayAppend(&r.filename, "file2", 5 + 1); verifierBeginReadingFile(&vrf, &r); verifierParseConstants(&vrf); readerClean(&r); check_err(vrf.err, error_duplicateSymbol); verifierClean(&vrf); return 0; #undef testparse }
void testing_parser(bool verbose) { MACRO_SET set = { 0, 0, CONFIG_OPT_WANT_META | CONFIG_OPT_DEFAULTS_ARE_PARAM_INFO, 0, NULL, NULL, ALLOCATION_POOL(), std::vector<const char*>(), &TestingMacroDefaults }; MACRO_SOURCE source = { false, false, 0, 0, -1, -2 }; insert_source("parse", set, source); testparse(__LINE__, set, def_ctx, source, verbose, "last wins", "FOO= bar\nFOO = baz\n", "\tFOO=baz\n"); testparse(__LINE__, set, def_ctx, source, verbose, "self sub", "FOO= bar\nFOO = $(FOO) baz\n", "\tFOO=bar baz\n"); testparse(__LINE__, set, def_ctx, source, verbose, "self sub picks up subsys", "FOO=bar\nMASTER.FOO= MAR\nFOO = $(FOO) baz\n", "\tFOO=bar baz\n\tMASTER.FOO=MAR\n"); testparse_as("MASTER", __LINE__, set, def_ctx, source, verbose, "self sub picks up subsys2", "FOO=bar\nMASTER.FOO= MAR\nFOO = $(FOO) baz\n", "\tFOO=MAR baz\n\tMASTER.FOO=MAR\n"); testparse_lcl("LOWER", __LINE__, set, def_ctx, source, verbose, "self sub picks up subsys3", "FOO=bar\nMASTER.FOO= MAR\nFOO = $(FOO) baz\n", "\tFOO=bar baz\n\tMASTER.FOO=MAR\n"); const char * n1 = "N1=$(NEGOTIATOR)\nN1_ARGS=-local-name N1\nN1.NEGOTIATOR_LOG=$(LOG)/NegotiatorLog.N1\nN1.SPOOL=$(SPOOL)/N1\n"; const char * n1e1 = "\tN1=$(NEGOTIATOR)\n\tN1_ARGS=-local-name N1\n\tN1.NEGOTIATOR_LOG=$(LOG)/NegotiatorLog.N1\n\tN1.SPOOL=$(SPOOL)/N1\n"; #ifdef WIN32 const char * n1e2 = "\tN1=$(NEGOTIATOR)\n\tN1_ARGS=-local-name N1\n\tN1.NEGOTIATOR_LOG=$(LOG)/NegotiatorLog.N1\n\tN1.SPOOL=$(LOCAL_DIR)\\spool/N1\n"; #else const char * n1e2 = "\tN1=$(NEGOTIATOR)\n\tN1_ARGS=-local-name N1\n\tN1.NEGOTIATOR_LOG=$(LOG)/NegotiatorLog.N1\n\tN1.SPOOL=$(LOCAL_DIR)/spool/N1\n"; #endif testparse(__LINE__, set, def_ctx, source, verbose, "subsys.self sub1", n1, n1e1); testparse_as("NEGOTIATOR", __LINE__, set, def_ctx, source, verbose, "subsys.self sub2", n1, n1e1); testparse_lcl("N1", __LINE__, set, def_ctx, source, verbose, "subsys.self sub3", n1, n1e2); testparse_lcl_as("N1", "NEGOTIATOR", __LINE__, set, def_ctx, source, verbose, "subsys.self sub4", n1, n1e2); }
int main ( int argc, char** argv ) { /*yydebug =1;*/ testin = stdin; testparse ( ); return 0; }
void testparse_lcl_as(const char * local, const char *prefix, int lineno, MACRO_SET & set, MACRO_EVAL_CONTEXT &_ctx, MACRO_SOURCE & source, bool verbose, const char * tag, const char * params, const char * expected) { MACRO_EVAL_CONTEXT ctx = _ctx; ctx.localname = local; ctx.subsys = prefix; testparse(lineno, set, ctx, source, verbose, tag, params, expected); }
int main ( int argc, char** argv ) { yyscan_t scanner; /*yydebug =1;*/ testlex_init ( &scanner ); testset_in(stdin,scanner); testparse ( scanner ); testlex_destroy ( scanner ); return 0; }
ArcsView() { testparse(); fSweep = SkIntToScalar(100); }
ArcsView() { testparse(); fSweep = SkIntToScalar(100); this->setBGColor(0xFFDDDDDD); }