diff options
author | David Robillard <d@drobilla.net> | 2019-04-23 20:55:47 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-23 20:55:47 +0200 |
commit | 66f8ba7f06b9369276e6210f756b075591efa6fa (patch) | |
tree | 6c9601a60226a8e38dd1c227b10fb0e2f06e8d4b /test | |
parent | 045128813d1a69a6483ff2f8f870562b96be0a65 (diff) | |
download | chilbert-66f8ba7f06b9369276e6210f756b075591efa6fa.tar.gz chilbert-66f8ba7f06b9369276e6210f756b075591efa6fa.tar.bz2 chilbert-66f8ba7f06b9369276e6210f756b075591efa6fa.zip |
Support using any array-like type for points
Diffstat (limited to 'test')
-rw-r--r-- | test/bench_hilbert.cpp | 6 | ||||
-rw-r--r-- | test/test_hilbert.cpp | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/test/bench_hilbert.cpp b/test/bench_hilbert.cpp index c5f1ad9..e216efe 100644 --- a/test/bench_hilbert.cpp +++ b/test/bench_hilbert.cpp @@ -33,8 +33,7 @@ struct BenchCoordsToIndex const auto p = make_random_point<M, D>(ctx); H ha = make_zero_bitvec<H, D * M>(); - return run_bench( - [&](auto) { chilbert::coords_to_index(p.data(), M, D, ha); }); + return run_bench([&](auto) { chilbert::coords_to_index(p, M, D, ha); }); } }; @@ -46,8 +45,7 @@ struct BenchIndexToCoords auto p = make_random_point<M, D>(ctx); const H ha = make_random_bitvec<H, D * M>(ctx); - return run_bench( - [&](auto) { chilbert::index_to_coords(p.data(), M, D, ha); }); + return run_bench([&](auto) { chilbert::index_to_coords(p, M, D, ha); }); } }; diff --git a/test/test_hilbert.cpp b/test/test_hilbert.cpp index 1d32668..5d1f52a 100644 --- a/test/test_hilbert.cpp +++ b/test/test_hilbert.cpp @@ -92,12 +92,12 @@ test_standard(Context& ctx) H ha = make_zero_bitvec<H, D * M>(); assert(ha.size() >= D * M); - chilbert::coords_to_index(pa.data(), M, D, ha); + chilbert::coords_to_index(pa, M, D, ha); { // Ensure unmapping results in the original point auto pa_out = make_random_point<M, D>(ctx); - chilbert::index_to_coords(pa_out.data(), M, D, ha); + chilbert::index_to_coords(pa_out, M, D, ha); assert(pa_out == pa); } @@ -110,7 +110,7 @@ test_standard(Context& ctx) // Unmap next hilbert index to a point auto pb = make_random_point<M, D>(ctx); - chilbert::index_to_coords(pb.data(), M, D, hb); + chilbert::index_to_coords(pb, M, D, hb); // Ensure next point is 1 unit of distance away from first assert(squared_distance(pa, pb) == 1); @@ -128,12 +128,12 @@ test_compact(Context& ctx) T ha = make_zero_bitvec<T, D * M>(); assert(ha.size() >= D * M); - chilbert::coords_to_compact_index(pa.data(), ms.data(), D, ha); + chilbert::coords_to_compact_index(pa, ms.data(), D, ha); { // Ensure unmapping results in the original point auto pa_out = make_random_point<M, D>(ctx); - chilbert::compact_index_to_coords(pa_out.data(), ms.data(), D, ha); + chilbert::compact_index_to_coords(pa_out, ms.data(), D, ha); assert(pa_out == pa); } @@ -146,7 +146,7 @@ test_compact(Context& ctx) // Unmap next hilbert index to a point auto pb = make_random_point<M, D>(ctx); - chilbert::compact_index_to_coords(pb.data(), ms.data(), D, hb); + chilbert::compact_index_to_coords(pb, ms.data(), D, hb); // Ensure next point is 1 unit of distance away from first assert(squared_distance(pa, pb) == 1); |