From a5531933a2dc19ff13ddddc1d1f0fbf1b243d425 Mon Sep 17 00:00:00 2001 From: GAMA Date: Fri, 22 Jan 2021 16:13:49 +0300 Subject: [PATCH] Tests for PIString 21-30 --- tests/core/pistringTest.cpp | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/core/pistringTest.cpp b/tests/core/pistringTest.cpp index 4c608997..edaf4508 100644 --- a/tests/core/pistringTest.cpp +++ b/tests/core/pistringTest.cpp @@ -147,3 +147,69 @@ TEST(PIString_Tests, construct_from_cstring){ PIString res = "mew"; ASSERT_EQ(res, PIString(str1)); } + +TEST(PIString_Tests, construct_from_wchar_t){ + wchar_t str1[] = L"gav"; + PIString res = "gav"; + ASSERT_EQ(res, PIString(str1)); +} + +TEST(PIString_Tests, construct_from_pibyte_array){ + PIByteArray str1; + str1.append('m'); + PIString res = "m"; + ASSERT_EQ(res, PIString(str1)); +} + +TEST(PIString_Tests, construct_from_pichar_size){ + PIChar *str1 = new PIChar[3]; + str1[0] = 'n'; + str1[1] = 'e'; + str1[2] = 'w'; + PIString res = "new"; + ASSERT_EQ(res, PIString(str1, 3)); +} + +TEST(PIString_Tests, construct_from_char_size){ + char str1[] = "good"; + PIString res = "good"; + ASSERT_EQ(res, PIString(str1, 4)); +} + +TEST(PIString_Tests, construct_from_char_len){ + char str1 = 'n'; + PIString res = "nnn"; + ASSERT_EQ(res, PIString(3, str1)); +} + +TEST(PIString_Tests, construct_from_pichar_len){ + PIChar str1 = 'n'; + PIString res = "nnnnn"; + ASSERT_EQ(res, PIString(5, str1)); +} + +TEST(PIString_Tests, operator_assignment){ + PIString str1 = "testing"; + PIString str; + str = str1; + ASSERT_EQ(PIString("testing"), str); +} + +TEST(PIString_Tests, operator_assignment_move){ + PIString str1 = "testing"; + PIString str; + str = move(str1); + ASSERT_EQ(PIString("testing"), str); +} + +TEST(PIString_Tests, operator_symbol){ + PIString str1 = "testing"; + PIChar symbo = "i"; + ASSERT_EQ(symbo, str1[4]); +} + +TEST(PIString_Tests, operator_compare_pistring_true){ + PIString str1 = "testing"; + PIString str2 = "testing"; + ASSERT_TRUE(str1 == str2); +}