summaryrefslogtreecommitdiffstats
path: root/tests/wirs_tests.cpp
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-05-29 16:49:52 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-05-29 16:49:52 -0400
commite47410d56c667cda9f8070a929df7a955ce13115 (patch)
tree01ad4baa9869ad07ad6e6f4548de974c28ded301 /tests/wirs_tests.cpp
parentab14529843d7bbb3a0d0c30b163ed444afee04ed (diff)
downloaddynamic-extension-e47410d56c667cda9f8070a929df7a955ce13115.tar.gz
Framework-level query testing + fixes
Diffstat (limited to 'tests/wirs_tests.cpp')
-rw-r--r--tests/wirs_tests.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/wirs_tests.cpp b/tests/wirs_tests.cpp
index 0a9b1d0..32cb863 100644
--- a/tests/wirs_tests.cpp
+++ b/tests/wirs_tests.cpp
@@ -268,10 +268,14 @@ START_TEST(t_wirs_buffer_query_rejection)
wirs_query_parms<WRec> parms = {lower_key, upper_key, k};
parms.rng = gsl_rng_alloc(gsl_rng_mt19937);
+ size_t total_samples = 0;
+
for (size_t i=0; i<1000; i++) {
auto state = WIRSQuery<WRec>::get_buffer_query_state(buffer, &parms);
auto result = WIRSQuery<WRec>::buffer_query(buffer, state, &parms);
+ total_samples += result.size();
+
for (size_t j=0; j<result.size(); j++) {
cnt[result[j].rec.key - 1]++;
}
@@ -279,9 +283,9 @@ START_TEST(t_wirs_buffer_query_rejection)
WIRSQuery<WRec>::delete_buffer_query_state(state);
}
- ck_assert(roughly_equal(cnt[0] / 1000, (double) k/4.0, k, .05));
- ck_assert(roughly_equal(cnt[1] / 1000, (double) k/4.0, k, .05));
- ck_assert(roughly_equal(cnt[2] / 1000, (double) k/2.0, k, .05));
+ ck_assert(roughly_equal(cnt[0] / total_samples, (double) k/4.0, k, .05));
+ ck_assert(roughly_equal(cnt[1] / total_samples, (double) k/4.0, k, .05));
+ ck_assert(roughly_equal(cnt[2] / total_samples, (double) k/2.0, k, .05));
gsl_rng_free(parms.rng);
delete buffer;