Commit 992d7281 authored by Philip Trettner's avatar Philip Trettner

added random test for smart ranges

parent 193b63a4
Pipeline #12964 passed with stage
in 7 minutes and 21 seconds
Subproject commit 604639239f867fe988208d370aa1f539981a2314
Subproject commit ff9d62f23951321f745d5cb1951619575cd33186
Subproject commit d4a99aa8042748c47c56a72153ac745d1f3b964d
Subproject commit 36c49b6dd7d1d4dd96a198541f77882e18741cf5
Subproject commit ffcf1fc63b254faa9859b2a5c1fe78d24d1fb2fc
Subproject commit cd854b8aa5ef310f6aa5a530051bbec62d36d07f
#include <doctest.hh>
#include <map>
#include <polymesh/Mesh.hh>
#include <polymesh/algorithms/properties.hh>
#include <polymesh/objects/cube.hh>
......@@ -55,3 +57,21 @@ TEST_CASE("Ranges.Basics")
pos = m.vertices().map([&](pm::vertex_handle v) { return v.adjacent_vertices().avg(pos); });
}
TEST_CASE("Ranges.Random")
{
pm::Mesh m;
auto pos = m.vertices().make_attribute<tg::pos3>();
pm::objects::add_cube(m, pos);
tg::rng rng;
auto f = m.faces().random(rng);
std::map<pm::vertex_index, int> cnts;
auto cnt = 10000;
for (auto i = 0; i < cnt; ++i)
cnts[f.vertices().random(rng)]++;
for (auto const& kvp : cnts)
CHECK(kvp.second >= cnt / 4 * 0.9);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment