Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Gringauze <annagrin@microsoft.com>2015-12-14 22:36:20 +0300
committerAnna Gringauze <annagrin@microsoft.com>2015-12-15 07:43:58 +0300
commiteb05256ffe1e76e47d53912eafe223387d0526f3 (patch)
treea5265d5a5e50a4a6bab6809da099a1c08b662105 /tests/string_span_tests.cpp
parentc98e1f34a35087e2d6594a8214f9dc6a80417d8b (diff)
Fixed compilation issues in MSVC 2013
Diffstat (limited to 'tests/string_span_tests.cpp')
-rw-r--r--tests/string_span_tests.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp
index 18fda26..88d125a 100644
--- a/tests/string_span_tests.cpp
+++ b/tests/string_span_tests.cpp
@@ -29,7 +29,6 @@ SUITE(string_span_tests)
TEST(TestLiteralConstruction)
{
cwstring_span<> v = ensure_z(L"Hello");
-
CHECK(5 == v.length());
#ifdef CONFIRM_COMPILATION_ERRORS
@@ -118,6 +117,24 @@ SUITE(string_span_tests)
{
{
cstring_span<> span = "Hello";
+ cstring_span<> span1;
+
+ // comparison to empty span
+ CHECK(span1 != span);
+ CHECK(span != span1);
+ }
+
+ {
+ cstring_span<> span = "Hello";
+ cstring_span<> span1 = "Hello1";
+
+ // comparison to different span
+ CHECK(span1 != span);
+ CHECK(span != span1);
+ }
+
+ {
+ cstring_span<> span = "Hello";
const char ar[] = { 'H', 'e', 'l', 'l', 'o' };
const char ar1[] = "Hello";
@@ -153,9 +170,6 @@ SUITE(string_span_tests)
// comparison to string_span
CHECK(span == span);
-
- // comparison of the original data to string
- CHECK(span.data() == std::string("Hello"));
}
{
@@ -431,6 +445,22 @@ SUITE(string_span_tests)
{
// creating cstring_span
+ // from span of a final extent
+ {
+ span<const char, 6> sp = "Hello";
+ cstring_span<> span = sp;
+ CHECK(span.length() == 6);
+ }
+
+ // from const span of a final extent to non-const string_span
+#ifdef CONFIRM_COMPILATION_ERRORS
+ {
+ span<const char, 6> sp = "Hello";
+ string_span<> span = sp;
+ CHECK(span.length() == 6);
+ }
+#endif
+
// from string temporary
#ifdef CONFIRM_COMPILATION_ERRORS
{
@@ -794,7 +824,7 @@ SUITE(string_span_tests)
TEST(Conversion)
{
-#ifdef CONFIRM_COMPPILATION_ERRORS
+#ifdef CONFIRM_COMPILATION_ERRORS
cstring_span<> span = "Hello";
cwstring_span<> wspan{ span };
CHECK(wspan.length() == 5);