From 44c9585602d618c40dfbb566a02185ae15f400d0 Mon Sep 17 00:00:00 2001 From: buda Date: Sun, 27 Sep 2015 23:05:04 +0200 Subject: [PATCH] basic test on dynamic bitset --- .gitignore | 3 +++ test/README.md | 3 +++ test/{bitblock.cpp => bitblock.cpp.old} | 0 test/dynamic_bitset.cpp | 19 +++++++++++++++++++ test/{skiplist.cpp => skiplist.cpp.old} | 0 test/{spinlock.cpp => spinlock.cpp.old} | 0 ...onengine.cpp => transactionengine.cpp.old} | 0 7 files changed, 25 insertions(+) create mode 100644 test/README.md rename test/{bitblock.cpp => bitblock.cpp.old} (100%) create mode 100644 test/dynamic_bitset.cpp rename test/{skiplist.cpp => skiplist.cpp.old} (100%) rename test/{spinlock.cpp => spinlock.cpp.old} (100%) rename test/{transactionengine.cpp => transactionengine.cpp.old} (100%) diff --git a/.gitignore b/.gitignore index 8ec195372..125348867 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ .ycm_extra_conf.py .ycm_extra_conf.pyc *.swp +*.swo +*.out +*.dSYM/ diff --git a/test/README.md b/test/README.md new file mode 100644 index 000000000..ccbe6d5c3 --- /dev/null +++ b/test/README.md @@ -0,0 +1,3 @@ +# NOTE +Files with .old extension are old test files. They have to be rewritten because of changes in the appropriate project files. +bitblock.hpp is going to be replaced with the dynamic_bitset diff --git a/test/bitblock.cpp b/test/bitblock.cpp.old similarity index 100% rename from test/bitblock.cpp rename to test/bitblock.cpp.old diff --git a/test/dynamic_bitset.cpp b/test/dynamic_bitset.cpp new file mode 100644 index 000000000..5afb25ee8 --- /dev/null +++ b/test/dynamic_bitset.cpp @@ -0,0 +1,19 @@ +#include "catch.hpp" +#include "data_structures/bitset/dynamic_bitset.hpp" + +TEST_CASE("Dynamic bitset basic functionality") +{ + DynamicBitset<> db; + db.set(2222255555, 1); + bool value = db.at(2222255555, 1); + REQUIRE(value == true); + + + db.set(32, 1); + value = db.at(32, 1); + REQUIRE(value == true); + + db.clear(32, 1); + value = db.at(32, 1); + REQUIRE(value == false); +} diff --git a/test/skiplist.cpp b/test/skiplist.cpp.old similarity index 100% rename from test/skiplist.cpp rename to test/skiplist.cpp.old diff --git a/test/spinlock.cpp b/test/spinlock.cpp.old similarity index 100% rename from test/spinlock.cpp rename to test/spinlock.cpp.old diff --git a/test/transactionengine.cpp b/test/transactionengine.cpp.old similarity index 100% rename from test/transactionengine.cpp rename to test/transactionengine.cpp.old