From 206af7e51ac8fe73344381c33c5030f94c37f3bb Mon Sep 17 00:00:00 2001 From: Chuyue Sun Date: Fri, 2 Aug 2024 18:18:26 +0000 Subject: [PATCH] fix permutation tests --- src/test/permutation.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/permutation.cpp b/src/test/permutation.cpp index 1592a2f45..aeaa5a235 100644 --- a/src/test/permutation.cpp +++ b/src/test/permutation.cpp @@ -4,7 +4,7 @@ #include "util/util.h" #include "util/debug.h" -static void swap(unsigned m1, unsigned m2) noexcept { std::swap(m1, m2); } + void swap(unsigned m1, unsigned m2) noexcept { std::swap(m1, m2); } static void test_constructor() { permutation p(5); @@ -43,6 +43,12 @@ static void test_move_after() { SASSERT(p(4) == 4); } +void apply_permutation_copy(unsigned sz, unsigned const * src, unsigned const * p, unsigned * target) { + for (unsigned i = 0; i < sz; i++) { + target[i] = src[p[i]]; + } +} + static void test_apply_permutation(unsigned sz, unsigned num_tries, unsigned max = UINT_MAX) { unsigned_vector data; unsigned_vector p;