diff options
author | Frank Busse <bb0xfb@gmail.com> | 2020-06-25 21:35:25 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-07-30 16:44:31 +0100 |
commit | 661fba88fff0205ea258a1149907f2822458cd83 (patch) | |
tree | f9bc1fb96d55d55312dd10b19a0cf94a7ebe89e7 /unittests/Searcher | |
parent | 169022a56d62cdb2f15540a0c592c5f90fdb39cb (diff) | |
download | klee-661fba88fff0205ea258a1149907f2822458cd83.tar.gz |
introduce --rng-initial-seed=<unsigned>
* move global theRNG into Executor * pass theRNG via ctor to searchers * remove some type warnings from RNG.cpp Fixes #1023.
Diffstat (limited to 'unittests/Searcher')
-rw-r--r-- | unittests/Searcher/SearcherTest.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/unittests/Searcher/SearcherTest.cpp b/unittests/Searcher/SearcherTest.cpp index e9e7c043..eff5a8af 100644 --- a/unittests/Searcher/SearcherTest.cpp +++ b/unittests/Searcher/SearcherTest.cpp @@ -10,9 +10,11 @@ #include "gtest/gtest.h" +#include "klee/ADT/RNG.h" #include "Core/ExecutionState.h" #include "Core/PTree.h" #include "Core/Searcher.h" + #include "llvm/Support/raw_ostream.h" using namespace klee; @@ -25,7 +27,8 @@ TEST(SearcherTest, RandomPath) { PTree processTree(&es); es.ptreeNode = processTree.root.getPointer(); - RandomPathSearcher rp(processTree); + RNG rng; + RandomPathSearcher rp(processTree, rng); EXPECT_TRUE(rp.empty()); rp.update(nullptr, {&es}, {}); @@ -67,8 +70,9 @@ TEST(SearcherTest, TwoRandomPath) { ExecutionState es(root); processTree.attach(root.ptreeNode, &es, &root); - RandomPathSearcher rp(processTree); - RandomPathSearcher rp1(processTree); + RNG rng, rng1; + RandomPathSearcher rp(processTree, rng); + RandomPathSearcher rp1(processTree, rng1); EXPECT_TRUE(rp.empty()); EXPECT_TRUE(rp1.empty()); @@ -127,8 +131,9 @@ TEST(SearcherTest, TwoRandomPathDot) { rightLeafPNode = root.ptreeNode; esParentPNode = es.ptreeNode; - RandomPathSearcher rp(processTree); - RandomPathSearcher rp1(processTree); + RNG rng; + RandomPathSearcher rp(processTree, rng); + RandomPathSearcher rp1(processTree, rng); rp.update(nullptr, {&es}, {}); @@ -203,9 +208,10 @@ TEST(SearcherDeathTest, TooManyRandomPaths) { es.ptreeNode = processTree.root.getPointer(); processTree.remove(es.ptreeNode); // Need to remove to avoid leaks - RandomPathSearcher rp(processTree); - RandomPathSearcher rp1(processTree); - RandomPathSearcher rp2(processTree); - ASSERT_DEATH({ RandomPathSearcher rp3(processTree); }, ""); + RNG rng; + RandomPathSearcher rp(processTree, rng); + RandomPathSearcher rp1(processTree, rng); + RandomPathSearcher rp2(processTree, rng); + ASSERT_DEATH({ RandomPathSearcher rp3(processTree, rng); }, ""); } } |