Start work on the testing framework
This commit is contained in:
1
.bazelrc
1
.bazelrc
@ -15,5 +15,6 @@ build --cxxopt=-Wno-unused-macros
|
|||||||
build --cxxopt=-Wno-documentation-unknown-command
|
build --cxxopt=-Wno-documentation-unknown-command
|
||||||
build --cxxopt=-Wno-extra-semi-stmt
|
build --cxxopt=-Wno-extra-semi-stmt
|
||||||
build --cxxopt=-Wno-extra-semi
|
build --cxxopt=-Wno-extra-semi
|
||||||
|
build --cxxopt=-Wno-global-constructors
|
||||||
|
|
||||||
test --test_output=errors
|
test --test_output=errors
|
||||||
|
@ -24,11 +24,12 @@ cc_library(
|
|||||||
[cc_test(
|
[cc_test(
|
||||||
name = "%s_tests" % name,
|
name = "%s_tests" % name,
|
||||||
srcs = [
|
srcs = [
|
||||||
"%s_tests.cpp" % name,
|
"tests/%s_tests.cpp" % name,
|
||||||
"test_types.hpp",
|
"tests/test_types.hpp",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":asl",
|
":asl",
|
||||||
|
"//asl/testing",
|
||||||
],
|
],
|
||||||
) for name in [
|
) for name in [
|
||||||
"format",
|
"format",
|
||||||
|
13
asl/testing/BUILD.bazel
Normal file
13
asl/testing/BUILD.bazel
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
cc_library(
|
||||||
|
name = "testing",
|
||||||
|
hdrs = [
|
||||||
|
"testing.hpp",
|
||||||
|
],
|
||||||
|
srcs = [
|
||||||
|
"testing.cpp",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//asl",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
14
asl/testing/testing.cpp
Normal file
14
asl/testing/testing.cpp
Normal file
@ -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;
|
||||||
|
}
|
15
asl/testing/testing.hpp
Normal file
15
asl/testing/testing.hpp
Normal file
@ -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()
|
@ -33,7 +33,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main2()
|
||||||
{
|
{
|
||||||
StringSink sink;
|
StringSink sink;
|
||||||
|
|
@ -9,5 +9,3 @@ static_assert(sizeof(uint8_t) == 1);
|
|||||||
static_assert(sizeof(uint16_t) == 2);
|
static_assert(sizeof(uint16_t) == 2);
|
||||||
static_assert(sizeof(uint32_t) == 4);
|
static_assert(sizeof(uint32_t) == 4);
|
||||||
static_assert(sizeof(uint64_t) == 8);
|
static_assert(sizeof(uint64_t) == 8);
|
||||||
|
|
||||||
int main() { return 0; }
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "asl/maybe_uninit.hpp"
|
#include "asl/maybe_uninit.hpp"
|
||||||
#include "asl/test_types.hpp"
|
#include "asl/tests/test_types.hpp"
|
||||||
|
|
||||||
static_assert(asl::layout::of<int>() == asl::layout::of<asl::maybe_uninit<int>>());
|
static_assert(asl::layout::of<int>() == asl::layout::of<asl::maybe_uninit<int>>());
|
||||||
static_assert(asl::size_of<int> == asl::size_of<asl::maybe_uninit<int>>);
|
static_assert(asl::size_of<int> == asl::size_of<asl::maybe_uninit<int>>);
|
||||||
@ -8,7 +8,3 @@ static_assert(asl::align_of<int> == asl::align_of<asl::maybe_uninit<int>>);
|
|||||||
static_assert(asl::trivially_destructible<asl::maybe_uninit<TriviallyDestructible>>);
|
static_assert(asl::trivially_destructible<asl::maybe_uninit<TriviallyDestructible>>);
|
||||||
static_assert(!asl::trivially_destructible<asl::maybe_uninit<HasDestructor>>);
|
static_assert(!asl::trivially_destructible<asl::maybe_uninit<HasDestructor>>);
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "asl/meta.hpp"
|
#include "asl/meta.hpp"
|
||||||
#include "asl/test_types.hpp"
|
#include "asl/tests/test_types.hpp"
|
||||||
|
|
||||||
struct Struct {};
|
struct Struct {};
|
||||||
union Union {};
|
union Union {};
|
||||||
@ -168,5 +168,3 @@ static_assert(!asl::trivially_copyable<HasDestructor>);
|
|||||||
static_assert(!asl::trivially_copyable<CopyAssignable>);
|
static_assert(!asl::trivially_copyable<CopyAssignable>);
|
||||||
static_assert(asl::trivially_copyable<DefaultConstructible>);
|
static_assert(asl::trivially_copyable<DefaultConstructible>);
|
||||||
static_assert(asl::trivially_copyable<TriviallyDefaultConstructible>);
|
static_assert(asl::trivially_copyable<TriviallyDefaultConstructible>);
|
||||||
|
|
||||||
int main() { return 0; }
|
|
@ -1,5 +1,6 @@
|
|||||||
#include "asl/option.hpp"
|
#include "asl/option.hpp"
|
||||||
#include "asl/test_types.hpp"
|
#include "asl/tests/test_types.hpp"
|
||||||
|
#include <asl/testing/testing.hpp>
|
||||||
|
|
||||||
static_assert(asl::trivially_destructible<asl::option<TriviallyDestructible>>);
|
static_assert(asl::trivially_destructible<asl::option<TriviallyDestructible>>);
|
||||||
static_assert(!asl::trivially_destructible<asl::option<HasDestructor>>);
|
static_assert(!asl::trivially_destructible<asl::option<HasDestructor>>);
|
||||||
@ -23,12 +24,10 @@ static_assert(asl::move_assignable<asl::option<int>>);
|
|||||||
static_assert(asl::move_assignable<asl::option<CopyAssignable>>);
|
static_assert(asl::move_assignable<asl::option<CopyAssignable>>);
|
||||||
static_assert(!asl::move_assignable<asl::option<NonMoveAssignable>>);
|
static_assert(!asl::move_assignable<asl::option<NonMoveAssignable>>);
|
||||||
|
|
||||||
int main()
|
ASL_TEST(Option, cheese)
|
||||||
{
|
{
|
||||||
asl::option<int> a;
|
asl::option<int> a;
|
||||||
asl::option<int> b;
|
asl::option<int> b;
|
||||||
|
|
||||||
a = ASL_MOVE(b);
|
a = ASL_MOVE(b);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
1
asl/tests/utility_tests.cpp
Normal file
1
asl/tests/utility_tests.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "asl/utility.hpp"
|
@ -1,3 +0,0 @@
|
|||||||
#include "asl/utility.hpp"
|
|
||||||
|
|
||||||
int main() { return 0; }
|
|
Reference in New Issue
Block a user