From 6d1bb807f3a8e39edeb5faadd701ee44a89bceb0 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Fri, 16 Sep 2022 13:09:49 -0400 Subject: [PATCH] remove invalid benchmarks --- tc/src/groups.cpp | 8 ++++++++ tc/test/test_solve.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tc/src/groups.cpp b/tc/src/groups.cpp index f327fe0..5004f4e 100644 --- a/tc/src/groups.cpp +++ b/tc/src/groups.cpp @@ -25,6 +25,10 @@ namespace tc { } Group D(const int dim) { + if (dim <= 2) { + throw std::runtime_error("tc::group::D requires dim > 2."); + } + std::vector mults(dim - 1, 3); mults[dim - 2] = 2; @@ -35,6 +39,10 @@ namespace tc { } Group E(const int dim) { + if (dim <= 3) { + throw std::runtime_error("tc::group::E requires dim > 3."); + } + std::vector mults(dim - 1, 3); mults[dim - 2] = 2; diff --git a/tc/test/test_solve.cpp b/tc/test/test_solve.cpp index 9a1b4cc..3cc4f5f 100644 --- a/tc/test/test_solve.cpp +++ b/tc/test/test_solve.cpp @@ -25,7 +25,8 @@ testing::AssertionResult AssertSolveOrder( auto cosets_per_sec = (double) actual_order / total_sec; bool order_good = actual_order == expected_order; - bool speed_good = cosets_per_sec >= MIN_COS_PER_SEC; + bool speed_good = cosets_per_sec >= MIN_COS_PER_SEC || total_sec < 0.0001; + // extremely short times cause false negatives. ex. A2 can be solved in only 3 clocks. if (order_good && speed_good) { return testing::AssertionSuccess(); @@ -38,7 +39,8 @@ testing::AssertionResult AssertSolveOrder( } if (!speed_good) { res << " Solution too slow (" << cosets_per_sec - << " cos/s < " << MIN_COS_PER_SEC << ")."; + << " cos/s < " << MIN_COS_PER_SEC << ")." + << " " << std::fixed << total_sec << " s."; } return res; @@ -87,7 +89,6 @@ TEST(solve, B) { } TEST(solve, D) { - EXPECT_SOLVE_ORDER(D(2), v({}), 4); EXPECT_SOLVE_ORDER(D(3), v({}), 24); EXPECT_SOLVE_ORDER(D(4), v({}), 192); EXPECT_SOLVE_ORDER(D(4), v({0, 1}), 32); @@ -103,7 +104,6 @@ TEST(solve, D) { } TEST(solve, E) { - EXPECT_SOLVE_ORDER(E(3), v({}), 12); EXPECT_SOLVE_ORDER(E(4), v({}), 120); EXPECT_SOLVE_ORDER(E(4), v({2}), 60); EXPECT_SOLVE_ORDER(E(4), v({2, 1}), 20);