|
|
|
@ -5,7 +5,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
using namespace fuc2; |
|
|
|
using namespace fuc2; |
|
|
|
|
|
|
|
|
|
|
|
void test_push_pop_back() { |
|
|
|
|
|
|
|
|
|
|
|
namespace sample1 { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_push_pop_back() { |
|
|
|
std::deque<int> ages; |
|
|
|
std::deque<int> ages; |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < 5; i++) { |
|
|
|
for(int i = 0; i < 5; i++) { |
|
|
|
@ -21,9 +24,9 @@ void test_push_pop_back() { |
|
|
|
|
|
|
|
|
|
|
|
EQUAL(ages.size(), size_t(0), "wrong count"); |
|
|
|
EQUAL(ages.size(), size_t(0), "wrong count"); |
|
|
|
NOT_EQUAL(ages.size(), size_t(5), "wrong count"); |
|
|
|
NOT_EQUAL(ages.size(), size_t(5), "wrong count"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_push_pop_front() { |
|
|
|
void test_push_pop_front() { |
|
|
|
std::deque<float> ages; |
|
|
|
std::deque<float> ages; |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < 5; i++) { |
|
|
|
for(int i = 0; i < 5; i++) { |
|
|
|
@ -37,10 +40,10 @@ void test_push_pop_front() { |
|
|
|
fmt::println("count: {}", ages.size()); |
|
|
|
fmt::println("count: {}", ages.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
NOT_EQUAL(ages.size(), size_t(0), "wrong count"); |
|
|
|
EQUAL(ages.size(), size_t(0), "wrong count"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_push_blows_up() { |
|
|
|
void test_push_blows_up() { |
|
|
|
std::deque<float> ages; |
|
|
|
std::deque<float> ages; |
|
|
|
|
|
|
|
|
|
|
|
auto runner = [&]() { |
|
|
|
auto runner = [&]() { |
|
|
|
@ -51,10 +54,10 @@ void test_push_blows_up() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
BLOWS_UP(runner, "pop_front empty should crash"); |
|
|
|
BLOWS_UP(runner, "pop_front empty should crash"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) { |
|
|
|
|
|
|
|
return run({ |
|
|
|
fuc2::Set TESTS{ |
|
|
|
.name="std::deque basic operations", |
|
|
|
.name="std::deque basic operations", |
|
|
|
.options={ .fail_fast=false }, |
|
|
|
.options={ .fail_fast=false }, |
|
|
|
.tests={ |
|
|
|
.tests={ |
|
|
|
@ -62,5 +65,5 @@ int main(int argc, char* argv[]) { |
|
|
|
{"push_pop_front", test_push_pop_front}, |
|
|
|
{"push_pop_front", test_push_pop_front}, |
|
|
|
{"push_blows_up", test_push_blows_up}, |
|
|
|
{"push_blows_up", test_push_blows_up}, |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|