-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43ce4fa
commit 4875877
Showing
5 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <string> | ||
#include <string_view> | ||
|
||
#include "gtest/gtest.h" | ||
#include "stomfoolery.hpp" | ||
|
||
using namespace std::string_literals; | ||
|
||
const std::vector<std::string> simple_strs_empty_start{{""s}, {"a"s}, {"b"s}, {"c"s}, {"d"s}, {"e"s}}; | ||
const std::vector<std::string> simple_strs{{"a"s}, {"b"s}, {"c"s}, {"d"s}, {"e"s}}; | ||
const std::string simple_str_empty_separator{"abcde"s}; | ||
const std::string simple_str_underscore{"a b c\td\n \t\n\re"s}; | ||
|
||
const std::regex empty_regex{""}; | ||
const std::regex whitespaces{R"(\s+)"}; | ||
|
||
// Normal cases | ||
TEST(TestSplitByRegex, SimpleStringsEmptySeparator) { | ||
EXPECT_EQ(stomfoolery::split(simple_str_empty_separator, empty_regex), simple_strs_empty_start); | ||
} | ||
|
||
TEST(TestSplitByRegex, SimpleStringsEmptySeparatorOperator) { | ||
EXPECT_EQ(simple_str_empty_separator / empty_regex, simple_strs_empty_start); | ||
} | ||
|
||
TEST(TestSplitByRegex, SimpleStringsWhitespaces) { | ||
EXPECT_EQ(stomfoolery::split(simple_str_underscore, whitespaces), simple_strs); | ||
} | ||
|
||
TEST(TestSplitByRegex, SimpleStringsWhitespacesOperator) { | ||
EXPECT_EQ(simple_str_underscore / whitespaces, simple_strs); | ||
} | ||
|
||
// Edge cases |