added tests for erase()

This commit is contained in:
Patrick 2024-07-29 17:23:01 +02:00
parent 9cbeacef21
commit c2d828cfb9
1 changed files with 26 additions and 0 deletions

View File

@ -269,6 +269,32 @@ constexpr test_suite tests = define_tests("Data Augmentation")
return TEST_PASS();
}), 2, int, char, const char *, TestObj);
return TEST_PASS();
}, EvalFlag::RUNTIME_CONSTEVAL)
("const_vector::erase()", []() constexpr {
REPEAT_FOR_TYPES_N(([]<typename T, std::size_t N, typename ctx>() constexpr {
cc::const_vector v = get_test_param<ctx, "arr">();
ASSERT(v.erase(std::next(v.begin())) == std::next(v.begin()), ctx);
ASSERT(v.erase(std::next(v.begin()), v.end()) == v.end(), ctx);
ASSERT(v.erase(v.begin(), v.begin()) == v.begin(), ctx);
std::vector<T> comparable;
std::ranges::copy(get_test_param<ctx, "arr">(), std::back_inserter(comparable));
comparable.erase(std::next(comparable.begin()));
comparable.erase(std::next(comparable.begin()), comparable.end());
comparable.erase(comparable.begin(), comparable.begin());
ASSERT(std::ranges::equal(v, comparable), ctx);
return TEST_PASS();
}), 2, int, char, const char *, TestObj);
return TEST_PASS();
}, EvalFlag::RUNTIME_CONSTEVAL);