mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-04 01:00:39 +08:00
26 lines
788 B
C++
26 lines
788 B
C++
#include <catch2/catch.hpp>
|
|
#include <libslic3r/SLA/SupportIslands/VectorUtils.hpp>
|
|
|
|
using namespace Slic3r::sla;
|
|
|
|
TEST_CASE("Reorder", "[Utils], [VectorUtils]")
|
|
{
|
|
std::vector<int> data{0, 1, 3, 2, 4, 7, 6, 5, 8};
|
|
std::vector<int> order{0, 1, 3, 2, 4, 7, 6, 5, 8};
|
|
|
|
VectorUtils::reorder(order.begin(), order.end(), data.begin());
|
|
for (size_t i = 0; i < data.size() - 1; ++i) {
|
|
CHECK(data[i] < data[i + 1]);
|
|
}
|
|
}
|
|
|
|
TEST_CASE("Reorder destructive", "[Utils], [VectorUtils]"){
|
|
std::vector<int> data {0, 1, 3, 2, 4, 7, 6, 5, 8};
|
|
std::vector<int> order{0, 1, 3, 2, 4, 7, 6, 5, 8};
|
|
|
|
VectorUtils::reorder_destructive(order.begin(), order.end(), data.begin());
|
|
for (size_t i = 0; i < data.size() - 1;++i) {
|
|
CHECK(data[i] < data[i + 1]);
|
|
}
|
|
}
|