From 5ca8f5a020cca251a0d5d08bc855bf945735c1af Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Thu, 30 Mar 2023 22:25:09 +0100 Subject: SearcherTest: remove redundant root init, fix branch type --- unittests/Searcher/CMakeLists.txt | 4 ++-- unittests/Searcher/SearcherTest.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/unittests/Searcher/CMakeLists.txt b/unittests/Searcher/CMakeLists.txt index bad3504a..7132f1d6 100644 --- a/unittests/Searcher/CMakeLists.txt +++ b/unittests/Searcher/CMakeLists.txt @@ -1,8 +1,8 @@ add_klee_unit_test(SearcherTest SearcherTest.cpp) -target_link_libraries(SearcherTest PRIVATE kleeCore ${SQLITE3_LIBRARIES}) +target_link_libraries(SearcherTest PRIVATE kleeCore ${SQLite3_LIBRARIES}) target_include_directories(SearcherTest BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/lib") target_compile_options(SearcherTest PRIVATE ${KLEE_COMPONENT_CXX_FLAGS}) target_compile_definitions(SearcherTest PRIVATE ${KLEE_COMPONENT_CXX_DEFINES}) -target_include_directories(SearcherTest PRIVATE ${KLEE_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIRS}) +target_include_directories(SearcherTest PRIVATE ${KLEE_INCLUDE_DIRS} ${SQLite3_INCLUDE_DIRS}) diff --git a/unittests/Searcher/SearcherTest.cpp b/unittests/Searcher/SearcherTest.cpp index fc0d30ac..f9089615 100644 --- a/unittests/Searcher/SearcherTest.cpp +++ b/unittests/Searcher/SearcherTest.cpp @@ -25,7 +25,6 @@ TEST(SearcherTest, RandomPath) { // First state ExecutionState es; InMemoryPTree processTree(es); - es.ptreeNode = processTree.root.getPointer(); RNG rng; RandomPathSearcher rp(&processTree, rng); @@ -37,7 +36,7 @@ TEST(SearcherTest, RandomPath) { // Two states ExecutionState es1(es); - processTree.attach(es.ptreeNode, &es1, &es, BranchType::NONE); + processTree.attach(es.ptreeNode, &es1, &es, BranchType::Conditional); rp.update(&es, {&es1}, {}); // Random path seed dependant @@ -65,10 +64,9 @@ TEST(SearcherTest, TwoRandomPath) { // Root state ExecutionState root; InMemoryPTree processTree(root); - root.ptreeNode = processTree.root.getPointer(); ExecutionState es(root); - processTree.attach(root.ptreeNode, &es, &root, BranchType::NONE); + processTree.attach(root.ptreeNode, &es, &root, BranchType::Conditional); RNG rng, rng1; RandomPathSearcher rp(&processTree, rng); @@ -83,7 +81,7 @@ TEST(SearcherTest, TwoRandomPath) { // Two states ExecutionState es1(es); - processTree.attach(es.ptreeNode, &es1, &es, BranchType::NONE); + processTree.attach(es.ptreeNode, &es1, &es, BranchType::Conditional); rp.update(&es, {}, {}); rp1.update(nullptr, {&es1}, {}); @@ -123,7 +121,6 @@ TEST(SearcherTest, TwoRandomPathDot) { // Root state ExecutionState root; InMemoryPTree processTree(root); - root.ptreeNode = processTree.root.getPointer(); rootPNode = root.ptreeNode; ExecutionState es(root); @@ -201,11 +198,11 @@ TEST(SearcherTest, TwoRandomPathDot) { processTree.remove(es1.ptreeNode); processTree.remove(root.ptreeNode); } + TEST(SearcherDeathTest, TooManyRandomPaths) { // First state ExecutionState es; InMemoryPTree processTree(es); - es.ptreeNode = processTree.root.getPointer(); processTree.remove(es.ptreeNode); // Need to remove to avoid leaks RNG rng; -- cgit 1.4.1