Files
Library/tests/standalone/Testing/NativeRegistration.cpp

46 lines
1.1 KiB
C++

#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Detail/Registry.hpp>
#include <Void/Testing/Test.hpp>
#include <string>
namespace void_testing_native_test
{
struct CounterFixture {
int value{0};
void setup() { value = 41; }
void teardown() { value = 0; }
};
} // namespace void_testing_native_test
VOID_TEST(NativeApi, self_registers_free_test)
{
Void::Testing::expect_eq(2 + 3, 5);
}
VOID_TEST_TAGGED(NativeApi, tagged_native_test, "fast", "native")
{
const auto& tests = Void::Testing::Detail::Registry::instance().tests();
bool found = false;
for (const auto& t : tests) {
if (t.suite == "NativeApi" && t.name == "tagged_native_test") {
found = (t.tags.size() == 2U && t.tags[0] == "fast" &&
t.tags[1] == "native");
break;
}
}
Void::Testing::expect(found);
}
VOID_TEST_DISABLED(NativeApi, disabled_native_test, "intentional skip check")
{
Void::Testing::expect(false);
}
VOID_TEST_FIXTURE(void_testing_native_test::CounterFixture,
fixture_runs_setup_hook)
{
Void::Testing::expect_eq(fixture.value, 41);
fixture.value += 1;
Void::Testing::expect_eq(fixture.value, 42);
}