code improvement
This commit is contained in:
@@ -7,70 +7,70 @@ TEST(PIString_Tests, operator_concatenation_pichar){
|
||||
const PIChar str2 = " ";
|
||||
str1 += str2;
|
||||
PIString res = "AB C ";
|
||||
ASSERT_TRUE(str1 == res);
|
||||
ASSERT_EQ(str1, res);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pichar_zero1){
|
||||
PIString str1 = "";
|
||||
const PIChar str2 = "D";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "D");
|
||||
ASSERT_EQ(str1, "D");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_char){
|
||||
PIString str1 = "AB C";
|
||||
const char *str2 = "D D ";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "AB CD D ");
|
||||
ASSERT_EQ(str1, "AB CD D ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_char_zero1){
|
||||
PIString str1 = "";
|
||||
const char *str2 = "D D ";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "D D ");
|
||||
ASSERT_EQ(str1, "D D ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_wchar){
|
||||
PIString str1= "AB C";
|
||||
wchar_t str2[] = L"C";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "AB CC");
|
||||
ASSERT_EQ(str1, "AB CC");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_wchar_zero1){
|
||||
PIString str1 = "";
|
||||
wchar_t str2[] = L"C";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "C");
|
||||
ASSERT_EQ(str1, "C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring){
|
||||
PIString str1 = "AB C";
|
||||
PIString str2 = " CD ";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "AB C CD ");
|
||||
ASSERT_EQ(str1, "AB C CD ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring_zero1){
|
||||
PIString str1 = "";
|
||||
PIString str2 = "D DD";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "D DD");
|
||||
ASSERT_EQ(str1, "D DD");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring_zero2){
|
||||
PIString str1 = "AB C";
|
||||
PIString str2 = "";
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "AB C");
|
||||
ASSERT_EQ(str1, "AB C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_pistring_zero_zero){
|
||||
PIString str1;
|
||||
PIString str2;
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "");
|
||||
ASSERT_EQ(str1, "");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray){
|
||||
@@ -78,7 +78,7 @@ TEST(PIString_Tests, operator_concatenation_piByteArray){
|
||||
PIByteArray str2;
|
||||
str2.append('g');
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "AB Cg");
|
||||
ASSERT_EQ(str1, "AB Cg");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray_zero1){
|
||||
@@ -86,57 +86,57 @@ TEST(PIString_Tests, operator_concatenation_piByteArray_zero1){
|
||||
PIByteArray str2;
|
||||
str2.append('0');
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "0");
|
||||
ASSERT_EQ(str1, "0");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray_zero2){
|
||||
PIString str1 = "AB C";
|
||||
PIByteArray str2;
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "AB C");
|
||||
ASSERT_EQ(str1, "AB C");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_concatenation_piByteArray_zero_zero){
|
||||
PIString str1;
|
||||
PIByteArray str2;
|
||||
str1 += str2;
|
||||
ASSERT_TRUE(str1 == "");
|
||||
ASSERT_EQ(str1, "");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pistring){
|
||||
PIString str1 = "New";
|
||||
ASSERT_TRUE(str1 == PIString("New"));
|
||||
ASSERT_EQ(str1, PIString("New"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pichar){
|
||||
PIChar str1 = 'n';
|
||||
PIString res = "n";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
ASSERT_EQ(res, PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_char){
|
||||
char str1 = 'n';
|
||||
PIString res = "n";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
ASSERT_EQ(res, PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_chars){
|
||||
char str1[] = "mew";
|
||||
PIString res = "mew";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
ASSERT_EQ(res, PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_wchar_t){
|
||||
wchar_t str1[] = L"gav";
|
||||
PIString res = "gav";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
ASSERT_EQ(res, PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pibyte_array){
|
||||
PIByteArray str1;
|
||||
str1.append('m');
|
||||
PIString res = "m";
|
||||
ASSERT_TRUE(res == PIString(str1));
|
||||
ASSERT_EQ(res, PIString(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pichar_size){
|
||||
@@ -145,25 +145,25 @@ TEST(PIString_Tests, construct_pichar_size){
|
||||
str1[1] = 'e';
|
||||
str1[2] = 'w';
|
||||
PIString res = "new";
|
||||
ASSERT_TRUE(res == PIString(str1, 3));
|
||||
ASSERT_EQ(res, PIString(str1, 3));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_char_size){
|
||||
char str1[] = "good";
|
||||
PIString res = "good";
|
||||
ASSERT_TRUE(res == PIString(str1, 4));
|
||||
ASSERT_EQ(res, PIString(str1, 4));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_char_len){
|
||||
char str1 = 'n';
|
||||
PIString res = "nnn";
|
||||
ASSERT_TRUE(res == PIString(3, str1));
|
||||
ASSERT_EQ(res, PIString(3, str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, construct_pichar_len){
|
||||
PIChar str1 = 'n';
|
||||
PIString res = "nnnnn";
|
||||
ASSERT_TRUE(res == PIString(5, str1));
|
||||
ASSERT_EQ(res, PIString(5, str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_symbol){
|
||||
@@ -465,7 +465,7 @@ TEST(PIString_Tests, operator_shift_pistring){
|
||||
PIString str2 = " good";
|
||||
str1 << str2;
|
||||
PIString res = "shift good";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_pichar){
|
||||
@@ -473,7 +473,7 @@ TEST(PIString_Tests, operator_shift_pichar){
|
||||
PIChar str2 = 't';
|
||||
str1 << str2;
|
||||
PIString res = "shift";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_char){
|
||||
@@ -481,7 +481,7 @@ TEST(PIString_Tests, operator_shift_char){
|
||||
char str2[] = "t chat";
|
||||
str1 << str2;
|
||||
PIString res = "shift chat";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_wchar_t){
|
||||
@@ -489,7 +489,7 @@ TEST(PIString_Tests, operator_shift_wchar_t){
|
||||
wchar_t str2[] = L"t cc";
|
||||
str1 << str2;
|
||||
PIString res = "shift cc";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_int){
|
||||
@@ -497,7 +497,7 @@ TEST(PIString_Tests, operator_shift_int){
|
||||
int numb = -2147483648;
|
||||
str1 << numb;
|
||||
PIString res = "shift -2147483648";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_uint){
|
||||
@@ -505,7 +505,7 @@ TEST(PIString_Tests, operator_shift_uint){
|
||||
uint numb = 4294967295;
|
||||
str1 << numb;
|
||||
PIString res = "shift 4294967295";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_short){
|
||||
@@ -513,7 +513,7 @@ TEST(PIString_Tests, operator_shift_short){
|
||||
short numb = -32768;
|
||||
str1 << numb;
|
||||
PIString res = "shift -32768";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ushort){
|
||||
@@ -521,7 +521,7 @@ TEST(PIString_Tests, operator_shift_ushort){
|
||||
ushort numb = 65535;
|
||||
str1 << numb;
|
||||
PIString res = "shift 65535";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_long){
|
||||
@@ -529,7 +529,7 @@ TEST(PIString_Tests, operator_shift_long){
|
||||
long numb = -2147483648;
|
||||
str1 << numb;
|
||||
PIString res = "shift -2147483648";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ulong){
|
||||
@@ -537,7 +537,7 @@ TEST(PIString_Tests, operator_shift_ulong){
|
||||
ulong numb = 4294967295;
|
||||
str1 << numb;
|
||||
PIString res = "shift 4294967295";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_llong){
|
||||
@@ -545,7 +545,7 @@ TEST(PIString_Tests, operator_shift_llong){
|
||||
llong numb = -9223372036854775807;
|
||||
str1 << numb;
|
||||
PIString res = "shift -9223372036854775807";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ullong){
|
||||
@@ -553,7 +553,7 @@ TEST(PIString_Tests, operator_shift_ullong){
|
||||
ullong numb = 1844674407370955161;
|
||||
str1 << numb;
|
||||
PIString res = "shift 1844674407370955161";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_float){
|
||||
@@ -561,7 +561,7 @@ TEST(PIString_Tests, operator_shift_float){
|
||||
float numb = -67.88999939;
|
||||
str1 << numb;
|
||||
PIString res = "shift -67.88999939";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_double){
|
||||
@@ -569,7 +569,7 @@ TEST(PIString_Tests, operator_shift_double){
|
||||
double numb = 13.34300000;
|
||||
str1 << numb;
|
||||
PIString res = "shift 13.34300000";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, prepend){
|
||||
@@ -577,7 +577,7 @@ TEST(PIString_Tests, prepend){
|
||||
PIString str2 = "Good ";
|
||||
str1.prepend(str2);
|
||||
PIString res = "Good idea";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, append){
|
||||
@@ -585,146 +585,146 @@ TEST(PIString_Tests, append){
|
||||
PIString str2 = " idea";
|
||||
str1.append(str2);
|
||||
PIString res = "Good idea";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "fo";
|
||||
ASSERT_TRUE(res == str1.mid(10, 2));
|
||||
ASSERT_EQ(res, str1.mid(10, 2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_len_0){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.mid(10, 0));
|
||||
ASSERT_EQ(res, str1.mid(10, 0));
|
||||
}
|
||||
|
||||
|
||||
TEST(PIString_Tests, mid_start_more){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.mid(1000, 0));
|
||||
ASSERT_EQ(res, str1.mid(1000, 0));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_len_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(10, -2));
|
||||
ASSERT_EQ(res, str1.mid(10, -2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_len_more){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(10, 100));
|
||||
ASSERT_EQ(res, str1.mid(10, 100));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, subString){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(10, 46));
|
||||
ASSERT_EQ(res, str1.mid(10, 46));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, mid_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.mid(-10, 47));
|
||||
ASSERT_EQ(res, str1.mid(-10, 47));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, subString_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Go";
|
||||
ASSERT_TRUE(res == str1.mid(-10, 12));
|
||||
ASSERT_EQ(res, str1.mid(-10, 12));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, left){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Go";
|
||||
ASSERT_TRUE(res == str1.left(2));
|
||||
ASSERT_EQ(res, str1.left(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, left_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.left(-2));
|
||||
ASSERT_EQ(res, str1.left(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, right){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "44";
|
||||
ASSERT_TRUE(res == str1.right(2));
|
||||
ASSERT_EQ(res, str1.right(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, right_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.right(-2));
|
||||
ASSERT_EQ(res, str1.right(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(5,5));
|
||||
ASSERT_EQ(res, str1.cutMid(5,5));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_len_zero){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(5,0));
|
||||
ASSERT_EQ(res, str1.cutMid(5,0));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_len_min){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good ";
|
||||
ASSERT_TRUE(res == str1.cutMid(5,-2));
|
||||
ASSERT_EQ(res, str1.cutMid(5,-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "ood idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(-5, 6));
|
||||
ASSERT_EQ(res, str1.cutMid(-5, 6));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutMid_zero){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutMid(-5, 5));
|
||||
ASSERT_EQ(res, str1.cutMid(-5, 5));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutleft){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "od idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutLeft(2));
|
||||
ASSERT_EQ(res, str1.cutLeft(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutleft_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutLeft(-2));
|
||||
ASSERT_EQ(res, str1.cutLeft(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutright){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 1";
|
||||
ASSERT_TRUE(res == str1.cutRight(2));
|
||||
ASSERT_EQ(res, str1.cutRight(2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, cutright_minus){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.cutRight(-2));
|
||||
ASSERT_EQ(res, str1.cutRight(-2));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trim){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trim());
|
||||
ASSERT_EQ(res, str1.trim());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trim_without){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trim());
|
||||
ASSERT_EQ(res, str1.trim());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trim_link){
|
||||
@@ -732,31 +732,31 @@ TEST(PIString_Tests, trim_link){
|
||||
PIString &str2 = str1.trim();
|
||||
str1 = "link";
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trimmed){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trimmed());
|
||||
ASSERT_EQ(res, str1.trimmed());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, trimmed_without){
|
||||
PIString str1 = "Good idea for new project 144";
|
||||
PIString res = "Good idea for new project 144";
|
||||
ASSERT_TRUE(res == str1.trimmed());
|
||||
ASSERT_EQ(res, str1.trimmed());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = " Good thin for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replace(6,4, "thin"));
|
||||
ASSERT_EQ(res, str1.replace(6,4, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_more){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = " Good thin";
|
||||
ASSERT_TRUE(res == str1.replace(6,100, "thin"));
|
||||
ASSERT_EQ(res, str1.replace(6,100, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_link){
|
||||
@@ -764,50 +764,50 @@ TEST(PIString_Tests, replace_link){
|
||||
PIString &str2 = str1.replace(6,4, "thin");
|
||||
str1 = "link";
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_minus){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "BAD idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replace(0, 5, "BAD"));
|
||||
ASSERT_EQ(res, str1.replace(0, 5, "BAD"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_zero){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "thin Good idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replace(0, 0, "thin"));
|
||||
ASSERT_EQ(res, str1.replace(0, 0, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_all){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "BAD";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 100, "BAD"));
|
||||
ASSERT_EQ(res, str1.replaced(0, 100, "BAD"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = " Good thin for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replaced(6,4, "thin"));
|
||||
ASSERT_EQ(res, str1.replaced(6,4, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_minus){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "BAD idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 5, "BAD"));
|
||||
ASSERT_EQ(res, str1.replaced(0, 5, "BAD"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_zero){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "thin Good idea for new project 144 ";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 0, "thin"));
|
||||
ASSERT_EQ(res, str1.replaced(0, 0, "thin"));
|
||||
}
|
||||
|
||||
|
||||
TEST(PIString_Tests, replaced_all){
|
||||
PIString str1 = " Good idea for new project 144 ";
|
||||
PIString res = "thin";
|
||||
ASSERT_TRUE(res == str1.replaced(0, 100, "thin"));
|
||||
ASSERT_EQ(res, str1.replaced(0, 100, "thin"));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_str){
|
||||
@@ -815,7 +815,7 @@ TEST(PIString_Tests, replace_str){
|
||||
bool ok = 1;
|
||||
str1.replace("Good", "bad", &ok);
|
||||
PIString res = " bad idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_str_link){
|
||||
@@ -824,7 +824,7 @@ TEST(PIString_Tests, replace_str_link){
|
||||
PIString &str2 = str1.replace("Good", "bad", &ok);
|
||||
str1 = "link";
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replace_str_zero){
|
||||
@@ -846,7 +846,7 @@ TEST(PIString_Tests, replace_str_delete){
|
||||
bool ok = 1;
|
||||
str1.replace("Good", "", &ok);
|
||||
PIString res = " idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_str){
|
||||
@@ -854,7 +854,7 @@ TEST(PIString_Tests, replaced_str){
|
||||
bool ok = 1;
|
||||
PIString str2 = str1.replaced("Good", "bad", &ok);
|
||||
PIString res = " bad idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaced_str_zero){
|
||||
@@ -876,42 +876,42 @@ TEST(PIString_Tests, replaced_delete){
|
||||
bool ok = 1;
|
||||
PIString str2 = str1.replaced("Good", "", &ok);
|
||||
PIString res = " idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
str1.replaceAll("Good", "bad");
|
||||
PIString res = " bad idea for new bad project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_no_find){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
str1.replaceAll("God", "bad");
|
||||
PIString res = " Good idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_str){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString str2 = str1.replaceAll("Good", "bad");
|
||||
PIString res = " bad idea for new bad project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_str_no_find){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString str2 = str1.replaceAll("God", "bad");
|
||||
PIString res = " Good idea for new Good project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_link){
|
||||
PIString str1 = " Good idea for new Good project 144 ";
|
||||
PIString &str2 = str1.replaceAll("Good", "bad");
|
||||
PIString res = " bad idea for new bad project 144 ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, replaceall_link_change){
|
||||
@@ -919,21 +919,21 @@ TEST(PIString_Tests, replaceall_link_change){
|
||||
PIString &str2 = str1.replaceAll("Good", "bad");
|
||||
str1 = "link";
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeat){
|
||||
PIString str1 = "string ";
|
||||
PIString str2 = str1.repeat(6);
|
||||
PIString res = "string string string string string string ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeat_zero){
|
||||
PIString str1 = "string ";
|
||||
PIString str2 = str1.repeat(0);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeat_link){
|
||||
@@ -941,21 +941,21 @@ TEST(PIString_Tests, repeat_link){
|
||||
PIString &str2 = str1.repeat(6);
|
||||
str1 = "link";
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeated){
|
||||
PIString str1 = "string ";
|
||||
str1.repeat(6);
|
||||
PIString res = "string string string string string string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, repeated_zero){
|
||||
PIString str1 = "string ";
|
||||
str1.repeat(0);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_char){
|
||||
@@ -963,7 +963,7 @@ TEST(PIString_Tests, insert_char){
|
||||
char sym = 'i';
|
||||
str1.insert(3, sym);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_pichar){
|
||||
@@ -971,7 +971,7 @@ TEST(PIString_Tests, insert_pichar){
|
||||
PIChar sym = 'i';
|
||||
str1.insert(3, sym);
|
||||
PIString res = "string ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_pistring){
|
||||
@@ -979,7 +979,7 @@ TEST(PIString_Tests, insert_pistring){
|
||||
PIString str2 = " go";
|
||||
str1.insert(6, str2);
|
||||
PIString res = "string go out";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, insert_chars){
|
||||
@@ -987,7 +987,7 @@ TEST(PIString_Tests, insert_chars){
|
||||
char str2[] = " big";
|
||||
str1.insert(3, str2);
|
||||
PIString res = "see big boy";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandRightTo){
|
||||
@@ -995,7 +995,7 @@ TEST(PIString_Tests, expandRightTo){
|
||||
PIChar symbol = "x";
|
||||
str1.expandRightTo(11, symbol);
|
||||
PIString res = "see boy xxx";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandRightTo_null){
|
||||
@@ -1003,7 +1003,7 @@ TEST(PIString_Tests, expandRightTo_null){
|
||||
PIChar symbol = "x";
|
||||
str1.expandRightTo(0, symbol);
|
||||
PIString res = "see boy ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandLeftTo){
|
||||
@@ -1011,7 +1011,7 @@ TEST(PIString_Tests, expandLeftTo){
|
||||
PIChar symbol = "x";
|
||||
str1.expandLeftTo(11, symbol);
|
||||
PIString res = "xxx see boy";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, expandLeftTo_null){
|
||||
@@ -1019,7 +1019,7 @@ TEST(PIString_Tests, expandLeftTo_null){
|
||||
PIChar symbol = "x";
|
||||
str1.expandLeftTo(0, symbol);
|
||||
PIString res = "see boy ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, quote){
|
||||
@@ -1027,7 +1027,7 @@ TEST(PIString_Tests, quote){
|
||||
PIChar symbol = " ";
|
||||
str1.quote(symbol);
|
||||
PIString res = " see boy ";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, quote_link){
|
||||
@@ -1036,7 +1036,7 @@ TEST(PIString_Tests, quote_link){
|
||||
PIString &str2 = str1.quote(symbol);
|
||||
str1 = "link";
|
||||
PIString res = "link";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, quoted){
|
||||
@@ -1044,14 +1044,14 @@ TEST(PIString_Tests, quoted){
|
||||
PIChar symbol = " ";
|
||||
PIString str2 = str1.quoted(symbol);
|
||||
PIString res = " see boy ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, reverse){
|
||||
PIString str1 = "see boy";
|
||||
PIString &str2 = str1.reverse();
|
||||
PIString res = "yob ees";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, reverse_link){
|
||||
@@ -1059,35 +1059,35 @@ TEST(PIString_Tests, reverse_link){
|
||||
PIString &str2 = str1.reverse();
|
||||
str1 = "yes";
|
||||
PIString res = "yes";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, reversed){
|
||||
PIString str1 = "see boy";
|
||||
PIString str2 = str1.reversed();
|
||||
PIString res = "yob ees";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(8, 1);
|
||||
PIString res = "BMSTU ..";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide_small){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(2, 1);
|
||||
PIString res = "..";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide_all){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString &str2 = str1.elide(100, 1);
|
||||
PIString res = "BMSTU is best university in space";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elide_link){
|
||||
@@ -1095,196 +1095,196 @@ TEST(PIString_Tests, elide_link){
|
||||
PIString &str2 = str1.elide(8, 1);
|
||||
str1 = "space";
|
||||
PIString res = "space";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, elided){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.elided(8, 1);
|
||||
PIString res = "BMSTU ..";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takemid){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeMid(9, 4);
|
||||
PIString res = "best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeleft){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeLeft(5);
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeright){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeRight(5);
|
||||
PIString res = "space";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takesymbol){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeSymbol();
|
||||
PIString res = "B";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takesymbol_with_rubbish){
|
||||
PIString str1 = " \t \n \r BMSTU is best university in space";
|
||||
PIString str2 = str1.takeSymbol();
|
||||
PIString res = "B";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takesymbol_without){
|
||||
PIString str1 = " \t \n \r ";
|
||||
PIString str2 = str1.takeSymbol();
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeword){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeWord();
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeword_space){
|
||||
PIString str1 = " \r\n\tBMSTU is best university in space";
|
||||
PIString str2 = str1.takeWord();
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeword_without_word){
|
||||
PIString str1 = " \r\n\t";
|
||||
PIString str2 = str1.takeWord();
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword){
|
||||
PIString str1 = "_6 BMSTU is best university in space";
|
||||
PIString str2 = str1.takeCWord();
|
||||
PIString res = "_6";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword_space){
|
||||
PIString str1 = " \t\r\n_6 BMSTU is best university in space";
|
||||
PIString str2 = str1.takeCWord();
|
||||
PIString res = "_6";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword_space_w){
|
||||
PIString str1 = " \t\r\n BMSTU is best university in space";
|
||||
PIString str2 = str1.takeCWord();
|
||||
PIString res = "BMSTU";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takecword_not_cword){
|
||||
PIString str1 = " \t\r\n ";
|
||||
PIString str2 = str1.takeCWord();
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeline){
|
||||
PIString str1 = "BMSTU is best\n university in space";
|
||||
PIString str2 = str1.takeLine();
|
||||
PIString res = "BMSTU is best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeline_without){
|
||||
PIString str1 = "BMSTU is best";
|
||||
PIString str2 = str1.takeLine();
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takeline_first){
|
||||
PIString str1 = "\nBMSTU is best";
|
||||
PIString str2 = str1.takeLine();
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takenumber){
|
||||
PIString str1 = "6.6";
|
||||
PIString str2 = str1.takeNumber();
|
||||
PIString res = "6.6";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takenumber_sign){
|
||||
PIString str1 = "-66";
|
||||
PIString str2 = str1.takeNumber();
|
||||
PIString res = "-66";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takenumber_suffix){
|
||||
PIString str1 = "66L";
|
||||
PIString str2 = str1.takeNumber();
|
||||
PIString res = "66L";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i', ' ');
|
||||
PIString res = "MSTU is best un";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange_without_shield){
|
||||
PIString str1 = "BMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i');
|
||||
PIString res = "MSTU ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, takerange_space){
|
||||
PIString str1 = " \t\r\nBMSTU is best university in space";
|
||||
PIString str2 = str1.takeRange('B', 'i', ' ');
|
||||
PIString res = "MSTU is best un";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(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');
|
||||
PIString res = "MSTU ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, inBrackets){
|
||||
PIString str1 = "BMSTU is (best) university in space";
|
||||
PIString str2 = str1.inBrackets('(', ')');
|
||||
PIString res = "best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, inBrackets_end_start){
|
||||
PIString str1 = "BMSTU )is (best) university in space";
|
||||
PIString str2 = str1.inBrackets('(', ')');
|
||||
PIString res = "best";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, inBrackets_without){
|
||||
PIString str1 = "BMSTU )is (best) university in space";
|
||||
PIString str2 = str1.inBrackets('0', '1');
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, lenghtascii){
|
||||
@@ -1297,28 +1297,28 @@ TEST(PIString_Tests, data){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.data();
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
ASSERT_EQ(res, data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, dataconsole){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.dataConsole();
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
ASSERT_EQ(res, data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, dataUTF8){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.dataUTF8();
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
ASSERT_EQ(res, data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, dataAScii){
|
||||
PIString str1 = "BMSTU is (best) university in space\n";
|
||||
const char *data = str1.dataAscii();
|
||||
PIString res = "BMSTU is (best) university in space\n";
|
||||
ASSERT_TRUE(res == data);
|
||||
ASSERT_EQ(res, data);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, hash){
|
||||
@@ -1361,7 +1361,7 @@ TEST(PIString_Tests, split){
|
||||
PIString str1 = " mirrow best mirrow ";
|
||||
PIStringList list = str1.split("best");
|
||||
|
||||
ASSERT_TRUE(list[1] == list[0]);
|
||||
ASSERT_EQ(list[1], list[0]);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, split_sec){
|
||||
@@ -1369,8 +1369,8 @@ TEST(PIString_Tests, split_sec){
|
||||
PIStringList list = str1.split("best");
|
||||
PIString res = " mirrow ";
|
||||
PIString res2 = " detail ";
|
||||
ASSERT_TRUE(res == list[0]);
|
||||
ASSERT_TRUE(list[1] == res2);
|
||||
ASSERT_EQ(res, list[0]);
|
||||
ASSERT_EQ(list[1], res2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, split_empty){
|
||||
@@ -1388,28 +1388,28 @@ TEST(PIString_Tests, split_empty_delim){
|
||||
TEST(PIString_Tests, split_not_delim){
|
||||
PIString str1 = " mirrow best mirrow ";
|
||||
PIStringList list = str1.split("tr");
|
||||
ASSERT_TRUE(list[0] == " mirrow best mirrow ");
|
||||
ASSERT_EQ(list[0], " mirrow best mirrow ");
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, toUpperCase){
|
||||
PIString str1 = " miRrow ";
|
||||
PIString str2 = str1.toUpperCase();
|
||||
PIString res = " MIRROW ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, toLowerCase){
|
||||
PIString str1 = " MIrROW ";
|
||||
PIString str2 = str1.toLowerCase();
|
||||
PIString res = " mirrow ";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, toNativeDecimalPoints){
|
||||
PIString str1 = "4546,878";
|
||||
PIString str2 = str1.toNativeDecimalPoints();
|
||||
PIString res = "4546.878";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, contains_char){
|
||||
@@ -2110,7 +2110,7 @@ TEST(PIString_Tests, setNumber){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_zero){
|
||||
@@ -2119,7 +2119,7 @@ TEST(PIString_Tests, setNumber_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_false_base){
|
||||
@@ -2144,7 +2144,7 @@ TEST(PIString_Tests, setNumber_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_base_minus){
|
||||
@@ -2153,7 +2153,7 @@ TEST(PIString_Tests, setNumber_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort){
|
||||
@@ -2162,7 +2162,7 @@ TEST(PIString_Tests, setNumber_ushort){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort_true){
|
||||
@@ -2179,7 +2179,7 @@ TEST(PIString_Tests, setNumber_ushort_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort_false_base){
|
||||
@@ -2196,7 +2196,7 @@ TEST(PIString_Tests, setNumber_ushort_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ushort_base_minus){
|
||||
@@ -2205,7 +2205,7 @@ TEST(PIString_Tests, setNumber_ushort_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int){
|
||||
@@ -2214,7 +2214,7 @@ TEST(PIString_Tests, setNumber_int){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int_zero){
|
||||
@@ -2223,7 +2223,7 @@ TEST(PIString_Tests, setNumber_int_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int_false_base){
|
||||
@@ -2248,7 +2248,7 @@ TEST(PIString_Tests, setNumber_int_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_int_base_minus){
|
||||
@@ -2257,7 +2257,7 @@ TEST(PIString_Tests, setNumber_int_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint){
|
||||
@@ -2266,7 +2266,7 @@ TEST(PIString_Tests, setNumber_uint){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint_true){
|
||||
@@ -2283,7 +2283,7 @@ TEST(PIString_Tests, setNumber_uintt_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint_false_base){
|
||||
@@ -2300,7 +2300,7 @@ TEST(PIString_Tests, setNumber_uint_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_uint_base_minus){
|
||||
@@ -2309,7 +2309,7 @@ TEST(PIString_Tests, setNumber_uint_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long){
|
||||
@@ -2318,7 +2318,7 @@ TEST(PIString_Tests, setNumber_long){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long_zero){
|
||||
@@ -2327,7 +2327,7 @@ TEST(PIString_Tests, setNumber_long_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long_false_base){
|
||||
@@ -2352,7 +2352,7 @@ TEST(PIString_Tests, setNumber_long_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_long_base_minus){
|
||||
@@ -2361,7 +2361,7 @@ TEST(PIString_Tests, setNumber_long_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong){
|
||||
@@ -2370,7 +2370,7 @@ TEST(PIString_Tests, setNumber_ulong){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong_true){
|
||||
@@ -2387,7 +2387,7 @@ TEST(PIString_Tests, setNumber_ulong_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong_false_base){
|
||||
@@ -2404,7 +2404,7 @@ TEST(PIString_Tests, setNumber_ulong_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ulong_base_minus){
|
||||
@@ -2413,7 +2413,7 @@ TEST(PIString_Tests, setNumber_ulong_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong){
|
||||
@@ -2422,7 +2422,7 @@ TEST(PIString_Tests, setNumber_llong){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong_zero){
|
||||
@@ -2431,7 +2431,7 @@ TEST(PIString_Tests, setNumber_llong_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong_false_base){
|
||||
@@ -2456,7 +2456,7 @@ TEST(PIString_Tests, setNumber_llong_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_llong_base_minus){
|
||||
@@ -2465,7 +2465,7 @@ TEST(PIString_Tests, setNumber_llong_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong){
|
||||
@@ -2474,7 +2474,7 @@ TEST(PIString_Tests, setNumber_ullong){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong_true){
|
||||
@@ -2491,7 +2491,7 @@ TEST(PIString_Tests, setNumber_ullong_zero){
|
||||
bool ok;
|
||||
str1.setNumber(val, 10, &ok);
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong_false_base){
|
||||
@@ -2508,7 +2508,7 @@ TEST(PIString_Tests, setNumber_ullong_false_base_str){
|
||||
bool ok;
|
||||
str1.setNumber(val, 1, &ok);
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ullong_base_minus){
|
||||
@@ -2517,7 +2517,7 @@ TEST(PIString_Tests, setNumber_ullong_base_minus){
|
||||
bool ok;
|
||||
str1.setNumber(val, 16, &ok);
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_float){
|
||||
@@ -2525,7 +2525,7 @@ TEST(PIString_Tests, setNumber_float){
|
||||
const float val = 131.132;
|
||||
str1.setNumber(val, 'f', 3);
|
||||
PIString res = "131.132";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_double){
|
||||
@@ -2533,7 +2533,7 @@ TEST(PIString_Tests, setNumber_double){
|
||||
const double val = 131.1324334;
|
||||
str1.setNumber(val, 'f', 7);
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setNumber_ldouble){
|
||||
@@ -2541,45 +2541,45 @@ TEST(PIString_Tests, setNumber_ldouble){
|
||||
const ldouble val = 131.1324334;
|
||||
str1.setNumber(val, 'f', 7);
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1023 B";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1023));
|
||||
ASSERT_EQ(res, str1.setReadableSize(1023));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_kb){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1.0 kB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1024));
|
||||
ASSERT_EQ(res, str1.setReadableSize(1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_mb){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1.0 MB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1024*1024));
|
||||
ASSERT_EQ(res, str1.setReadableSize(1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_gb){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1.0 GB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(1024*1024*1024));
|
||||
ASSERT_EQ(res, str1.setReadableSize(1024*1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_tb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 99999999999999;
|
||||
PIString res = "90.9 TB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(val));
|
||||
ASSERT_EQ(res, str1.setReadableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, setReadableSize_pb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 999999999999999999;
|
||||
PIString res = "888.1 PB";
|
||||
ASSERT_TRUE(res == str1.setReadableSize(val));
|
||||
ASSERT_EQ(res, str1.setReadableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber){
|
||||
@@ -2587,7 +2587,7 @@ TEST(PIString_Tests, fromNumber){
|
||||
const short val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumberr_zero){
|
||||
@@ -2595,7 +2595,7 @@ TEST(PIString_Tests, fromNumberr_zero){
|
||||
const short val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_false_base){
|
||||
@@ -2619,7 +2619,7 @@ TEST(PIString_Tests, fromNumber_false_base_str){
|
||||
const short val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_base_minus){
|
||||
@@ -2627,7 +2627,7 @@ TEST(PIString_Tests, fromNumber_base_minus){
|
||||
const short val = -10;
|
||||
bool ok;
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort){
|
||||
@@ -2635,7 +2635,7 @@ TEST(PIString_Tests, fromNumber_ushort){
|
||||
const ushort val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort_true){
|
||||
@@ -2651,7 +2651,7 @@ TEST(PIString_Tests, fromNumber_ushort_zero){
|
||||
const ushort val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort_false_base){
|
||||
@@ -2667,7 +2667,7 @@ TEST(PIString_Tests, fromNumber_ushort_false_base_str){
|
||||
const ushort val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ushort_base_minus){
|
||||
@@ -2675,7 +2675,7 @@ TEST(PIString_Tests, fromNumber_ushort_base_minus){
|
||||
const ushort val = 10;
|
||||
bool ok;
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int){
|
||||
@@ -2683,7 +2683,7 @@ TEST(PIString_Tests, fromNumber_int){
|
||||
const int val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int_zero){
|
||||
@@ -2691,7 +2691,7 @@ TEST(PIString_Tests, fromNumber_int_zero){
|
||||
const int val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int_false_base){
|
||||
@@ -2715,7 +2715,7 @@ TEST(PIString_Tests, fromNumber_int_false_base_str){
|
||||
const int val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_int_base_minus){
|
||||
@@ -2723,7 +2723,7 @@ TEST(PIString_Tests, fromNumber_int_base_minus){
|
||||
const int val = -10;
|
||||
bool ok;
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint){
|
||||
@@ -2731,7 +2731,7 @@ TEST(PIString_Tests, fromNumber_uint){
|
||||
const uint val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint_true){
|
||||
@@ -2747,7 +2747,7 @@ TEST(PIString_Tests, fromNumber_uintt_zero){
|
||||
const uint val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint_false_base){
|
||||
@@ -2763,7 +2763,7 @@ TEST(PIString_Tests, fromNumber_uint_false_base_str){
|
||||
const uint val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_uint_base_minus){
|
||||
@@ -2771,7 +2771,7 @@ TEST(PIString_Tests, fromNumber_uint_base_minus){
|
||||
const uint val = 10;
|
||||
bool ok;
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long){
|
||||
@@ -2779,7 +2779,7 @@ TEST(PIString_Tests, fromNumber_long){
|
||||
const long val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long_zero){
|
||||
@@ -2787,7 +2787,7 @@ TEST(PIString_Tests, fromNumber_long_zero){
|
||||
const long val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long_false_base){
|
||||
@@ -2811,7 +2811,7 @@ TEST(PIString_Tests, fromNumber_long_false_base_str){
|
||||
const long val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_long_base_minus){
|
||||
@@ -2819,7 +2819,7 @@ TEST(PIString_Tests, fromNumber_long_base_minus){
|
||||
const long val = -10;
|
||||
bool ok;
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong){
|
||||
@@ -2827,7 +2827,7 @@ TEST(PIString_Tests, fromNumber_ulong){
|
||||
const ulong val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong_true){
|
||||
@@ -2843,7 +2843,7 @@ TEST(PIString_Tests, fromNumber_ulong_zero){
|
||||
const ulong val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong_false_base){
|
||||
@@ -2859,7 +2859,7 @@ TEST(PIString_Tests, fromNumber_ulong_false_base_str){
|
||||
const ulong val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ulong_base_minus){
|
||||
@@ -2867,7 +2867,7 @@ TEST(PIString_Tests, fromNumber_ulong_base_minus){
|
||||
const ulong val = 10;
|
||||
bool ok;
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong){
|
||||
@@ -2875,7 +2875,7 @@ TEST(PIString_Tests, fromNumber_llong){
|
||||
const llong val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong_zero){
|
||||
@@ -2883,7 +2883,7 @@ TEST(PIString_Tests, fromNumber_llong_zero){
|
||||
const llong val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong_false_base){
|
||||
@@ -2907,7 +2907,7 @@ TEST(PIString_Tests, fromNumber_llong_false_base_str){
|
||||
const llong val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_llong_base_minus){
|
||||
@@ -2915,7 +2915,7 @@ TEST(PIString_Tests, fromNumber_llong_base_minus){
|
||||
const llong val = -10;
|
||||
bool ok;
|
||||
PIString res = "-A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong){
|
||||
@@ -2923,7 +2923,7 @@ TEST(PIString_Tests, fromNumber_ullong){
|
||||
const ullong val = 131;
|
||||
bool ok;
|
||||
PIString res = "131";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong_true){
|
||||
@@ -2939,7 +2939,7 @@ TEST(PIString_Tests, fromNumber_ullong_zero){
|
||||
const ullong val = 0;
|
||||
bool ok;
|
||||
PIString res = "0";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 10, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 10, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong_false_base){
|
||||
@@ -2955,7 +2955,7 @@ TEST(PIString_Tests, fromNumber_ullong_false_base_str){
|
||||
const ullong val = 131;
|
||||
bool ok;
|
||||
PIString res = "";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 1, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 1, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ullong_base_minus){
|
||||
@@ -2963,63 +2963,63 @@ TEST(PIString_Tests, fromNumber_ullong_base_minus){
|
||||
const ullong val = 10;
|
||||
bool ok;
|
||||
PIString res = "A";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 16, &ok));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 16, &ok));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_float){
|
||||
PIString str1 = " String";
|
||||
const float val = 131.132;
|
||||
PIString res = "131.132";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 'f', 3));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 'f', 3));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_double){
|
||||
PIString str1 = " String";
|
||||
const double val = 131.1324334;
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 'f', 7));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 'f', 7));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromNumber_ldouble){
|
||||
PIString str1 = " String";
|
||||
const ldouble val = 131.1324334;
|
||||
PIString res = "131.1324334";
|
||||
ASSERT_TRUE(res == str1.fromNumber(val, 'f', 7));
|
||||
ASSERT_EQ(res, str1.fromNumber(val, 'f', 7));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromBool_true){
|
||||
PIString str1;
|
||||
bool val = true;
|
||||
PIString res = "true";
|
||||
ASSERT_TRUE(res == str1.fromBool(val));
|
||||
ASSERT_EQ(res, str1.fromBool(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, fromBool_false){
|
||||
PIString str1;
|
||||
bool val = false;
|
||||
PIString res = "false";
|
||||
ASSERT_TRUE(res == str1.fromBool(val));
|
||||
ASSERT_EQ(res, str1.fromBool(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_Console){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromConsole(s));
|
||||
ASSERT_EQ(res, str1.fromConsole(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_System){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromSystem(s));
|
||||
ASSERT_EQ(res, str1.fromSystem(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_UTF8){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromUTF8(s));
|
||||
ASSERT_EQ(res, str1.fromUTF8(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_UTF8_ba){
|
||||
@@ -3030,14 +3030,14 @@ TEST(PIString_Tests, from_UTF8_ba){
|
||||
s.append('u');
|
||||
s.append('e');
|
||||
PIString res = "true";
|
||||
ASSERT_TRUE(res == str1.fromUTF8(s));
|
||||
ASSERT_EQ(res, str1.fromUTF8(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_Ascii){
|
||||
PIString str1;
|
||||
char s[] = "true boy";
|
||||
PIString res = "true boy";
|
||||
ASSERT_TRUE(res == str1.fromAscii(s));
|
||||
ASSERT_EQ(res, str1.fromAscii(s));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, from_Codepage){
|
||||
@@ -3046,59 +3046,59 @@ TEST(PIString_Tests, from_Codepage){
|
||||
char c[] = "utf8";
|
||||
PIString str2 = str1.fromCodepage(s, c);
|
||||
PIString res = "true";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, ReadableSize){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1023 B";
|
||||
ASSERT_TRUE(res == str1.readableSize(1023));
|
||||
ASSERT_EQ(res, str1.readableSize(1023));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_kb){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1.0 kB";
|
||||
ASSERT_TRUE(res == str1.readableSize(1024));
|
||||
ASSERT_EQ(res, str1.readableSize(1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_mb){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1.0 MB";
|
||||
ASSERT_TRUE(res == str1.readableSize(1024*1024));
|
||||
ASSERT_EQ(res, str1.readableSize(1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_gb){
|
||||
PIString str1 = " ITELMA";
|
||||
PIString res = "1.0 GB";
|
||||
ASSERT_TRUE(res == str1.readableSize(1024*1024*1024));
|
||||
ASSERT_EQ(res, str1.readableSize(1024*1024*1024));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_tb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 99999999999999;
|
||||
PIString res = "90.9 TB";
|
||||
ASSERT_TRUE(res == str1.readableSize(val));
|
||||
ASSERT_EQ(res, str1.readableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, readableSize_pb){
|
||||
PIString str1 = " ITELMA";
|
||||
llong val = 999999999999999999;
|
||||
PIString res = "888.1 PB";
|
||||
ASSERT_TRUE(res == str1.readableSize(val));
|
||||
ASSERT_EQ(res, str1.readableSize(val));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, removeAll_char){
|
||||
PIString str1 = "A very strong programmer wrote this code";
|
||||
char v = ' ';
|
||||
PIString res = "Averystrongprogrammerwrotethiscode";
|
||||
ASSERT_TRUE(res == str1.removeAll(v));
|
||||
ASSERT_EQ(res, str1.removeAll(v));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, removeAll_pistring){
|
||||
PIString str1 = "A very strong programmer wrote this code";
|
||||
PIString v = "very strong ";
|
||||
PIString res = "A programmer wrote this code";
|
||||
ASSERT_TRUE(res == str1.removeAll(v));
|
||||
ASSERT_EQ(res, str1.removeAll(v));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_ba_pstr){
|
||||
@@ -3106,7 +3106,7 @@ TEST(PIString_Tests, operator_ba_pstr){
|
||||
PIByteArray s;
|
||||
s << str1;
|
||||
PIString res = "010000003100";
|
||||
ASSERT_TRUE(res == s.toHex());
|
||||
ASSERT_EQ(res, s.toHex());
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_pstr_ba){
|
||||
@@ -3118,28 +3118,28 @@ TEST(PIString_Tests, operator_pstr_ba){
|
||||
s.append('e');
|
||||
str1 << s;
|
||||
PIString res = "1true";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_plus_pstr_pstr){
|
||||
PIString str1 = "first ";
|
||||
PIString str2 = "second";
|
||||
PIString res = "first second";
|
||||
ASSERT_TRUE(res == str1 + str2);
|
||||
ASSERT_EQ(res, str1 + str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_plus_pstr_chars){
|
||||
PIString str1 = "first ";
|
||||
char str2[] = "second";
|
||||
PIString res = "first second";
|
||||
ASSERT_TRUE(res == str1 + str2);
|
||||
ASSERT_EQ(res, str1 + str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_plus_chars_pstr){
|
||||
PIString str1 = "first";
|
||||
char str2[] = "second ";
|
||||
PIString res = "second first";
|
||||
ASSERT_TRUE(res == str2 + str1);
|
||||
ASSERT_EQ(res, str2 + str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, version_Compare){
|
||||
@@ -3161,7 +3161,7 @@ TEST(PIString_Tests, version_Compare_component){
|
||||
TEST(PIString_Tests, version_Normalize){
|
||||
PIString str1 = "first second";
|
||||
PIString res = "0.0_first second";
|
||||
ASSERT_TRUE(res == versionNormalize(str1));
|
||||
ASSERT_EQ(res, versionNormalize(str1));
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, pi_Hash){
|
||||
@@ -3174,7 +3174,7 @@ TEST(PIString_Tests, pi_Swap){
|
||||
PIString str2 = "second";
|
||||
piSwap(str1, str2);
|
||||
PIString res = "first";
|
||||
ASSERT_TRUE(res == str2);
|
||||
ASSERT_EQ(res, str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, piSwap_sec){
|
||||
@@ -3182,16 +3182,5 @@ TEST(PIString_Tests, piSwap_sec){
|
||||
PIString str2 = "second";
|
||||
piSwap(str1, str2);
|
||||
PIString res = "second";
|
||||
ASSERT_TRUE(res == str1);
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user