Browse Source

- Fixed spaces in plstring docs

- Moved the CRT flag
- removed format tests as plString::format is deprecated.
Anne Marije v/d Meer 10 years ago
parent
commit
eeec4bac56
  1. 12
      Sources/Plasma/CoreLib/plString.h
  2. 1
      Sources/Tests/CMakeLists.txt
  3. 18
      Sources/Tests/CoreTests/test_plString.cpp
  4. 2
      Sources/Tests/gtest-1.6.0/CMakeLists.txt

12
Sources/Plasma/CoreLib/plString.h

@ -532,22 +532,22 @@ public:
/** Inverse of operator==(const plString &) const. */
bool operator!=(const plString &other) const { return Compare(other) != 0; }
/** Find the index(in bytes) of the first instance of \a ch in this string.
/** Find the index (in bytes) of the first instance of \a ch in this string.
* \return -1 if the character was not found.
*/
ssize_t Find(char ch, CaseSensitivity sense = kCaseSensitive) const;
/** Find the index(in bytes) of the last instance of \a ch in this string.
/** Find the index (in bytes) of the last instance of \a ch in this string.
* \return -1 if the character was not found.
*/
ssize_t FindLast(char ch, CaseSensitivity sense = kCaseSensitive) const;
/** Find the index(in bytes) of the first instance of \a str in this string.
/** Find the index (in bytes) of the first instance of \a str in this string.
* \return -1 if the substring was not found.
*/
ssize_t Find(const char *str, CaseSensitivity sense = kCaseSensitive) const;
/** Find the index(in bytes) of the first instance of \a str in this string.
/** Find the index (in bytes) of the first instance of \a str in this string.
* \return -1 if the substring was not found.
*/
ssize_t Find(const plString &str, CaseSensitivity sense = kCaseSensitive) const
@ -583,8 +583,8 @@ public:
*/
plString Trim(const char *charset = WHITESPACE_CHARS) const;
/** Return a substring starting at index(in bytes) \a start, with up to \a size
* characters(in bytes) from the start position. If \a size is greater than the
/** Return a substring starting at index (in bytes) \a start, with up to \a size
* characters (in bytes) from the start position. If \a size is greater than the
* number of characters left in the string after \a start, Substr will
* return the remainder of the string.
*/

1
Sources/Tests/CMakeLists.txt

@ -1,3 +1,4 @@
set(gtest_force_shared_crt ON CACHE INTERNAL "don't link the CRT statically into gtest as we later link the test executable dynamically")
add_subdirectory(gtest-1.6.0)
add_subdirectory(CoreTests)

18
Sources/Tests/CoreTests/test_plString.cpp

@ -30,24 +30,6 @@ TEST(PlStringTest,ToIso8859_1)
EXPECT_STREQ(expected.GetData(),output.GetData());
}
TEST(PlStringTest,Format)
{
//string <256 characters
plString expected1 = plString("abcd3");
plString output1 = plString::Format("a%c%s%d",'b',"cd",3);
EXPECT_EQ(expected1,output1);
//string == 256 characters
plString expected2 = plString("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elit erat, ornare vitae dictum non, accumsan nec orci. Pellentesque vel lectus magna, nec fermentum leo. Vestibulum venenatis sapien sit amet diam luctus laoreet. Integer accumsan iaculis amet.");
plString output2 = plString::Format("Lorem %s dolor sit amet, consectetur adipiscing elit. %s elit erat, ornare vitae dictum non, accumsan nec orci. Pellentesque vel lectus magna, nec fermentum leo. Vestibulum venenatis sapien sit amet diam luctus laoreet. Integer accumsan %s amet.","ipsum","Morbi","iaculis");
EXPECT_EQ(expected2,output2);
//string >256 characters
plString expected3 = plString("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur blandit iaculis metus eu gravida. Nulla ut lorem et tortor aliquam varius. Maecenas sed metus turpis. Mauris molestie velit aliquam felis suscipit egestas. Duis id arcu eget velit facilisis varius vitae ac neque. Quisque dapibus sed.");
plString output3 = plString::Format("Lorem ipsum dolor sit amet, %s adipiscing elit. Curabitur blandit iaculis metus eu gravida. Nulla ut lorem et tortor aliquam varius. Maecenas sed metus turpis. Mauris molestie velit aliquam felis suscipit %s. %s","consectetur","egestas","Duis id arcu eget velit facilisis varius vitae ac neque. Quisque dapibus sed.");
EXPECT_EQ(expected3,output3);
}
TEST(PlStringTest,FindChar)
{
plString input = plString("abCdcBAeab");

2
Sources/Tests/gtest-1.6.0/CMakeLists.txt

@ -14,7 +14,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
option(
gtest_force_shared_crt
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
ON)
OFF)
option(gtest_build_tests "Build all of gtest's own tests." OFF)

Loading…
Cancel
Save