This commit is contained in:
24
tests/s0008_string_to_integer.cpp
Normal file
24
tests/s0008_string_to_integer.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "s0008_string_to_integer.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Problem8, Case1) {
|
||||
string i = std::string("42");
|
||||
int o = 42;
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.myAtoi(i), o);
|
||||
}
|
||||
|
||||
TEST(Problem8, Case2) {
|
||||
string i = std::string(" -42");
|
||||
int o = -42;
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.myAtoi(i), o);
|
||||
}
|
||||
|
||||
TEST(Problem8, Case3) {
|
||||
string i = std::string("4193 with words");
|
||||
int o = 4193;
|
||||
Solution solution;
|
||||
EXPECT_EQ(solution.myAtoi(i), o);
|
||||
}
|
Reference in New Issue
Block a user