From d9bba66cc7968d9940e8153023ddb9def065b6c4 Mon Sep 17 00:00:00 2001 From: GAMA Date: Fri, 22 Jan 2021 10:46:36 +0300 Subject: [PATCH 1/2] Test for PIString 11-20 --- tests/core/pistringTest.cpp | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/core/pistringTest.cpp b/tests/core/pistringTest.cpp index 7cb4e7a1..f1ef75f9 100644 --- a/tests/core/pistringTest.cpp +++ b/tests/core/pistringTest.cpp @@ -79,3 +79,71 @@ TEST(PIString_Tests, operator_concatenation_pistring_zero2){ str1 += str2; ASSERT_EQ(str1, "AB C"); } + +TEST(PIString_Tests, operator_concatenation_pistring_zero_zero){ + PIString str1; + PIString str2; + str1 += str2; + ASSERT_EQ(str1, ""); +} + +TEST(PIString_Tests, operator_concatenation_piByteArray){ + PIString str1 = "AB C"; + PIByteArray str2; + str2.append('g'); + str1 += str2; + ASSERT_EQ(str1, "AB Cg"); +} + +TEST(PIString_Tests, operator_concatenation_piByteArray_zero1){ + PIString str1 = ""; + PIByteArray str2; + str2.append('0'); + str1 += str2; + ASSERT_EQ(str1, "0"); +} + +TEST(PIString_Tests, operator_concatenation_piByteArray_zero2){ + PIString str1 = "AB C"; + PIByteArray str2; + str1 += str2; + ASSERT_EQ(str1, "AB C"); +} + +TEST(PIString_Tests, operator_concatenation_piByteArray_zero_zero){ + PIString str1; + PIByteArray str2; + str1 += str2; + ASSERT_EQ(str1, ""); +} + +TEST(PIString_Tests, construct_pistring){ + PIString str1 = "New"; + PIString str(str1); + ASSERT_EQ(str1, str); +} + +TEST(PIString_Tests, construct_pistring_move){ + PIString str1 = "New"; + PIString res = str1; + PIString str(move(str1)); + ASSERT_EQ(res, str); +} + +TEST(PIString_Tests, construct_pichar){ + PIChar str1 = 'n'; + PIString res = "n"; + ASSERT_EQ(res, PIString(str1)); +} + +TEST(PIString_Tests, construct_char){ + char str1 = 'n'; + PIString res = "n"; + ASSERT_EQ(res, PIString(str1)); +} + +TEST(PIString_Tests, construct_chars){ + char str1[] = "mew"; + PIString res = "mew"; + ASSERT_EQ(res, PIString(str1)); +} From 9fc9fde8c08e9a106549c29aba69696f03465779 Mon Sep 17 00:00:00 2001 From: Stepan Fomenko Date: Fri, 22 Jan 2021 12:02:39 +0300 Subject: [PATCH 2/2] Improve test naming --- tests/core/pistringTest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/core/pistringTest.cpp b/tests/core/pistringTest.cpp index f1ef75f9..4c608997 100644 --- a/tests/core/pistringTest.cpp +++ b/tests/core/pistringTest.cpp @@ -31,14 +31,14 @@ TEST(PIString_Tests, operator_concatenation_pichar_zero1){ ASSERT_EQ(str1, "D"); } -TEST(PIString_Tests, operator_concatenation_char){ +TEST(PIString_Tests, operator_concatenation_cstring){ PIString str1 = "AB C"; const char *str2 = "D D "; str1 += str2; ASSERT_EQ(str1, "AB CD D "); } -TEST(PIString_Tests, operator_concatenation_char_zero1){ +TEST(PIString_Tests, operator_concatenation_cstring_zero1){ PIString str1 = ""; const char *str2 = "D D "; str1 += str2; @@ -130,19 +130,19 @@ TEST(PIString_Tests, construct_pistring_move){ ASSERT_EQ(res, str); } -TEST(PIString_Tests, construct_pichar){ +TEST(PIString_Tests, construct_from_pichar){ PIChar str1 = 'n'; PIString res = "n"; ASSERT_EQ(res, PIString(str1)); } -TEST(PIString_Tests, construct_char){ +TEST(PIString_Tests, construct_from_char){ char str1 = 'n'; PIString res = "n"; ASSERT_EQ(res, PIString(str1)); } -TEST(PIString_Tests, construct_chars){ +TEST(PIString_Tests, construct_from_cstring){ char str1[] = "mew"; PIString res = "mew"; ASSERT_EQ(res, PIString(str1));