From a141c401f78467bc15f62882fca5d55a007cacbb Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 17 Feb 2025 00:21:48 +0100 Subject: Reorganize everything --- asl/tests/status_or_tests.cpp | 84 ------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 asl/tests/status_or_tests.cpp (limited to 'asl/tests/status_or_tests.cpp') diff --git a/asl/tests/status_or_tests.cpp b/asl/tests/status_or_tests.cpp deleted file mode 100644 index 2f3f475..0000000 --- a/asl/tests/status_or_tests.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "asl/status_or.hpp" -#include "asl/testing/testing.hpp" -#include "asl/tests/test_types.hpp" - -static_assert(asl::copyable>); -static_assert(asl::moveable>); - -static_assert(asl::copyable>); -static_assert(asl::moveable>); - -static_assert(!asl::copyable>); -static_assert(asl::moveable>); - -static_assert(!asl::copyable>); -static_assert(!asl::moveable>); - -ASL_TEST(ok) -{ - asl::status_or s = 6; - ASL_TEST_EXPECT(s.ok()); - ASL_TEST_EXPECT(s.code() == asl::status_code::ok); -} - -ASL_TEST(from_status) -{ - asl::status_or s = asl::internal_error(); - ASL_TEST_EXPECT(!s.ok()); - ASL_TEST_EXPECT(s.code() == asl::status_code::internal); - ASL_TEST_EXPECT(s.message() == ""_sv); - - asl::status_or s2 = asl::internal_error("oh no"); - ASL_TEST_EXPECT(!s2.ok()); - ASL_TEST_EXPECT(s2.code() == asl::status_code::internal); - ASL_TEST_EXPECT(s2.message() == "oh no"_sv); - - asl::status_or s3 = asl::internal_error("{} {}", 1, 2); - ASL_TEST_EXPECT(!s3.ok()); - ASL_TEST_EXPECT(s3.code() == asl::status_code::internal); - ASL_TEST_EXPECT(s3.message() == "1 2"_sv); -} - -ASL_TEST(destructor) -{ - bool d = false; - - { - asl::status_or s{&d}; - ASL_TEST_EXPECT(s.ok()); - ASL_TEST_EXPECT(!d); - - asl::status_or s2 = ASL_MOVE(s); - ASL_TEST_EXPECT(s.ok()); - ASL_TEST_EXPECT(!d); - - s = ASL_MOVE(s2); - ASL_TEST_EXPECT(s.ok()); - ASL_TEST_EXPECT(!d); - } - - ASL_TEST_EXPECT(d); -} - -ASL_TEST(copy) -{ - asl::status_or s = 7; - asl::status_or s2 = s; - s = s2; - - ASL_TEST_EXPECT(s.ok()); - ASL_TEST_EXPECT(s2.ok()); - - ASL_TEST_EXPECT(s.value() == 7); - ASL_TEST_EXPECT(s2.value() == 7); -} - -ASL_TEST(value_or) -{ - asl::status_or s = 7; - asl::status_or s2 = asl::internal_error(); - - ASL_TEST_EXPECT(s.value_or(45) == 7); - ASL_TEST_EXPECT(s2.value_or(45) == 45); -} - -- cgit