From 8c95db33be58a545dd2e030428bded0bd958c4b6 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Wed, 16 Oct 2024 22:54:34 +0200 Subject: Start work on the testing framework --- asl/testing/BUILD.bazel | 13 +++++++++++++ asl/testing/testing.cpp | 14 ++++++++++++++ asl/testing/testing.hpp | 15 +++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 asl/testing/BUILD.bazel create mode 100644 asl/testing/testing.cpp create mode 100644 asl/testing/testing.hpp (limited to 'asl/testing') diff --git a/asl/testing/BUILD.bazel b/asl/testing/BUILD.bazel new file mode 100644 index 0000000..2942073 --- /dev/null +++ b/asl/testing/BUILD.bazel @@ -0,0 +1,13 @@ +cc_library( + name = "testing", + hdrs = [ + "testing.hpp", + ], + srcs = [ + "testing.cpp", + ], + deps = [ + "//asl", + ], + visibility = ["//visibility:public"], +) diff --git a/asl/testing/testing.cpp b/asl/testing/testing.cpp new file mode 100644 index 0000000..a2fe152 --- /dev/null +++ b/asl/testing/testing.cpp @@ -0,0 +1,14 @@ +#include "asl/testing/testing.hpp" + +int asl::testing::register_test( + const char* suite_name, + const char* case_name, + TestFunction* fn) +{ + return 0; +} + +int main(int argc, char* argv[]) +{ + return 0; +} diff --git a/asl/testing/testing.hpp b/asl/testing/testing.hpp new file mode 100644 index 0000000..a489d61 --- /dev/null +++ b/asl/testing/testing.hpp @@ -0,0 +1,15 @@ +#pragma once + +namespace asl::testing +{ + +using TestFunction = void(); +int register_test(const char* suite_name, const char* case_name, TestFunction* fn); + +} // namespace asl::testing + +#define ASL_TEST(SUITE, CASE) \ + static void asl_test_fn_##SUITE##_##CASE(); \ + static const int asl_test_##SUITE##_##CASE = ::asl::testing::register_test( \ + #SUITE, #CASE, asl_test_fn_##SUITE##_##CASE); \ + void asl_test_fn_##SUITE##_##CASE() -- cgit