void check(const char code[], bool inconclusive = false, bool runSimpleChecks = true, const char* filename = "test.cpp") { // Clear the error buffer.. errout.str(""); Settings settings; LOAD_LIB_2(settings.library, "std.cfg"); settings.inconclusive = inconclusive; settings.addEnabled("warning"); settings.addEnabled("style"); // Tokenize.. Tokenizer tokenizer(&settings, this); std::istringstream istr(code); tokenizer.tokenize(istr, filename); CheckAutoVariables checkAutoVariables(&tokenizer, &settings, this); checkAutoVariables.returnReference(); checkAutoVariables.assignFunctionArg(); if (runSimpleChecks) { const std::string str1(tokenizer.tokens()->stringifyList(0,true)); tokenizer.simplifyTokenList2(); const std::string str2(tokenizer.tokens()->stringifyList(0,true)); if (str1 != str2) warnUnsimplified(str1, str2); // Check auto variables checkAutoVariables.autoVariables(); checkAutoVariables.returnPointerToLocalArray(); } }
void run() override { LOAD_LIB_2(settings.library, "std.cfg"); TEST_CASE(deadlock_with_many_errors); TEST_CASE(many_threads); TEST_CASE(no_errors_more_files); TEST_CASE(no_errors_less_files); TEST_CASE(no_errors_equal_amount_files); TEST_CASE(one_error_less_files); TEST_CASE(one_error_several_files); }
void run() { LOAD_LIB_2(settings.library, "windows.cfg"); TEST_CASE(heapDoubleFree); }