Initial Course
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#include "expected.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Expected, ParseInt) {
|
||||
EXPECT_EQ(*cpp23::parse_int("42"), 42);
|
||||
EXPECT_EQ(cpp23::parse_int(""), std::unexpected(cpp23::ParseError::EmptyInput));
|
||||
}
|
||||
|
||||
TEST(Expected, SafeSqrt) {
|
||||
EXPECT_DOUBLE_EQ(*cpp23::safe_sqrt(9), 3.0);
|
||||
EXPECT_FALSE(cpp23::safe_sqrt(-1).has_value());
|
||||
}
|
||||
|
||||
TEST(Expected, ChainParseAndDouble) {
|
||||
EXPECT_EQ(*cpp23::chain_parse_and_double("21"), 42);
|
||||
}
|
||||
Reference in New Issue
Block a user