From d80edb2c2abc180400724e75deb5c402c28825f7 Mon Sep 17 00:00:00 2001 From: wjblanke Date: Sun, 13 Dec 2020 15:51:49 -0600 Subject: [PATCH] more e option support (#148) --- python-bindings/chiapos.cpp | 6 ++++-- src/cli.cpp | 6 +++--- src/plotter_disk.hpp | 4 ++-- tests/test.cpp | 4 ++-- tests/test_python_bindings.py | 1 + 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/python-bindings/chiapos.cpp b/python-bindings/chiapos.cpp index fa455bf31..ecf8ff238 100644 --- a/python-bindings/chiapos.cpp +++ b/python-bindings/chiapos.cpp @@ -48,7 +48,8 @@ PYBIND11_MODULE(chiapos, m) uint32_t buffmegabytes, uint32_t num_buckets, uint32_t stripe_size, - uint8_t num_threads) { + uint8_t num_threads, + bool nobitfield) { std::string memo_str(memo); const uint8_t *memo_ptr = reinterpret_cast(memo_str.data()); std::string id_str(id); @@ -66,7 +67,8 @@ PYBIND11_MODULE(chiapos, m) buffmegabytes, num_buckets, stripe_size, - num_threads); + num_threads, + nobitfield); } catch (const std::exception &e) { std::cout << "Caught plotting error: " << e.what() << std::endl; throw e; diff --git a/src/cli.cpp b/src/cli.cpp index 5d582d11e..e4e88881d 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) try { string operation = "help"; string memo = "0102030405"; string id = "022fb42c08c12de3a6af053880199806532e79515f94e83461612101f9412f9e"; - bool disablebitfield = false; + bool nobitfield = false; uint32_t buffmegabytes = 0; options.allow_unrecognised_options().add_options()( @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) try { "f, file", "Filename", cxxopts::value(filename))( "m, memo", "Memo to insert into the plot", cxxopts::value(memo))( "i, id", "Unique 32-byte seed for the plot", cxxopts::value(id))( - "e, disablebitfield", "disable bitfield", cxxopts::value(disablebitfield))( + "e, nobitfield", "Disable bitfield", cxxopts::value(nobitfield))( "b, buffer", "Megabytes to be used as buffer for sorting and plotting", cxxopts::value(buffmegabytes))("help", "Print help"); @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) try { num_buckets, num_stripes, num_threads, - disablebitfield); + nobitfield); } else if (operation == "prove") { if (argc < 3) { HelpAndQuit(options); diff --git a/src/plotter_disk.hpp b/src/plotter_disk.hpp index 730fcb1db..85c8ca0c2 100644 --- a/src/plotter_disk.hpp +++ b/src/plotter_disk.hpp @@ -69,7 +69,7 @@ class DiskPlotter { uint32_t num_buckets_input = 0, uint64_t stripe_size_input = 0, uint8_t num_threads_input = 0, - bool disablebitfield = false) + bool nobitfield = false) { // Increases the open file limit, we will open a lot of files. #ifndef _WIN32 @@ -223,7 +223,7 @@ class DiskPlotter { uint64_t finalsize=0; - if(disablebitfield) + if(nobitfield) { // Memory to be used for sorting and buffers std::unique_ptr memory(new uint8_t[memory_size + 7]); diff --git a/tests/test.cpp b/tests/test.cpp index 219720767..9610c2249 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -451,8 +451,8 @@ TEST_CASE("F functions") uint16_t idx_L[10000]; uint16_t idx_R[10000]; - uint32_t idx_count = f2.FindMatches(left_bucket, right_bucket, idx_L, idx_R); - for(uint32_t i=0; i < idx_count; i++) { + int32_t idx_count = f2.FindMatches(left_bucket, right_bucket, idx_L, idx_R); + for(int32_t i=0; i < idx_count; i++) { REQUIRE(CheckMatch(left_bucket[idx_L[i]].y, right_bucket[idx_R[i]].y)); } total_matches += idx_count; diff --git a/tests/test_python_bindings.py b/tests/test_python_bindings.py index 622b311cb..1e413aebe 100644 --- a/tests/test_python_bindings.py +++ b/tests/test_python_bindings.py @@ -58,6 +58,7 @@ def test_k_21(self): 32, 8192, 8, + False, ) pl = None