🚨 fixed a linter warning
This commit is contained in:
parent
1f3d2a3be7
commit
5773e164bb
3 changed files with 13 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,6 +10,7 @@ fuzz-testing
|
||||||
|
|
||||||
build
|
build
|
||||||
build_coverage
|
build_coverage
|
||||||
|
clang_analyze_build
|
||||||
|
|
||||||
doc/xml
|
doc/xml
|
||||||
doc/html
|
doc/html
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -258,6 +258,12 @@ fuzzing-stop:
|
||||||
cppcheck:
|
cppcheck:
|
||||||
cppcheck --enable=warning --inconclusive --force --std=c++11 $(AMALGAMATED_FILE) --error-exitcode=1
|
cppcheck --enable=warning --inconclusive --force --std=c++11 $(AMALGAMATED_FILE) --error-exitcode=1
|
||||||
|
|
||||||
|
# compile and check with Clang Static Analyzer
|
||||||
|
clang_analyze:
|
||||||
|
rm -fr clang_analyze_build
|
||||||
|
mkdir clang_analyze_build
|
||||||
|
cd clang_analyze_build ; CCC_CXX=/Users/niels/Documents/projects/llvm-clang/local/bin/clang++ /Users/niels/Documents/projects/llvm-clang/local/bin/scan-build cmake ..
|
||||||
|
/Users/niels/Documents/projects/llvm-clang/local/bin/scan-build -enable-checker alpha.core.DynamicTypeChecker,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.cplusplus.DeleteWithNonVirtualDtor,alpha.cplusplus.IteratorRange,alpha.cplusplus.MisusedMovedObject,alpha.security.ArrayBoundV2,alpha.core.Conversion --use-c++=/Users/niels/Documents/projects/llvm-clang/local/bin/clang++ --view -analyze-headers -o clang_analyze_build/report.html make -j10 -C clang_analyze_build
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# maintainer targets
|
# maintainer targets
|
||||||
|
|
|
@ -168,6 +168,7 @@ TEST_CASE("README", "[hide]")
|
||||||
const std::string tmp = j[0];
|
const std::string tmp = j[0];
|
||||||
j[1] = 42;
|
j[1] = 42;
|
||||||
bool foo = j.at(2);
|
bool foo = j.at(2);
|
||||||
|
CHECK(foo == true);
|
||||||
|
|
||||||
// other stuff
|
// other stuff
|
||||||
j.size(); // 3 entries
|
j.size(); // 3 entries
|
||||||
|
@ -177,6 +178,7 @@ TEST_CASE("README", "[hide]")
|
||||||
|
|
||||||
// comparison
|
// comparison
|
||||||
bool x = (j == "[\"foo\", 1, true]"_json); // true
|
bool x = (j == "[\"foo\", 1, true]"_json); // true
|
||||||
|
CHECK(x == true);
|
||||||
|
|
||||||
// create an object
|
// create an object
|
||||||
json o;
|
json o;
|
||||||
|
@ -257,17 +259,21 @@ TEST_CASE("README", "[hide]")
|
||||||
bool b1 = true;
|
bool b1 = true;
|
||||||
json jb = b1;
|
json jb = b1;
|
||||||
bool b2 = jb;
|
bool b2 = jb;
|
||||||
|
CHECK(b2 == true);
|
||||||
|
|
||||||
// numbers
|
// numbers
|
||||||
int i = 42;
|
int i = 42;
|
||||||
json jn = i;
|
json jn = i;
|
||||||
double f = jn;
|
double f = jn;
|
||||||
|
CHECK(f == 42);
|
||||||
|
|
||||||
// etc.
|
// etc.
|
||||||
|
|
||||||
std::string vs = js.get<std::string>();
|
std::string vs = js.get<std::string>();
|
||||||
bool vb = jb.get<bool>();
|
bool vb = jb.get<bool>();
|
||||||
|
CHECK(vb == true);
|
||||||
int vi = jn.get<int>();
|
int vi = jn.get<int>();
|
||||||
|
CHECK(vi == 42);
|
||||||
|
|
||||||
// etc.
|
// etc.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue