Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a string::ILess functor for case-insensitive containers
Replace about 8 separate implementations of a std::less functor using string_compare_nocase() with a single functor defined in string.h itself. This is covered by tests in a new BasicTest suite which can be used for testing simple core functions which do not require the construction of a complete Radiant environment.
- Loading branch information
Matthew Mott
committed
Mar 3, 2021
1 parent
acc606c
commit 258ad42
Showing
12 changed files
with
65 additions
and
89 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 was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
/** | ||
* Tests for basic library functions (such as string comparison) which do not | ||
* require an actual Radiant environment. | ||
*/ | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "string/string.h" | ||
|
||
namespace test | ||
{ | ||
|
||
TEST(BasicTest, StringCompareNoCase) | ||
{ | ||
EXPECT_EQ(string_compare_nocase("blah", "blah"), 0); | ||
EXPECT_EQ(string_compare_nocase("blah", "BLAH"), 0); | ||
EXPECT_EQ(string_compare_nocase("MiXeD", "mIxED"), 0); | ||
|
||
EXPECT_EQ(string_compare_nocase("a", "b"), -1); | ||
EXPECT_EQ(string_compare_nocase("b", "a"), 1); | ||
EXPECT_EQ(string_compare_nocase("baaaaa", "aaaaa"), 1); | ||
} | ||
|
||
TEST(BasicTest, StringILessFunctor) | ||
{ | ||
string::ILess less; | ||
|
||
EXPECT_TRUE(!less("blah", "BLAH")); | ||
EXPECT_TRUE(!less("BLAH", "blah")); | ||
|
||
EXPECT_TRUE(less("blah", "BLEH")); | ||
EXPECT_TRUE(!less("BLEH", "blah")); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
add_executable(drtest | ||
Basic.cpp | ||
Camera.cpp | ||
ColourSchemes.cpp | ||
CSG.cpp | ||
|