You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
931 B
46 lines
931 B
#include <fmt/core.h>
|
|
#include <deque>
|
|
#include <string>
|
|
#include <fuc2.hpp>
|
|
|
|
namespace sample_failing {
|
|
using namespace fuc2;
|
|
|
|
void fail_push_pop_back() {
|
|
std::deque<int> ages;
|
|
|
|
for(int i = 0; i < 5; i++) {
|
|
ages.push_back(i * 34);
|
|
}
|
|
|
|
CHECK(ages.size() == 5, "wrong count");
|
|
|
|
for(int i = 0; i < 5; i++) {
|
|
ages.pop_back();
|
|
fmt::println("count: {}", ages.size());
|
|
}
|
|
|
|
EQUAL(ages.size(), size_t(0), "wrong count");
|
|
// THIS FAILS
|
|
EQUAL(ages.size(), size_t(5), "wrong count");
|
|
}
|
|
|
|
void fail_blows_up() {
|
|
std::deque<float> ages;
|
|
|
|
auto runner = [&]() {
|
|
fmt::println("this will fail.");
|
|
};
|
|
|
|
BLOWS_UP(runner, "pop_front empty should crash");
|
|
}
|
|
|
|
fuc2::Set TESTS{
|
|
.name="std::deque failing ops",
|
|
.options={ .fail_fast=false },
|
|
.tests={
|
|
{"fail_pop_back", fail_push_pop_back},
|
|
{"fail_blows_up", fail_blows_up},
|
|
}
|
|
};
|
|
}
|
|
|