Merge pull request 'PIStringTests_21-30' (#61) from PIStringTests_21-30 into master

Reviewed-on: https://git.shs.tools/SHS/pip/pulls/61
This commit was merged in pull request #61.
This commit is contained in:
2021-01-25 11:39:51 +03:00

View File

@@ -147,3 +147,70 @@ TEST(PIString_Tests, construct_from_cstring){
PIString res = "mew";
ASSERT_EQ(res, PIString(str1));
}
TEST(PIString_Tests, construct_from_wchar_string){
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_array){
PIChar str1[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_array){
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);
ASSERT_TRUE(str1.isEmpty());
}
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);
}