From e47410d56c667cda9f8070a929df7a955ce13115 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 29 May 2023 16:49:52 -0400 Subject: Framework-level query testing + fixes --- tests/wirs_tests.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/wirs_tests.cpp') 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 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::get_buffer_query_state(buffer, &parms); auto result = WIRSQuery::buffer_query(buffer, state, &parms); + total_samples += result.size(); + for (size_t j=0; j::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; -- cgit v1.2.3