cppcheck/test
moui0 eb076d877b
Improve testcases for unsigned char platforms (#5524)
I got error messages while building `cppcheck 2.12.0` for RISC-V Arch
Linux:
```
Testing Complete
Number of tests: 4420
Number of todos: 331
Tests failed: 2

/usr/src/debug/cppcheck/cppcheck/test/testcondition.cpp:4501(TestCondition::alwaysTrue): Assertion failed. 
Expected: 
[test.cpp:6]: (style) Condition 'o[1]=='\0'' is always false\n

Actual: 
[test.cpp:4] -> [test.cpp:6]: (style) Condition 'o[1]=='\0'' is always false\n

_____
/usr/src/debug/cppcheck/cppcheck/test/testcondition.cpp:5014(TestCondition::alwaysTrueContainer): Assertion failed. 
Expected: 
[test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n

Actual: 
[test.cpp:3] -> [test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n
```

I found out the reason is that the testcases were designed for
x86/x86_64 or other `signed char` platforms (i.e. default character type
is `signed char` ), whereareas RISC-V is an `unsigned char` platform,
which causes different behavior in
`lib/valueflow.cpp:valueFlowImpossibleValues`. I'm not sure whether this
error leads from a functional bug, so if you have a better approach to
fix it, please let me know.

Maybe you could reproduce this error on x86_64 platform by setting
`defaultSign = 'u';` in `Platform::set(Type t)`.
2023-10-07 23:04:57 +02:00
..
cfg windows.cfg: Fix wrong FlushConsoleInputBuffer configuration (#5526) 2023-10-07 20:05:43 +02:00
cli refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876) 2023-10-05 19:04:06 +02:00
CMakeLists.txt testrunner: use structs with designated initialization to pass options (#4975) 2023-08-04 13:56:18 +02:00
fixture.cpp refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876) 2023-10-05 19:04:06 +02:00
fixture.h TestCmdlineParser: store messages in logger class instead of utilizing the redirect (#5482) 2023-09-26 21:38:15 +02:00
helpers.cpp fixed #11483 (FN unusedFunction for method with inline implementation) (#5457) 2023-09-20 14:45:44 +02:00
helpers.h refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876) 2023-10-05 19:04:06 +02:00
main.cpp extracted single job execution into `SingleExecutor` / improved testing / do not unconditionally apply colors to output (#4882) 2023-04-08 18:06:38 +02:00
options.cpp Update copyright year 2023-01-28 10:16:34 +01:00
options.h Update Copyrights 2022-08-28 14:22:12 +02:00
precompiled.h cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
redirect.h simplified `ThreadExecutor` class by moving some code out of it / fixed some thread safety issues (#4849) 2023-03-04 12:05:17 +01:00
test64bit.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testanalyzerinformation.cpp Update copyright year 2023-01-28 10:16:34 +01:00
testassert.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testastutils.cpp Fix 11992: FN (regression): uninitvar (#5465) 2023-09-20 06:43:58 +02:00
testautovariables.cpp Fix 11980: False positive returnDanglingLifetime returning pointer to stack array as std::string (by way of struct return value constructor) (#5445) 2023-09-13 21:26:37 +02:00
testbool.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testboost.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testbufferoverrun.cpp adjusted tests to reduce the amount of `friend` declarations necessary (#5435) 2023-09-11 20:26:22 +02:00
testcharvar.cpp testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +02:00
testcheck.cpp TestCheck: added missing registration (#5484) 2023-09-26 10:03:53 +02:00
testclangimport.cpp Fix use-after-free crash when using --clang (#5367) 2023-08-28 09:28:47 +02:00
testclass.cpp adjusted tests to reduce the amount of `friend` declarations necessary (#5435) 2023-09-11 20:26:22 +02:00
testcmdlineparser.cpp refs #12022 - disallow multiple `--project` options (#5499) 2023-10-05 21:36:44 +02:00
testcolor.cpp optimized template string substitutions a bit (#4840) 2023-04-08 22:19:52 +02:00
testcondition.cpp Improve testcases for unsigned char platforms (#5524) 2023-10-07 23:04:57 +02:00
testconstructors.cpp Fixed #11907 (False positive: uninitialized member (mutable member, const method call)) (#5384) 2023-09-01 18:10:21 +02:00
testcppcheck.cpp added `TestCheck` and moved some tests from `TestCppcheck` (#5289) 2023-08-07 20:49:10 +02:00
testerrorlogger.cpp Improved addon execution errorhandling (#5451) 2023-09-20 10:40:57 +02:00
testexceptionsafety.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testfilelister.cpp refs #11993 - error out in `TestFileLister::recursiveAddFiles()` instead of looping infinitely when repository root directory is not found (#5462) 2023-09-20 10:49:00 +02:00
testfunctions.cpp Fix #11881 FP returnStdMoveLocal / Fix FP incorrectStringBooleanError / Support std::string::starts/ends_with() (#5347) 2023-08-21 10:43:54 +02:00
testgarbage.cpp Fix #12026 (simplifyTypedef: not handled properly when typedef and enum constant has same name) (#5500) 2023-10-01 21:26:54 +02:00
testimportproject.cpp Support importing projects with project-name (#5456) 2023-09-18 13:54:20 +02:00
testincompletestatement.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testinternal.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testio.cpp adjusted tests to reduce the amount of `friend` declarations necessary (#5435) 2023-09-11 20:26:22 +02:00
testleakautovar.cpp got rid of test-only `Library` functions / avoid some more direct modifications of library data structures in test (#5468) 2023-09-25 13:37:24 +02:00
testlibrary.cpp cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267) 2023-08-02 10:36:17 +02:00
testmathlib.cpp MathLib: renamed `to{U}LongNumber()` to `toBig{U}Number()` (#5503) 2023-10-05 19:21:42 +02:00
testmemleak.cpp Fix FP leakNoVarFunctionCall (#5309) 2023-08-10 20:55:02 +02:00
testnullpointer.cpp adjusted tests to reduce the amount of `friend` declarations necessary (#5435) 2023-09-11 20:26:22 +02:00
testoptions.cpp cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267) 2023-08-02 10:36:17 +02:00
testother.cpp Fix #12036 FN knownConditionTrueFalse comparing enum with number (#5510) 2023-10-05 18:15:18 +02:00
testpath.cpp fixed #11926 (Treat MacOS filesystem as case insensitive) / TestPath: added more tests (#5412) 2023-09-08 17:33:37 +02:00
testpathmatch.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testplatform.cpp fixed #11917 (Default to `native` platform in Windows builds) (#5428) 2023-09-11 11:08:23 +02:00
testpostfixoperator.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testpreprocessor.cpp testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +02:00
testprocessexecutor.cpp refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876) 2023-10-05 19:04:06 +02:00
testrunner.vcxproj fixed #11910 - removed Visual Studio x86 targets from project files and builds from CI (#5397) 2023-09-04 19:40:13 +02:00
testrunner.vcxproj.filters Fix #11897 (Safety: show what checks are enabled/disabled) (#5378) 2023-08-31 18:28:47 +02:00
testsettings.cpp Update copyright year 2023-01-28 10:16:34 +01:00
testsimplifytemplate.cpp Fix #10837 crash/hang in expandTemplate (#5410) 2023-09-08 14:59:42 +02:00
testsimplifytokens.cpp avoid some redundant and unused settings in tests among other cleanups / added and used `WARN_UNUSED` attribute (#5284) 2023-08-09 12:43:55 +02:00
testsimplifytypedef.cpp Fix #12026 (simplifyTypedef: not handled properly when typedef and enum constant has same name) (#5500) 2023-10-01 21:26:54 +02:00
testsimplifyusing.cpp Fix #11981 internalAstError with using declaration (#5446) 2023-09-14 12:14:08 +02:00
testsingleexecutor.cpp refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876) 2023-10-05 19:04:06 +02:00
testsizeof.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
teststl.cpp Fix #12018 (False positive: null pointer, multiple arguments) (#5509) 2023-10-05 15:08:25 +02:00
teststring.cpp Fix #11976 FP incorrectStringBooleanError in assert (#5415) 2023-09-12 10:05:51 +02:00
testsummaries.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testsuppressions.cpp moved suppression-specific code out of `ErrorLogger` (#5329) 2023-08-18 11:55:23 +02:00
testsymboldatabase.cpp Fix #11408 debug: Function::addArguments found argument 't' with varid 0 (#5507) 2023-10-05 10:01:46 +02:00
testthreadexecutor.cpp refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876) 2023-10-05 19:04:06 +02:00
testtimer.cpp Update copyright year 2023-01-28 10:16:34 +01:00
testtoken.cpp Fix #11438 MathLib error on user defined literals (#5448) 2023-09-15 10:00:00 +02:00
testtokenize.cpp Fix #12010 Improve unknownMacro message: int (#5473) 2023-09-22 10:16:21 +02:00
testtokenlist.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testtokenrange.cpp reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
testtype.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testuninitvar.cpp Fix 12030: False positive: uninitialized variable, conditional modification, flag (#5520) 2023-10-07 14:01:06 +02:00
testunusedfunctions.cpp Fix #12013 crash: crashes in release builds if cppcheck build dir is used (#5489) 2023-09-27 16:44:22 +02:00
testunusedprivfunc.cpp testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +02:00
testunusedvar.cpp Fix #11923 FN unreadVariable (regression) (#5409) 2023-09-11 11:36:03 +02:00
testutils.cpp utils.h: added `startsWith()` and started using it (#5381) 2023-09-08 19:30:25 +02:00
testvaarg.cpp removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308) 2023-08-18 12:03:50 +02:00
testvalueflow.cpp Fix #12018 (False positive: null pointer, multiple arguments) (#5509) 2023-10-05 15:08:25 +02:00
testvarid.cpp Fix #11408 debug: Function::addArguments found argument 't' with varid 0 (#5507) 2023-10-05 10:01:46 +02:00