forked from microsoft/GraphEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringTest.cpp
More file actions
38 lines (31 loc) · 736 Bytes
/
StringTest.cpp
File metadata and controls
38 lines (31 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#define CATCH_CONFIG_MAIN
#include "catch_wrapper.hpp"
#include <Trinity.h>
#include <Trinity/String.h>
#include <Trinity/Array.h>
using namespace Trinity;
TEST_CASE("Replace works", "[string]")
{
String s, t;
s.Replace("/", "\\");
s = "aaafffddwwwfvbbb";
t = s;
t.Replace("a", "c");
REQUIRE(String("cccfffddwwwfvbbb") == t);
}
TEST_CASE("ToWCharArray works", "[string]")
{
String s = "123";
s.Clear();
auto x = s.ToWcharArray();
#if defined(TRINITY_PLATFORM_WINDOWS)
auto p = L"";
REQUIRE(0 == wcscmp(x, p));
#endif
//TODO when wchar_t is u32char..
}
TEST_CASE("FromWCharArray works", "[string]")
{
Array<u16char> x(0);
REQUIRE(String("") == String::FromWcharArray(x));
}