29 lines
731 B
C++
29 lines
731 B
C++
// @requires-reflection
|
|
#include <Void/Testing/Assert.hpp>
|
|
#include <Void/Testing/Suite.hpp>
|
|
|
|
#include <vector>
|
|
|
|
namespace
|
|
{
|
|
using Void::Testing::Test;
|
|
|
|
// setup()/teardown() run around each test method (a fresh instance per
|
|
// test), exactly like the old Fixture base — but discovered by reflection.
|
|
struct ContainerFixture : Void::Testing::Suite<ContainerFixture> {
|
|
std::vector<int> vec;
|
|
|
|
void setup() { vec = {1, 2, 3}; }
|
|
void teardown() { vec.clear(); }
|
|
|
|
Test size() { Void::Testing::expect_eq(vec.size(), 3u); }
|
|
|
|
[[= Void::Testing::tag("slow")]] Test push_back()
|
|
{
|
|
vec.push_back(4);
|
|
Void::Testing::expect_eq(vec.size(), 4u);
|
|
Void::Testing::expect_eq(vec.back(), 4);
|
|
}
|
|
};
|
|
} // namespace
|