Loading ci_cd/problem2.yml +6 −6 Original line number Diff line number Diff line Loading @@ -3,12 +3,12 @@ prebuild_problem_2: script: - | # Check if source files exist if [ ! -f "impl/myBloom.h" ]; then echo "myBloom.h does not exist under include directory"; if [ ! -f "impl/MyBloom.h" ]; then echo "MyBloom.h does not exist under include directory"; exit 1; fi if [ ! -f "impl/myBloom.cpp" ]; then echo "myBloom.cpp does not exist under impl directory"; if [ ! -f "impl/MyBloom.cpp" ]; then echo "MyBloom.cpp does not exist under impl directory"; exit 1; fi - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkFour.git hw4 Loading @@ -25,8 +25,8 @@ compile_problem_2: - job: prebuild_problem_2 artifacts: true script: - cp include/myBloom.h hw4/tests/include/ - cp impl/myBloom.cpp hw4/tests/impl/ - cp include/MyBloom.h hw4/tests/include/ - cp impl/MyBloom.cpp hw4/tests/impl/ - cd hw4/tests - make problem2 artifacts: Loading ci_cd/problem3.yml +3 −3 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ prebuild_problem_3: script: - | # Check if source files exist if [ ! -f "impl/miningHash.cpp" ]; then echo "miningHash.cpp does not exist under impl directory"; if [ ! -f "impl/MiningHash.cpp" ]; then echo "MiningHash.cpp does not exist under impl directory"; exit 1; fi - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkFour.git hw4 Loading @@ -21,7 +21,7 @@ compile_problem_3: - job: prebuild_problem_3 artifacts: true script: - cp impl/miningHash.cpp hw4/tests/impl/ - cp impl/MiningHash.cpp hw4/tests/impl/ - cd hw4/tests - make problem3 artifacts: Loading tests/testBloom.cpp +61 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ #include <array> #include <memory> #include "include/myBloom.h" #include "include/MyBloom.h" using namespace std; Loading Loading @@ -164,8 +164,67 @@ bool test_4() { return true; } // -------------------- No false negatives -------------------- bool test_5() { const char* T = "Bloom filter should have no false negatives"; myBloom<32> bf; // elements inserted std::vector<std::string> inserted = { "apple", "banana", "carrot", "dog", "elephant" }; // elements to check std::vector<std::string> check = { "apple", "banana", "carrot", "dog", "elephant", "fish", "grape", "house", "island", "jacket" }; // insert elements for (const auto& s : inserted) bf.insert(s); // verify Bloom filter property for (const auto& s : check) { bool exists = bf.exists(s); if (!exists) { // if Bloom says "not present", // it must truly not have been inserted if (std::find(inserted.begin(), inserted.end(), s) != inserted.end()) { return failExample( T, "Bloom filter produced a false negative", "element should exist", s ); } } } return true; } int main() { bool results[] = { test_0(), test_1(), test_2(), test_3(), test_4() }; bool results[] = { test_0(), test_1(), test_2(), test_3(), test_4(), test_5() }; bool allPassed = true; for (size_t ii = 0; ii < std::size(results); ii++) { Loading tests/testHash.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ using namespace std; #include "impl/miningHash.cpp" #include "impl/MiningHash.cpp" // helper function: consistent failure printing bool failExample(const char* testName, Loading Loading
ci_cd/problem2.yml +6 −6 Original line number Diff line number Diff line Loading @@ -3,12 +3,12 @@ prebuild_problem_2: script: - | # Check if source files exist if [ ! -f "impl/myBloom.h" ]; then echo "myBloom.h does not exist under include directory"; if [ ! -f "impl/MyBloom.h" ]; then echo "MyBloom.h does not exist under include directory"; exit 1; fi if [ ! -f "impl/myBloom.cpp" ]; then echo "myBloom.cpp does not exist under impl directory"; if [ ! -f "impl/MyBloom.cpp" ]; then echo "MyBloom.cpp does not exist under impl directory"; exit 1; fi - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkFour.git hw4 Loading @@ -25,8 +25,8 @@ compile_problem_2: - job: prebuild_problem_2 artifacts: true script: - cp include/myBloom.h hw4/tests/include/ - cp impl/myBloom.cpp hw4/tests/impl/ - cp include/MyBloom.h hw4/tests/include/ - cp impl/MyBloom.cpp hw4/tests/impl/ - cd hw4/tests - make problem2 artifacts: Loading
ci_cd/problem3.yml +3 −3 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ prebuild_problem_3: script: - | # Check if source files exist if [ ! -f "impl/miningHash.cpp" ]; then echo "miningHash.cpp does not exist under impl directory"; if [ ! -f "impl/MiningHash.cpp" ]; then echo "MiningHash.cpp does not exist under impl directory"; exit 1; fi - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkFour.git hw4 Loading @@ -21,7 +21,7 @@ compile_problem_3: - job: prebuild_problem_3 artifacts: true script: - cp impl/miningHash.cpp hw4/tests/impl/ - cp impl/MiningHash.cpp hw4/tests/impl/ - cd hw4/tests - make problem3 artifacts: Loading
tests/testBloom.cpp +61 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ #include <array> #include <memory> #include "include/myBloom.h" #include "include/MyBloom.h" using namespace std; Loading Loading @@ -164,8 +164,67 @@ bool test_4() { return true; } // -------------------- No false negatives -------------------- bool test_5() { const char* T = "Bloom filter should have no false negatives"; myBloom<32> bf; // elements inserted std::vector<std::string> inserted = { "apple", "banana", "carrot", "dog", "elephant" }; // elements to check std::vector<std::string> check = { "apple", "banana", "carrot", "dog", "elephant", "fish", "grape", "house", "island", "jacket" }; // insert elements for (const auto& s : inserted) bf.insert(s); // verify Bloom filter property for (const auto& s : check) { bool exists = bf.exists(s); if (!exists) { // if Bloom says "not present", // it must truly not have been inserted if (std::find(inserted.begin(), inserted.end(), s) != inserted.end()) { return failExample( T, "Bloom filter produced a false negative", "element should exist", s ); } } } return true; } int main() { bool results[] = { test_0(), test_1(), test_2(), test_3(), test_4() }; bool results[] = { test_0(), test_1(), test_2(), test_3(), test_4(), test_5() }; bool allPassed = true; for (size_t ii = 0; ii < std::size(results); ii++) { Loading
tests/testHash.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ using namespace std; #include "impl/miningHash.cpp" #include "impl/MiningHash.cpp" // helper function: consistent failure printing bool failExample(const char* testName, Loading