first commit
This commit is contained in:
commit
5893b00dd2
1669 changed files with 1982740 additions and 0 deletions
19
libraries/M5Utility/test/expected/assertions.cpp
Normal file
19
libraries/M5Utility/test/expected/assertions.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <gtest/gtest.h>
|
||||
// #include <stdexcept>
|
||||
|
||||
// #define TL_ASSERT(cond) if (!(cond)) { throw std::runtime_error(std::string("assertion failure")); }
|
||||
|
||||
#include <m5_utility/stl/expected.hpp>
|
||||
#if 0
|
||||
TEST(Expected, Assertions) {
|
||||
m5::stl::expected<int,int> o1 = 42;
|
||||
EXPECT_ANY_THROW(o1.error());
|
||||
|
||||
m5::stl::expected<int,int> o2 {m5::stl::unexpect, 0};
|
||||
EXPECT_ANY_THROW(*o2);
|
||||
|
||||
struct foo { int bar; };
|
||||
m5::stl::expected<struct foo,int> o3 {m5::stl::unexpect, 0};
|
||||
EXPECT_ANY_THROW(o3->bar);
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue