fix bug
This commit is contained in:
@@ -8,84 +8,71 @@ TEST(PIString_Tests, operator_concatenation_pichar){
|
||||
PIString str1 = "AB C";
|
||||
const PIChar str2 = " ";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB C ");
|
||||
PIString res = "AB C ";
|
||||
ASSERT_TRUE(str1 == res);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pichar_zero1){
|
||||
PIString str1 = "";
|
||||
const PIChar str2 = "D";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "D");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pichar_zero2){
|
||||
PIString str1 = "AB C";
|
||||
const PIChar str2 = "";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pichar_zero_zero){
|
||||
PIString str1;
|
||||
const PIChar str2;
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "");
|
||||
ASSERT_TRUE(str1 == "D");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_char){
|
||||
PIString str1 = "AB C";
|
||||
const char *str2 = "D D ";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB CD D ");
|
||||
ASSERT_TRUE(str1 == "AB CD D ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_char_zero1){
|
||||
PIString str1 = "";
|
||||
const char *str2 = "D D ";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "D D ");
|
||||
ASSERT_TRUE(str1 == "D D ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_wchar){
|
||||
PIString str1= "AB C";
|
||||
wchar_t str2[] = L"C";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB CC");
|
||||
ASSERT_TRUE(str1 == "AB CC");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_wchar_zero1){
|
||||
PIString str1 = "";
|
||||
wchar_t str2[] = L"C";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "C");
|
||||
ASSERT_TRUE(str1 == "C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring){
|
||||
PIString str1 = "AB C";
|
||||
PIString str2 = " CD ";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB C CD ");
|
||||
ASSERT_TRUE(str1 == "AB C CD ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring_zero1){
|
||||
PIString str1 = "";
|
||||
PIString str2 = "D DD";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "D DD");
|
||||
ASSERT_TRUE(str1 == "D DD");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring_zero2){
|
||||
PIString str1 = "AB C";
|
||||
PIString str2 = "";
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB C");
|
||||
ASSERT_TRUE(str1 == "AB C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring_zero_zero){
|
||||
PIString str1;
|
||||
PIString str2;
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "");
|
||||
ASSERT_TRUE(str1 == "");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray){
|
||||
@@ -93,7 +80,7 @@ TEST(PIString_Tests, operator_concatenation_piByteArray){
|
||||
PIByteArray str2;
|
||||
str2.append('g');
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB Cg");
|
||||
ASSERT_TRUE(str1 == "AB Cg");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray_zero1){
|
||||
@@ -101,52 +88,57 @@ TEST(PIString_Tests, operator_concatenation_piByteArray_zero1){
|
||||
PIByteArray str2;
|
||||
str2.append('0');
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "0");
|
||||
ASSERT_TRUE(str1 == "0");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray_zero2){
|
||||
PIString str1 = "AB C";
|
||||
PIByteArray str2;
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "AB C");
|
||||
ASSERT_TRUE(str1 == "AB C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray_zero_zero){
|
||||
PIString str1;
|
||||
PIByteArray str2;
|
||||
str1 += str2;
|
||||
ASSERT_STREQ(str1, "");
|
||||
ASSERT_TRUE(str1 == "");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pistring){
|
||||
PIString str1 = "New";
|
||||
ASSERT_STREQ(str1, PIString("New"));
|
||||
ASSERT_TRUE(str1 == PIString("New"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pichar){
|
||||
PIChar str1 = 'n';
|
||||
ASSERT_STREQ("n", PIString(str1));
|
||||
PIString res = "n";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_char){
|
||||
char str1 = 'n';
|
||||
ASSERT_STREQ("n", PIString(str1));
|
||||
PIString res = "n";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_chars){
|
||||
char str1[] = "mew";
|
||||
ASSERT_STREQ("mew", PIString(str1));
|
||||
PIString res = "mew";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_wchar_t){
|
||||
wchar_t str1[] = L"gav";
|
||||
ASSERT_STREQ("gav", PIString(str1));
|
||||
PIString res = "gav";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pibyte_array){
|
||||
PIByteArray str1;
|
||||
str1.append('m');
|
||||
ASSERT_STREQ("m", PIString(str1));
|
||||
PIString res = "m";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pichar_size){
|
||||
@@ -154,28 +146,26 @@ TEST(PIString_Tests, construct_pichar_size){
|
||||
str1[0] = 'n';
|
||||
str1[1] = 'e';
|
||||
str1[2] = 'w';
|
||||
ASSERT_STREQ("new", PIString(str1, 3));
|
||||
PIString res = "new";
|
||||
ASSERT_TRUE(res == PIString(str1, 3));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_char_size){
|
||||
char str1[] = "good";
|
||||
ASSERT_STREQ("good", PIString(str1, 4));
|
||||
PIString res = "good";
|
||||
ASSERT_TRUE(res == PIString(str1, 4));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_char_len){
|
||||
char str1 = 'n';
|
||||
ASSERT_STREQ("nnn", PIString(3, str1));
|
||||
PIString res = "nnn";
|
||||
ASSERT_TRUE(res == PIString(3, str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pichar_len){
|
||||
PIChar str1 = 'n';
|
||||
ASSERT_STREQ("nnnnn", PIString(5, str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_pointer){
|
||||
PIString str1 = "testing";
|
||||
const char *point = str1.operator const char *();
|
||||
ASSERT_STREQ("testing", point);
|
||||
PIString res = "nnnnn";
|
||||
ASSERT_TRUE(res == PIString(5, str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_symbol){
|
||||
@@ -476,306 +466,358 @@ TEST(PIString_Tests, operator_shift_pistring){
|
||||
PIString str1 = "shift";
|
||||
PIString str2 = " good";
|
||||
str1 << str2;
|
||||
ASSERT_STREQ("shift good", str1);
|
||||
PIString res = "shift good";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_pichar){
|
||||
PIString str1 = "shif";
|
||||
PIChar str2 = 't';
|
||||
str1 << str2;
|
||||
ASSERT_STREQ("shift", str1);
|
||||
PIString res = "shift";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_char){
|
||||
PIString str1 = "shif";
|
||||
char str2[] = "t chat";
|
||||
str1 << str2;
|
||||
ASSERT_STREQ("shift chat", str1);
|
||||
PIString res = "shift chat";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_wchar_t){
|
||||
PIString str1 = "shif";
|
||||
wchar_t str2[] = L"t cc";
|
||||
str1 << str2;
|
||||
ASSERT_STREQ("shift cc", str1);
|
||||
PIString res = "shift cc";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_int){
|
||||
PIString str1 = "shift ";
|
||||
int numb = -2147483648;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift -2147483648", str1);
|
||||
PIString res = "shift -2147483648";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_uint){
|
||||
PIString str1 = "shift ";
|
||||
uint numb = 4294967295;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift 4294967295", str1);
|
||||
PIString res = "shift 4294967295";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_short){
|
||||
PIString str1 = "shift ";
|
||||
short numb = -32768;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift -32768", str1);
|
||||
PIString res = "shift -32768";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ushort){
|
||||
PIString str1 = "shift ";
|
||||
ushort numb = 65535;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift 65535", str1);
|
||||
PIString res = "shift 65535";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_long){
|
||||
PIString str1 = "shift ";
|
||||
long numb = -2147483648;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift -2147483648", str1);
|
||||
PIString res = "shift -2147483648";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ulong){
|
||||
PIString str1 = "shift ";
|
||||
ulong numb = 4294967295;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift 4294967295", str1);
|
||||
PIString res = "shift 4294967295";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_llong){
|
||||
PIString str1 = "shift ";
|
||||
llong numb = -9223372036854775807;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift -9223372036854775807", str1);
|
||||
PIString res = "shift -9223372036854775807";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ullong){
|
||||
PIString str1 = "shift ";
|
||||
ullong numb = 1844674407370955161;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift 1844674407370955161", str1);
|
||||
PIString res = "shift 1844674407370955161";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_float){
|
||||
PIString str1 = "shift ";
|
||||
float numb = -67.88999939;
|
||||
str1 << numb;
|
||||
ASSERT_STREQ("shift -67.88999939", str1);
|
||||
PIString res = "shift -67.88999939";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_double){
|
||||
PIString str1 = "shift ";
|
||||
double numb = 13.34300000;
|
||||
str1 << numb;
|
||||
|
||||
ASSERT_STREQ("shift 13.34300000", str1);
|
||||
PIString res = "shift 13.34300000";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, prepend){
|
||||
PIString str1 = "idea";
|
||||
PIString str2 = "Good ";
|
||||
str1.prepend(str2);
|
||||
ASSERT_STREQ("Good idea", str1);
|
||||
PIString res = "Good idea";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, append){
|
||||
PIString str1 = "Good";
|
||||
PIString str2 = " idea";
|
||||
str1.append(str2);
|
||||
ASSERT_STREQ("Good idea", str1);
|
||||
PIString res = "Good idea";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("fo", str1.mid(10, 2));
|
||||
PIString res = "fo";
|
||||
ASSERT_TRUE(res == str1.mid(10, 2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_len_0){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("", str1.mid(10, 0));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.mid(10, 0));
|
||||
}
|
||||
|
||||
|
||||
TEST(PIString_Tests, mid_start_more){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("", str1.mid(1000, 0));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.mid(1000, 0));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_len_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("for new project 144", str1.mid(10, -2));
|
||||
PIString res = "for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(10, -2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_len_more){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("for new project 144", str1.mid(10, 100));
|
||||
PIString res = "for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(10, 100));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, subString){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("for new project 144", str1.mid(10, 46));
|
||||
PIString res = "for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(10, 46));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.mid(-10, 47));
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(-10, 47));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, subString_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Go", str1.mid(-10, 12));
|
||||
PIString res = "Go";
|
||||
ASSERT_TRUE(res == str1.mid(-10, 12));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, left){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Go", str1.left(2));
|
||||
PIString res = "Go";
|
||||
ASSERT_TRUE(res == str1.left(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, left_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("", str1.left(-2));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.left(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, right){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("44", str1.right(2));
|
||||
PIString res = "44";
|
||||
ASSERT_TRUE(res == str1.right(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, right_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("", str1.right(-2));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.right(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good for new project 144", str1.cutMid(5,5));
|
||||
PIString res = "Good for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(5,5));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_len_zero){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.cutMid(5,0));
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(5,0));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_len_min){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good ", str1.cutMid(5,-2));
|
||||
PIString res = "Good ";
|
||||
ASSERT_TRUE(res == str1.cutMid(5,-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("ood idea for new project 144", str1.cutMid(-5, 6));
|
||||
PIString res = "ood idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(-5, 6));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_zero){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.cutMid(-5, 5));
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(-5, 5));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutleft){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("od idea for new project 144", str1.cutLeft(2));
|
||||
PIString res = "od idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutLeft(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutleft_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.cutLeft(-2));
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutLeft(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutright){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 1", str1.cutRight(2));
|
||||
PIString res = "Good idea for new project 1";
|
||||
ASSERT_TRUE(res == str1.cutRight(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutright_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.cutRight(-2));
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutRight(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trim){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.trim());
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trim());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trim_without){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.trim());
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trim());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trim_link){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString &str2 = str1.trim();
|
||||
str1 = "link";
|
||||
ASSERT_STREQ("link", str2);
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trimmed){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.trimmed());
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trimmed());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trimmed_without){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
ASSERT_STREQ("Good idea for new project 144", str1.trimmed());
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trimmed());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ(" Good thin for new project 144 ", str1.replace(6,4, "thin"));
|
||||
PIString res = " Good thin for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replace(6,4, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_more){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ(" Good thin", str1.replace(6,100, "thin"));
|
||||
PIString res = " Good thin";
|
||||
ASSERT_TRUE(res == str1.replace(6,100, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_link){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString &str2 = str1.replace(6,4, "thin");
|
||||
str1 = "link";
|
||||
ASSERT_STREQ("link", str2);
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_minus){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("BAD idea for new project 144 ", str1.replace(0, 5, "BAD"));
|
||||
PIString res = "BAD idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replace(0, 5, "BAD"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_zero){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("thin Good idea for new project 144 ", str1.replace(0, 0, "thin"));
|
||||
PIString res = "thin Good idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replace(0, 0, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_all){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("BAD", str1.replaced(0, 100, "BAD"));
|
||||
PIString res = "BAD";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 100, "BAD"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ(" Good thin for new project 144 ", str1.replaced(6,4, "thin"));
|
||||
PIString res = " Good thin for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replaced(6,4, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_minus){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("BAD idea for new project 144 ", str1.replaced(0, 5, "BAD"));
|
||||
PIString res = "BAD idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 5, "BAD"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_zero){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("thin Good idea for new project 144 ", str1.replaced(0, 0, "thin"));
|
||||
PIString res = "thin Good idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 0, "thin"));
|
||||
}
|
||||
|
||||
|
||||
TEST(PIString_Tests, replaced_all){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
ASSERT_STREQ("thin", str1.replaced(0, 100, "thin"));
|
||||
PIString res = "thin";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 100, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_str){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
bool ok = 1;
|
||||
str1.replace("Good", "bad", &ok);
|
||||
ASSERT_STREQ(" bad idea for new Good project 144 ", str1);
|
||||
PIString res = " bad idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_str_link){
|
||||
@@ -783,7 +825,8 @@ TEST(PIString_Tests, replace_str_link){
|
||||
bool ok = 1;
|
||||
PIString &str2 = str1.replace("Good", "bad", &ok);
|
||||
str1 = "link";
|
||||
ASSERT_STREQ("link", str2);
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_str_zero){
|
||||
@@ -804,14 +847,16 @@ TEST(PIString_Tests, replace_str_delete){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
bool ok = 1;
|
||||
str1.replace("Good", "", &ok);
|
||||
ASSERT_STREQ(" idea for new Good project 144 ", str1);
|
||||
PIString res = " idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_str){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
bool ok = 1;
|
||||
PIString str2 = str1.replaced("Good", "bad", &ok);
|
||||
ASSERT_STREQ(" bad idea for new Good project 144 ", str2);
|
||||
PIString res = " bad idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_str_zero){
|
||||
@@ -832,138 +877,159 @@ TEST(PIString_Tests, replaced_delete){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
bool ok = 1;
|
||||
PIString str2 = str1.replaced("Good", "", &ok);
|
||||
ASSERT_STREQ(" idea for new Good project 144 ", str2);
|
||||
PIString res = " idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
str1.replaceAll("Good", "bad");
|
||||
ASSERT_STREQ(" bad idea for new bad project 144 ", str1);
|
||||
PIString res = " bad idea for new bad project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_no_find){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
str1.replaceAll("God", "bad");
|
||||
ASSERT_STREQ(" Good idea for new Good project 144 ", str1);
|
||||
PIString res = " Good idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_str){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString str2 = str1.replaceAll("Good", "bad");
|
||||
ASSERT_STREQ(" bad idea for new bad project 144 ", str2);
|
||||
PIString res = " bad idea for new bad project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_str_no_find){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString str2 = str1.replaceAll("God", "bad");
|
||||
ASSERT_STREQ(" Good idea for new Good project 144 ", str2);
|
||||
PIString res = " Good idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_link){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString &str2 = str1.replaceAll("Good", "bad");
|
||||
ASSERT_STREQ(" bad idea for new bad project 144 ", str2);
|
||||
PIString res = " bad idea for new bad project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_link_change){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString &str2 = str1.replaceAll("Good", "bad");
|
||||
str1 = "link";
|
||||
ASSERT_STREQ("link", str2);
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeat){
|
||||
PIString str1 = "string ";
|
||||
PIString str2 = str1.repeat(6);
|
||||
ASSERT_STREQ("string string string string string string ", str2);
|
||||
PIString res = "string string string string string string ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeat_zero){
|
||||
PIString str1 = "string ";
|
||||
PIString str2 = str1.repeat(0);
|
||||
ASSERT_STREQ("string ", str2);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeat_link){
|
||||
PIString str1 = "string ";
|
||||
PIString &str2 = str1.repeat(6);
|
||||
str1 = "link";
|
||||
ASSERT_STREQ("link", str2);
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeated){
|
||||
PIString str1 = "string ";
|
||||
str1.repeat(6);
|
||||
ASSERT_STREQ("string string string string string string ", str1);
|
||||
PIString res = "string string string string string string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeated_zero){
|
||||
PIString str1 = "string ";
|
||||
str1.repeat(0);
|
||||
ASSERT_STREQ("string ", str1);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_char){
|
||||
PIString str1 = "strng ";
|
||||
char sym = 'i';
|
||||
str1.insert(3, sym);
|
||||
ASSERT_STREQ("string ", str1);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_pichar){
|
||||
PIString str1 = "strng ";
|
||||
PIChar sym = 'i';
|
||||
str1.insert(3, sym);
|
||||
ASSERT_STREQ("string ", str1);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_pistring){
|
||||
PIString str1 = "string out";
|
||||
PIString str2 = " go";
|
||||
str1.insert(6, str2);
|
||||
ASSERT_STREQ("string go out", str1);
|
||||
PIString res = "string go out";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_chars){
|
||||
PIString str1 = "see boy";
|
||||
char str2[] = " big";
|
||||
str1.insert(3, str2);
|
||||
ASSERT_STREQ("see big boy", str1);
|
||||
PIString res = "see big boy";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandRightTo){
|
||||
PIString str1 = "see boy ";
|
||||
PIChar symbol = "x";
|
||||
str1.expandRightTo(11, symbol);
|
||||
ASSERT_STREQ("see boy xxx", str1);
|
||||
PIString res = "see boy xxx";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandRightTo_null){
|
||||
PIString str1 = "see boy ";
|
||||
PIChar symbol = "x";
|
||||
str1.expandRightTo(0, symbol);
|
||||
ASSERT_STREQ("see boy ", str1);
|
||||
PIString res = "see boy ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandLeftTo){
|
||||
PIString str1 = " see boy";
|
||||
PIChar symbol = "x";
|
||||
str1.expandLeftTo(11, symbol);
|
||||
ASSERT_STREQ("xxx see boy", str1);
|
||||
PIString res = "xxx see boy";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandLeftTo_null){
|
||||
PIString str1 = "see boy ";
|
||||
PIChar symbol = "x";
|
||||
str1.expandLeftTo(0, symbol);
|
||||
ASSERT_STREQ("see boy ", str1);
|
||||
PIString res = "see boy ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, quote){
|
||||
PIString str1 = "see boy";
|
||||
PIChar symbol = " ";
|
||||
str1.quote(symbol);
|
||||
ASSERT_STREQ(" see boy ", str1);
|
||||
PIString res = " see boy ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, quote_link){
|
||||
@@ -971,220 +1037,256 @@ TEST(PIString_Tests, quote_link){
|
||||
PIChar symbol = " ";
|
||||
PIString &str2 = str1.quote(symbol);
|
||||
str1 = "link";
|
||||
ASSERT_STREQ("link", str2);
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, quoted){
|
||||
PIString str1 = "see boy";
|
||||
PIChar symbol = " ";
|
||||
PIString str2 = str1.quoted(symbol);
|
||||
ASSERT_STREQ(" see boy ", str2);
|
||||
PIString res = " see boy ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, reverse){
|
||||
PIString str1 = "see boy";
|
||||
PIString &str2 = str1.reverse();
|
||||
ASSERT_STREQ("yob ees", str2);
|
||||
PIString res = "yob ees";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, reverse_link){
|
||||
PIString str1 = "see boy";
|
||||
PIString &str2 = str1.reverse();
|
||||
str1 = "yes";
|
||||
ASSERT_STREQ("yes", str2);
|
||||
PIString res = "yes";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, reversed){
|
||||
PIString str1 = "see boy";
|
||||
PIString str2 = str1.reversed();
|
||||
ASSERT_STREQ("yob ees", str2);
|
||||
PIString res = "yob ees";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(8, 1);
|
||||
ASSERT_STREQ("BMSTU ..", str2);
|
||||
PIString res = "BMSTU ..";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide_small){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(2, 1);
|
||||
ASSERT_STREQ("..", str2);
|
||||
PIString res = "..";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide_all){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(100, 1);
|
||||
ASSERT_STREQ("BMSTU is best university in space", str2);
|
||||
PIString res = "BMSTU is best university in space";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide_link){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(8, 1);
|
||||
str1 = "space";
|
||||
ASSERT_STREQ("space", str2);
|
||||
PIString res = "space";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elided){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.elided(8, 1);
|
||||
ASSERT_STREQ("BMSTU ..", str2);
|
||||
PIString res = "BMSTU ..";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takemid){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeMid(9, 4);
|
||||
ASSERT_STREQ("best", str2);
|
||||
PIString res = "best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeleft){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeLeft(5);
|
||||
ASSERT_STREQ("BMSTU", str2);
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeright){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeRight(5);
|
||||
ASSERT_STREQ("space", str2);
|
||||
PIString res = "space";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takesymbol){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeSymbol();
|
||||
ASSERT_STREQ("B", str2);
|
||||
PIString res = "B";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takesymbol_with_rubbish){
|
||||
PIString str1 = " \t \n \r BMSTU is best university in space";
|
||||
PIString str2 = str1.takeSymbol();
|
||||
ASSERT_STREQ("B", str2);
|
||||
PIString res = "B";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takesymbol_without){
|
||||
PIString str1 = " \t \n \r ";
|
||||
PIString str2 = str1.takeSymbol();
|
||||
ASSERT_STREQ("", str2);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeword){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeWord();
|
||||
ASSERT_STREQ("BMSTU", str2);
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeword_space){
|
||||
PIString str1 = " \r\n\tBMSTU is best university in space";
|
||||
PIString str2 = str1.takeWord();
|
||||
ASSERT_STREQ("BMSTU", str2);
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeword_without_word){
|
||||
PIString str1 = " \r\n\t";
|
||||
PIString str2 = str1.takeWord();
|
||||
ASSERT_STREQ("", str2);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword){
|
||||
PIString str1 = "_6 BMSTU is best university in space";
|
||||
PIString str2 = str1.takeCWord();
|
||||
ASSERT_STREQ("_6", str2);
|
||||
PIString res = "_6";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword_space){
|
||||
PIString str1 = " \t\r\n_6 BMSTU is best university in space";
|
||||
PIString str2 = str1.takeCWord();
|
||||
ASSERT_STREQ("_6", str2);
|
||||
PIString res = "_6";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword_space_w){
|
||||
PIString str1 = " \t\r\n BMSTU is best university in space";
|
||||
PIString str2 = str1.takeCWord();
|
||||
ASSERT_STREQ("BMSTU", str2);
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword_not_cword){
|
||||
PIString str1 = " \t\r\n ";
|
||||
PIString str2 = str1.takeCWord();
|
||||
ASSERT_STREQ("", str2);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeline){
|
||||
PIString str1 = "BMSTU is best\n university in space";
|
||||
PIString str2 = str1.takeLine();
|
||||
ASSERT_STREQ("BMSTU is best", str2);
|
||||
PIString res = "BMSTU is best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeline_without){
|
||||
PIString str1 = "BMSTU is best";
|
||||
PIString str2 = str1.takeLine();
|
||||
ASSERT_STREQ("", str2);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeline_first){
|
||||
PIString str1 = "\nBMSTU is best";
|
||||
PIString str2 = str1.takeLine();
|
||||
ASSERT_STREQ("", str2);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takenumber){
|
||||
PIString str1 = "6.6";
|
||||
PIString str2 = str1.takeNumber();
|
||||
ASSERT_STREQ("6.6", str2);
|
||||
PIString res = "6.6";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takenumber_sign){
|
||||
PIString str1 = "-66";
|
||||
PIString str2 = str1.takeNumber();
|
||||
ASSERT_STREQ("-66", str2);
|
||||
PIString res = "-66";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takenumber_suffix){
|
||||
PIString str1 = "66L";
|
||||
PIString str2 = str1.takeNumber();
|
||||
ASSERT_STREQ("66L", str2);
|
||||
PIString res = "66L";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i', ' ');
|
||||
ASSERT_STREQ("MSTU is best un", str2);
|
||||
PIString res = "MSTU is best un";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange_without_shield){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i');
|
||||
ASSERT_STREQ("MSTU ", str2);
|
||||
PIString res = "MSTU ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange_space){
|
||||
PIString str1 = " \t\r\nBMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i', ' ');
|
||||
ASSERT_STREQ("MSTU is best un", str2);
|
||||
PIString res = "MSTU is best un";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange_without_shield_space){
|
||||
PIString str1 = " \t\r\nBMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i');
|
||||
ASSERT_STREQ("MSTU ", str2);
|
||||
PIString res = "MSTU ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, inBrackets){
|
||||
PIString str1 = "BMSTU is (best) university in space";
|
||||
PIString str2 = str1.inBrackets('(', ')');
|
||||
ASSERT_STREQ("best", str2);
|
||||
PIString res = "best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, inBrackets_end_start){
|
||||
PIString str1 = "BMSTU )is (best) university in space";
|
||||
PIString str2 = str1.inBrackets('(', ')');
|
||||
ASSERT_STREQ("best", str2);
|
||||
PIString res = "best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, inBrackets_without){
|
||||
PIString str1 = "BMSTU )is (best) university in space";
|
||||
PIString str2 = str1.inBrackets('0', '1');
|
||||
ASSERT_STREQ("", str2);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, lenghtascii){
|
||||
@@ -1196,25 +1298,29 @@ TEST(PIString_Tests, lenghtascii){
|
||||
TEST(PIString_Tests, data){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.data();
|
||||
ASSERT_STREQ("BMSTU is (best) university in space\n", data);
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, dataconsole){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.dataConsole();
|
||||
ASSERT_STREQ("BMSTU is (best) university in space\n", data);
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, dataUTF8){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.dataUTF8();
|
||||
ASSERT_STREQ("BMSTU is (best) university in space\n", data);
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, dataAScii){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.dataAscii();
|
||||
ASSERT_STREQ("BMSTU is (best) university in space\n", data);
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, hash){
|
||||
@@ -1256,14 +1362,17 @@ TEST(PIString_Tests, tocharset_empty){
|
||||
TEST(PIString_Tests, split){
|
||||
PIString str1 = " mirrow best mirrow ";
|
||||
PIStringList list = str1.split("best");
|
||||
ASSERT_STREQ(list[1], list[0]);
|
||||
|
||||
ASSERT_TRUE(list[1] == list[0]);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, split_sec){
|
||||
PIString str1 = " mirrow best detail ";
|
||||
PIStringList list = str1.split("best");
|
||||
ASSERT_STREQ(" mirrow ", list[0]);
|
||||
ASSERT_STREQ(list[1], " detail ");
|
||||
PIString res = " mirrow ";
|
||||
PIString res2 = " detail ";
|
||||
ASSERT_TRUE(res == list[0]);
|
||||
ASSERT_TRUE(list[1] == res2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, split_empty){
|
||||
@@ -1281,25 +1390,28 @@ TEST(PIString_Tests, split_empty_delim){
|
||||
TEST(PIString_Tests, split_not_delim){
|
||||
PIString str1 = " mirrow best mirrow ";
|
||||
PIStringList list = str1.split("tr");
|
||||
ASSERT_STREQ(list[0], " mirrow best mirrow ");
|
||||
ASSERT_TRUE(list[0] == " mirrow best mirrow ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, toUpperCase){
|
||||
PIString str1 = " miRrow ";
|
||||
PIString str2 = str1.toUpperCase();
|
||||
ASSERT_STREQ(" MIRROW ", str2);
|
||||
PIString res = " MIRROW ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, toLowerCase){
|
||||
PIString str1 = " MIrROW ";
|
||||
PIString str2 = str1.toLowerCase();
|
||||
ASSERT_STREQ(" mirrow ", str2);
|
||||
PIString res = " mirrow ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, toNativeDecimalPoints){
|
||||
PIString str1 = "4546,878";
|
||||
PIString str2 = str1.toNativeDecimalPoints();
|
||||
ASSERT_STREQ("4546.878", str2);
|
||||
PIString res = "4546.878";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, contains_char){
|
||||
@@ -1999,7 +2111,8 @@ TEST(PIString_Tests, setNumber){
|
||||
const short val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_zero){
|
||||
@@ -2007,7 +2120,8 @@ TEST(PIString_Tests, setNumber_zero){
|
||||
const short val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_false_base){
|
||||
@@ -2031,7 +2145,8 @@ TEST(PIString_Tests, setNumber_false_base_str){
|
||||
const short val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_base_minus){
|
||||
@@ -2039,7 +2154,8 @@ TEST(PIString_Tests, setNumber_base_minus){
|
||||
const short val = -10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("-A", str1);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort){
|
||||
@@ -2047,7 +2163,8 @@ TEST(PIString_Tests, setNumber_ushort){
|
||||
const ushort val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort_true){
|
||||
@@ -2063,7 +2180,8 @@ TEST(PIString_Tests, setNumber_ushort_zero){
|
||||
const ushort val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort_false_base){
|
||||
@@ -2079,7 +2197,8 @@ TEST(PIString_Tests, setNumber_ushort_false_base_str){
|
||||
const ushort val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort_base_minus){
|
||||
@@ -2087,7 +2206,8 @@ TEST(PIString_Tests, setNumber_ushort_base_minus){
|
||||
const ushort val = 10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("A", str1);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int){
|
||||
@@ -2095,7 +2215,8 @@ TEST(PIString_Tests, setNumber_int){
|
||||
const int val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int_zero){
|
||||
@@ -2103,7 +2224,8 @@ TEST(PIString_Tests, setNumber_int_zero){
|
||||
const int val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int_false_base){
|
||||
@@ -2127,7 +2249,8 @@ TEST(PIString_Tests, setNumber_int_false_base_str){
|
||||
const int val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int_base_minus){
|
||||
@@ -2135,7 +2258,8 @@ TEST(PIString_Tests, setNumber_int_base_minus){
|
||||
const int val = -10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("-A", str1);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint){
|
||||
@@ -2143,7 +2267,8 @@ TEST(PIString_Tests, setNumber_uint){
|
||||
const uint val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint_true){
|
||||
@@ -2159,7 +2284,8 @@ TEST(PIString_Tests, setNumber_uintt_zero){
|
||||
const uint val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint_false_base){
|
||||
@@ -2175,7 +2301,8 @@ TEST(PIString_Tests, setNumber_uint_false_base_str){
|
||||
const uint val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint_base_minus){
|
||||
@@ -2183,7 +2310,8 @@ TEST(PIString_Tests, setNumber_uint_base_minus){
|
||||
const uint val = 10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("A", str1);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long){
|
||||
@@ -2191,7 +2319,8 @@ TEST(PIString_Tests, setNumber_long){
|
||||
const long val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long_zero){
|
||||
@@ -2199,7 +2328,8 @@ TEST(PIString_Tests, setNumber_long_zero){
|
||||
const long val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long_false_base){
|
||||
@@ -2223,7 +2353,8 @@ TEST(PIString_Tests, setNumber_long_false_base_str){
|
||||
const long val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long_base_minus){
|
||||
@@ -2231,7 +2362,8 @@ TEST(PIString_Tests, setNumber_long_base_minus){
|
||||
const long val = -10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("-A", str1);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong){
|
||||
@@ -2239,7 +2371,8 @@ TEST(PIString_Tests, setNumber_ulong){
|
||||
const ulong val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong_true){
|
||||
@@ -2255,7 +2388,8 @@ TEST(PIString_Tests, setNumber_ulong_zero){
|
||||
const ulong val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong_false_base){
|
||||
@@ -2271,7 +2405,8 @@ TEST(PIString_Tests, setNumber_ulong_false_base_str){
|
||||
const ulong val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong_base_minus){
|
||||
@@ -2279,7 +2414,8 @@ TEST(PIString_Tests, setNumber_ulong_base_minus){
|
||||
const ulong val = 10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("A", str1);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong){
|
||||
@@ -2287,7 +2423,8 @@ TEST(PIString_Tests, setNumber_llong){
|
||||
const llong val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong_zero){
|
||||
@@ -2295,7 +2432,8 @@ TEST(PIString_Tests, setNumber_llong_zero){
|
||||
const llong val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong_false_base){
|
||||
@@ -2319,7 +2457,8 @@ TEST(PIString_Tests, setNumber_llong_false_base_str){
|
||||
const llong val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong_base_minus){
|
||||
@@ -2327,7 +2466,8 @@ TEST(PIString_Tests, setNumber_llong_base_minus){
|
||||
const llong val = -10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("-A", str1);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong){
|
||||
@@ -2335,7 +2475,8 @@ TEST(PIString_Tests, setNumber_ullong){
|
||||
const ullong val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("131", str1);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong_true){
|
||||
@@ -2351,7 +2492,8 @@ TEST(PIString_Tests, setNumber_ullong_zero){
|
||||
const ullong val = 0;
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
ASSERT_STREQ("0", str1);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong_false_base){
|
||||
@@ -2367,7 +2509,8 @@ TEST(PIString_Tests, setNumber_ullong_false_base_str){
|
||||
const ullong val = 131;
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
ASSERT_STREQ("", str1);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong_base_minus){
|
||||
@@ -2375,74 +2518,86 @@ TEST(PIString_Tests, setNumber_ullong_base_minus){
|
||||
const ullong val = 10;
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
ASSERT_STREQ("A", str1);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_float){
|
||||
PIString str1 = " String";
|
||||
const float val = 131.132;
|
||||
str1.setNumber(val, 'f', 3);
|
||||
ASSERT_STREQ("131.132", str1);
|
||||
PIString res = "131.132";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_double){
|
||||
PIString str1 = " String";
|
||||
const double val = 131.1324334;
|
||||
str1.setNumber(val, 'f', 7);
|
||||
ASSERT_STREQ("131.1324334", str1);
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ldouble){
|
||||
PIString str1 = " String";
|
||||
const ldouble val = 131.1324334;
|
||||
str1.setNumber(val, 'f', 7);
|
||||
ASSERT_STREQ("131.1324334", str1);
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1023 B", str1.setReadableSize(1023));
|
||||
PIString res = "1023 B";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1023));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_kb){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1.0 kB", str1.setReadableSize(1024));
|
||||
PIString res = "1.0 kB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_mb){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1.0 MB", str1.setReadableSize(1024*1024));
|
||||
PIString res = "1.0 MB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_gb){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1.0 GB", str1.setReadableSize(1024*1024*1024));
|
||||
PIString res = "1.0 GB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1024*1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_tb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 99999999999999;
|
||||
ASSERT_STREQ("90.9 TB", str1.setReadableSize(val));
|
||||
PIString res = "90.9 TB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_pb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 999999999999999999;
|
||||
ASSERT_STREQ("888.1 PB", str1.setReadableSize(val));
|
||||
PIString res = "888.1 PB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber){
|
||||
PIString str1 = " String";
|
||||
const short val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumberr_zero){
|
||||
PIString str1 = " String";
|
||||
const short val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_false_base){
|
||||
@@ -2465,21 +2620,24 @@ TEST(PIString_Tests, fromNumber_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const short val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_base_minus){
|
||||
PIString str1 = " String";
|
||||
const short val = -10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("-A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort){
|
||||
PIString str1 = " String";
|
||||
const ushort val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort_true){
|
||||
@@ -2494,7 +2652,8 @@ TEST(PIString_Tests, fromNumber_ushort_zero){
|
||||
PIString str1 = " String";
|
||||
const ushort val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort_false_base){
|
||||
@@ -2509,28 +2668,32 @@ TEST(PIString_Tests, fromNumber_ushort_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const ushort val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort_base_minus){
|
||||
PIString str1 = " String";
|
||||
const ushort val = 10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int){
|
||||
PIString str1 = " String";
|
||||
const int val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int_zero){
|
||||
PIString str1 = " String";
|
||||
const int val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int_false_base){
|
||||
@@ -2553,21 +2716,24 @@ TEST(PIString_Tests, fromNumber_int_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const int val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int_base_minus){
|
||||
PIString str1 = " String";
|
||||
const int val = -10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("-A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint){
|
||||
PIString str1 = " String";
|
||||
const uint val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint_true){
|
||||
@@ -2582,7 +2748,8 @@ TEST(PIString_Tests, fromNumber_uintt_zero){
|
||||
PIString str1 = " String";
|
||||
const uint val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint_false_base){
|
||||
@@ -2597,28 +2764,32 @@ TEST(PIString_Tests, fromNumber_uint_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const uint val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint_base_minus){
|
||||
PIString str1 = " String";
|
||||
const uint val = 10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long){
|
||||
PIString str1 = " String";
|
||||
const long val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long_zero){
|
||||
PIString str1 = " String";
|
||||
const long val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long_false_base){
|
||||
@@ -2641,21 +2812,24 @@ TEST(PIString_Tests, fromNumber_long_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const long val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long_base_minus){
|
||||
PIString str1 = " String";
|
||||
const long val = -10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("-A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong){
|
||||
PIString str1 = " String";
|
||||
const ulong val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong_true){
|
||||
@@ -2670,7 +2844,8 @@ TEST(PIString_Tests, fromNumber_ulong_zero){
|
||||
PIString str1 = " String";
|
||||
const ulong val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong_false_base){
|
||||
@@ -2685,28 +2860,32 @@ TEST(PIString_Tests, fromNumber_ulong_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const ulong val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong_base_minus){
|
||||
PIString str1 = " String";
|
||||
const ulong val = 10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong){
|
||||
PIString str1 = " String";
|
||||
const llong val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong_zero){
|
||||
PIString str1 = " String";
|
||||
const llong val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong_false_base){
|
||||
@@ -2729,21 +2908,24 @@ TEST(PIString_Tests, fromNumber_llong_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const llong val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong_base_minus){
|
||||
PIString str1 = " String";
|
||||
const llong val = -10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("-A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong){
|
||||
PIString str1 = " String";
|
||||
const ullong val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("131", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong_true){
|
||||
@@ -2758,7 +2940,8 @@ TEST(PIString_Tests, fromNumber_ullong_zero){
|
||||
PIString str1 = " String";
|
||||
const ullong val = 0;
|
||||
bool ok;
|
||||
ASSERT_STREQ("0", str1.fromNumber(val, 10, &ok));
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong_false_base){
|
||||
@@ -2773,62 +2956,72 @@ TEST(PIString_Tests, fromNumber_ullong_false_base_str){
|
||||
PIString str1 = " String";
|
||||
const ullong val = 131;
|
||||
bool ok;
|
||||
ASSERT_STREQ("", str1.fromNumber(val, 1, &ok));
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong_base_minus){
|
||||
PIString str1 = " String";
|
||||
const ullong val = 10;
|
||||
bool ok;
|
||||
ASSERT_STREQ("A", str1.fromNumber(val, 16, &ok));
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_float){
|
||||
PIString str1 = " String";
|
||||
const float val = 131.132;
|
||||
ASSERT_STREQ("131.132", str1.fromNumber(val, 'f', 3));
|
||||
PIString res = "131.132";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 'f', 3));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_double){
|
||||
PIString str1 = " String";
|
||||
const double val = 131.1324334;
|
||||
ASSERT_STREQ("131.1324334", str1.fromNumber(val, 'f', 7));
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 'f', 7));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ldouble){
|
||||
PIString str1 = " String";
|
||||
const ldouble val = 131.1324334;
|
||||
ASSERT_STREQ("131.1324334", str1.fromNumber(val, 'f', 7));
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 'f', 7));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromBool_true){
|
||||
PIString str1;
|
||||
bool val = true;
|
||||
ASSERT_STREQ("true", str1.fromBool(val));
|
||||
PIString res = "true";
|
||||
ASSERT_TRUE(res == str1.fromBool(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromBool_false){
|
||||
PIString str1;
|
||||
bool val = false;
|
||||
ASSERT_STREQ("false", str1.fromBool(val));
|
||||
PIString res = "false";
|
||||
ASSERT_TRUE(res == str1.fromBool(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_Console){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
ASSERT_STREQ("true boy", str1.fromConsole(s));
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromConsole(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_System){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
ASSERT_STREQ("true boy", str1.fromSystem(s));
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromSystem(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_UTF8){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
ASSERT_STREQ("true boy", str1.fromUTF8(s));
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromUTF8(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_UTF8_ba){
|
||||
@@ -2838,13 +3031,15 @@ TEST(PIString_Tests, from_UTF8_ba){
|
||||
s.append('r');
|
||||
s.append('u');
|
||||
s.append('e');
|
||||
ASSERT_STREQ("true", str1.fromUTF8(s));
|
||||
PIString res = "true";
|
||||
ASSERT_TRUE(res == str1.fromUTF8(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_Ascii){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
ASSERT_STREQ("true boy", str1.fromAscii(s));
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromAscii(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_Codepage){
|
||||
@@ -2852,58 +3047,68 @@ TEST(PIString_Tests, from_Codepage){
|
||||
char s[] = "true";
|
||||
char c[] = "utf8";
|
||||
PIString str2 = str1.fromCodepage(s, c);
|
||||
ASSERT_STREQ("true", str2);
|
||||
PIString res = "true";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, ReadableSize){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1023 B", str1.readableSize(1023));
|
||||
PIString res = "1023 B";
|
||||
ASSERT_TRUE(res == str1.readableSize(1023));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_kb){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1.0 kB", str1.readableSize(1024));
|
||||
PIString res = "1.0 kB";
|
||||
ASSERT_TRUE(res == str1.readableSize(1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_mb){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1.0 MB", str1.readableSize(1024*1024));
|
||||
PIString res = "1.0 MB";
|
||||
ASSERT_TRUE(res == str1.readableSize(1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_gb){
|
||||
PIString str1 = " ITELMA";
|
||||
ASSERT_STREQ("1.0 GB", str1.readableSize(1024*1024*1024));
|
||||
PIString res = "1.0 GB";
|
||||
ASSERT_TRUE(res == str1.readableSize(1024*1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_tb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 99999999999999;
|
||||
ASSERT_STREQ("90.9 TB", str1.readableSize(val));
|
||||
PIString res = "90.9 TB";
|
||||
ASSERT_TRUE(res == str1.readableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_pb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 999999999999999999;
|
||||
ASSERT_STREQ("888.1 PB", str1.readableSize(val));
|
||||
PIString res = "888.1 PB";
|
||||
ASSERT_TRUE(res == str1.readableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, removeAll_char){
|
||||
PIString str1 = "A very strong programmer wrote this code";
|
||||
char v = ' ';
|
||||
ASSERT_STREQ("Averystrongprogrammerwrotethiscode", str1.removeAll(v));
|
||||
PIString res = "Averystrongprogrammerwrotethiscode";
|
||||
ASSERT_TRUE(res == str1.removeAll(v));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, removeAll_pistring){
|
||||
PIString str1 = "A very strong programmer wrote this code";
|
||||
PIString v = "very strong ";
|
||||
ASSERT_STREQ("A programmer wrote this code", str1.removeAll(v));
|
||||
PIString res = "A programmer wrote this code";
|
||||
ASSERT_TRUE(res == str1.removeAll(v));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_ba_pstr){
|
||||
PIString str1 = '1';
|
||||
PIByteArray s;
|
||||
s << str1;
|
||||
ASSERT_STREQ("010000003100", s.toHex());
|
||||
PIString res = "010000003100";
|
||||
ASSERT_TRUE(res == s.toHex());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_pstr_ba){
|
||||
@@ -2914,56 +3119,72 @@ TEST(PIString_Tests, operator_pstr_ba){
|
||||
s.append('u');
|
||||
s.append('e');
|
||||
str1 << s;
|
||||
ASSERT_STREQ("1true", str1);
|
||||
PIString res = "1true";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_plus_pstr_pstr){
|
||||
PIString str1 = "first ";
|
||||
PIString str2 = "second";
|
||||
ASSERT_STREQ("first second", str1 + str2);
|
||||
PIString res = "first second";
|
||||
ASSERT_TRUE(res == str1 + str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_plus_pstr_chars){
|
||||
PIString str1 = "first ";
|
||||
char str2[] = "second";
|
||||
ASSERT_STREQ("first second", str1 + str2);
|
||||
PIString res = "first second";
|
||||
ASSERT_TRUE(res == str1 + str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_plus_chars_pstr){
|
||||
PIString str1 = "first";
|
||||
char str2[] = "second ";
|
||||
ASSERT_STREQ("second first", str2 + str1);
|
||||
PIString res = "second first";
|
||||
ASSERT_TRUE(res == str2 + str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, versionCompare2){ //дописать
|
||||
PIString str1 = "first";
|
||||
PIString str2 = "first 1";
|
||||
versionCompare(str1, str2, 0);
|
||||
ASSERT_EQ(898448032, piHash(str1));
|
||||
TEST(PIString_Tests, version_Compare){
|
||||
ASSERT_EQ(-1, versionCompare("1.0.0_rc2-999", "1.0.1_rc2-999"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, versionNormalize2){
|
||||
TEST(PIString_Tests, version_Compare_eq){
|
||||
ASSERT_EQ(0, versionCompare(".2-alpha", "0.2_alpha"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, version_Compare_more){
|
||||
ASSERT_EQ(1, versionCompare("1.0.0", "0.9.2"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, version_Compare_component){
|
||||
ASSERT_EQ(0, versionCompare("1.0.0_r1", "1.0.0", 3));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, version_Normalize){
|
||||
PIString str1 = "first second";
|
||||
ASSERT_STREQ("0.0_first second", versionNormalize(str1));
|
||||
PIString res = "0.0_first second";
|
||||
ASSERT_TRUE(res == versionNormalize(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, piHash){
|
||||
TEST(PIString_Tests, pi_Hash){
|
||||
PIString str1 = "first";
|
||||
ASSERT_EQ(898448032, piHash(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, piSwap){
|
||||
TEST(PIString_Tests, pi_Swap){
|
||||
PIString str1 = "first";
|
||||
PIString str2 = "second";
|
||||
piSwap(str1, str2);
|
||||
ASSERT_STREQ("first", str2);
|
||||
PIString res = "first";
|
||||
ASSERT_TRUE(res == str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, piSwap_sec){
|
||||
PIString str1 = "first";
|
||||
PIString str2 = "second";
|
||||
piSwap(str1, str2);
|
||||
ASSERT_STREQ("second", str1);
|
||||
PIString res = "second";
|
||||
ASSERT_TRUE(res == str1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user