code improvement
This commit is contained in:
@@ -8,55 +8,123 @@ TEST(PIStringList_Tests, construct_empty){
|
||||
ASSERT_TRUE(lis.isEmpty());
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_one_str){
|
||||
TEST(PIStringList_Tests, construct_one_str_size){
|
||||
PIString str1 = "first string";
|
||||
PIStringList lis {str1};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis.length() == 1);
|
||||
ASSERT_EQ(lis.length(),1);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_one_str_rvalue){
|
||||
TEST(PIStringList_Tests, construct_one_str_data){
|
||||
PIString str1 = "first string";
|
||||
PIStringList lis {str1};
|
||||
ASSERT_EQ(str1, lis[0]);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_one_str_rvalue_size){
|
||||
PIString str1 = "first string";
|
||||
PIStringList lis {"first string"};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis.length() == 1);
|
||||
ASSERT_EQ(lis.length(), 1);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_two_str){
|
||||
TEST(PIStringList_Tests, construct_one_str_rvalue_data){
|
||||
PIString str1 = "first string";
|
||||
PIStringList lis {"first string"};
|
||||
ASSERT_EQ(str1, lis[0]);
|
||||
}
|
||||
TEST(PIStringList_Tests, construct_two_str_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIStringList lis {str1, str2};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis.length() == 2);
|
||||
ASSERT_EQ(lis.length(), 2);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_two_str_rvalue){
|
||||
TEST(PIStringList_Tests, construct_two_str_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIStringList lis {str1, str2};
|
||||
ASSERT_EQ(str1, lis[0]);
|
||||
ASSERT_EQ(str2, lis[1]);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_two_str_rvalue_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIStringList lis {"first string", "second string"};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis.length() == 2);
|
||||
ASSERT_EQ(lis.length(), 2);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_three_str){
|
||||
TEST(PIStringList_Tests, construct_two_str_rvalue_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIStringList lis {"first string", "second string"};
|
||||
ASSERT_EQ(str1, lis[0]);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_three_str_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIStringList lis {str1, str2, str3};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis.length() == 3);
|
||||
ASSERT_EQ(lis.length(),3);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_three_str_rvalue){
|
||||
TEST(PIStringList_Tests, construct_three_str_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIStringList lis {str1, str2, str3};
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_three_str_rvalue_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIStringList lis {"first string", "second string", "third string"};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis.length() == 3);
|
||||
ASSERT_EQ(lis.length(), 3);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_four_str){
|
||||
TEST(PIStringList_Tests, construct_three_str_rvalue_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIStringList lis {"first string", "second string", "third string"};
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_four_str_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis[3] == str4 && lis.length() == 4);
|
||||
ASSERT_EQ(lis.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_four_str_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
ASSERT_EQ(lis[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_four_str_rvalue_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {"first string", "second string", "third string", "fourth string"};
|
||||
ASSERT_EQ(lis.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_four_str_rvalue){
|
||||
@@ -65,30 +133,59 @@ TEST(PIStringList_Tests, construct_four_str_rvalue){
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {"first string", "second string", "third string", "fourth string"};
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis[3] == str4 && lis.length() == 4);
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
ASSERT_EQ(lis[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_list){
|
||||
TEST(PIStringList_Tests, construct_list_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
PIStringList list {lis};
|
||||
ASSERT_TRUE(str1 == list[0] && list[1] == str2 && list[2] == str3 && list[3] == str4 && list.length() == 4);
|
||||
ASSERT_EQ(list.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_list_rvalue){
|
||||
TEST(PIStringList_Tests, construct_list_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
PIStringList list {lis};
|
||||
ASSERT_EQ(list[0], str1);
|
||||
ASSERT_EQ(list[1], str2);
|
||||
ASSERT_EQ(list[2], str3);
|
||||
ASSERT_EQ(list[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_list_rvalue_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {"first string", "second string", "third string", "fourth string"};
|
||||
PIStringList list {move(lis)};
|
||||
ASSERT_TRUE(str1 == list[0] && list[1] == str2 && list[2] == str3 && list[3] == str4 && list.length() == 4);
|
||||
ASSERT_EQ(list.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_pivect){
|
||||
TEST(PIStringList_Tests, construct_list_rvalue_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {"first string", "second string", "third string", "fourth string"};
|
||||
PIStringList list {move(lis)};
|
||||
ASSERT_EQ(list[0], str1);
|
||||
ASSERT_EQ(list[1], str2);
|
||||
ASSERT_EQ(list[2], str3);
|
||||
ASSERT_EQ(list[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_pivect_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
@@ -99,10 +196,27 @@ TEST(PIStringList_Tests, construct_pivect){
|
||||
vect.append(str3);
|
||||
vect.append(str4);
|
||||
PIStringList list {vect};
|
||||
ASSERT_TRUE(str1 == list[0] && list[1] == str2 && list[2] == str3 && list[3] == str4 && list.length() == 4);
|
||||
ASSERT_EQ(list.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_list_pideq){
|
||||
TEST(PIStringList_Tests, construct_pivect_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIVector<PIString> vect;
|
||||
vect.append(str1);
|
||||
vect.append(str2);
|
||||
vect.append(str3);
|
||||
vect.append(str4);
|
||||
PIStringList list {vect};
|
||||
ASSERT_EQ(list[0], str1);
|
||||
ASSERT_EQ(list[1], str2);
|
||||
ASSERT_EQ(list[2], str3);
|
||||
ASSERT_EQ(list[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_list_pideq_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
@@ -113,7 +227,24 @@ TEST(PIStringList_Tests, construct_list_pideq){
|
||||
deq.append(str3);
|
||||
deq.append(str4);
|
||||
PIStringList list {deq};
|
||||
ASSERT_TRUE(str1 == list[0] && list[1] == str2 && list[2] == str3 && list[3] == str4 && list.length() == 4);
|
||||
ASSERT_EQ(list.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, construct_list_pideq_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIDeque<PIString> deq;
|
||||
deq.append(str1);
|
||||
deq.append(str2);
|
||||
deq.append(str3);
|
||||
deq.append(str4);
|
||||
PIStringList list {deq};
|
||||
ASSERT_EQ(list[0], str1);
|
||||
ASSERT_EQ(list[1], str2);
|
||||
ASSERT_EQ(list[2], str3);
|
||||
ASSERT_EQ(list[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, join){
|
||||
@@ -123,10 +254,10 @@ TEST(PIStringList_Tests, join){
|
||||
PIString str4 = "fourth string";
|
||||
PIString del = ", ";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
ASSERT_TRUE(lis.join(del) == "first string, second string, third string, fourth string");
|
||||
ASSERT_EQ(lis.join(del), "first string, second string, third string, fourth string");
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove_strings){
|
||||
TEST(PIStringList_Tests, remove_strings_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "string";
|
||||
PIString str3 = "third string";
|
||||
@@ -134,56 +265,114 @@ TEST(PIStringList_Tests, remove_strings){
|
||||
PIString val = "string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.removeStrings(val);
|
||||
ASSERT_TRUE(lis[0] == "first string" && lis[1] == "third string" && lis.length() == 2);
|
||||
ASSERT_EQ(lis.length(), 2);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove){
|
||||
TEST(PIStringList_Tests, remove_strings_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "string";
|
||||
PIString val = "string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.removeStrings(val);
|
||||
ASSERT_EQ(lis[0], "first string");
|
||||
ASSERT_EQ(lis[1], "third string");
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.remove(2);
|
||||
ASSERT_TRUE(lis[0] == "first string" && lis[1] == "second string" && lis[2] == "fourth string" && lis.length() == 3);
|
||||
ASSERT_EQ(lis.length(), 3);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove_count){
|
||||
TEST(PIStringList_Tests, remove_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.remove(2);
|
||||
ASSERT_EQ(lis[0], "first string");
|
||||
ASSERT_EQ(lis[1], "second string");
|
||||
ASSERT_EQ(lis[2], "fourth string");
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove_count_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.remove(2,2);
|
||||
ASSERT_TRUE(lis[0] == "first string" && lis[1] == "second string" && lis.length() == 2);
|
||||
ASSERT_EQ(lis.length(), 2);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove_Duplicates){
|
||||
TEST(PIStringList_Tests, remove_count_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.remove(2,2);
|
||||
ASSERT_EQ(lis[0], "first string");
|
||||
ASSERT_EQ(lis[1], "second string");
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, remove_Duplicates_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "first string";
|
||||
PIString str4 = "second string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.removeDuplicates();
|
||||
ASSERT_TRUE(lis[0] == "first string" && lis[1] == "second string" && lis.length() == 2);
|
||||
ASSERT_EQ(lis.length(), 2);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, trim){
|
||||
TEST(PIStringList_Tests, remove_Duplicates_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "first string";
|
||||
PIString str4 = "second string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.removeDuplicates();
|
||||
ASSERT_EQ(lis[0], "first string");
|
||||
ASSERT_EQ(lis[1], "second string");
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, trim_size){
|
||||
PIString str1 = " first string ";
|
||||
PIString str2 = "second string ";
|
||||
PIString str3 = " third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.trim();
|
||||
ASSERT_TRUE(lis[0] == "first string" && lis[1] == "second string" && lis[2] == "third string" && lis[3] == "fourth string" && lis.length() == 4);
|
||||
ASSERT_EQ(lis.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, trim_data){
|
||||
PIString str1 = " first string ";
|
||||
PIString str2 = "second string ";
|
||||
PIString str3 = " third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
lis.trim();
|
||||
ASSERT_EQ(lis[0], "first string");
|
||||
ASSERT_EQ(lis[1], "second string");
|
||||
ASSERT_EQ(lis[2], "third string");
|
||||
ASSERT_EQ(lis[3], "fourth string");
|
||||
}
|
||||
TEST(PIStringList_Tests, content_size){
|
||||
PIString str1 = " first string ";
|
||||
PIString str2 = "second string ";
|
||||
PIString str3 = " third string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
ASSERT_TRUE(lis.contentSize() == 54);
|
||||
ASSERT_EQ(lis.contentSize(), 54);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_compare){
|
||||
@@ -248,37 +437,76 @@ TEST(PIStringList_Tests, operator_compare_unequal_size){
|
||||
ASSERT_TRUE(lis != lis1);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_assignment){
|
||||
TEST(PIStringList_Tests, operator_assignment_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
PIStringList lis1 = lis;
|
||||
ASSERT_TRUE(str1 == lis1[0] && lis1[1] == str2 && lis1[2] == str3 && lis1[3] == str4 && lis1.length() == 4);
|
||||
ASSERT_EQ(lis1.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift){
|
||||
TEST(PIStringList_Tests, operator_assignment_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3, str4};
|
||||
PIStringList lis1 = lis;
|
||||
ASSERT_EQ(lis1[0], str1);
|
||||
ASSERT_EQ(lis1[1], str2);
|
||||
ASSERT_EQ(lis1[2], str3);
|
||||
ASSERT_EQ(lis1[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3};
|
||||
lis << str4;
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis[3] == str4 && lis.length() == 4);
|
||||
ASSERT_EQ(lis.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_rvalue){
|
||||
TEST(PIStringList_Tests, operator_shift_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3};
|
||||
lis << str4;
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
ASSERT_EQ(lis[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_rvalue_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3};
|
||||
lis << "fourth string";
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis[3] == str4 && lis.length() == 4);
|
||||
ASSERT_EQ(lis.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_pistringlist){
|
||||
TEST(PIStringList_Tests, operator_shift_rvalue_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2, str3};
|
||||
lis << "fourth string";
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
ASSERT_EQ(lis[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_pistringlist_size){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
@@ -286,7 +514,21 @@ TEST(PIStringList_Tests, operator_shift_pistringlist){
|
||||
PIStringList lis {str1, str2};
|
||||
PIStringList lis1 {str3, str4};
|
||||
lis << lis1;
|
||||
ASSERT_TRUE(str1 == lis[0] && lis[1] == str2 && lis[2] == str3 && lis[3] == str4 && lis.length() == 4);
|
||||
ASSERT_EQ(lis.length(), 4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_pistringlist_data){
|
||||
PIString str1 = "first string";
|
||||
PIString str2 = "second string";
|
||||
PIString str3 = "thord string";
|
||||
PIString str4 = "fourth string";
|
||||
PIStringList lis {str1, str2};
|
||||
PIStringList lis1 {str3, str4};
|
||||
lis << lis1;
|
||||
ASSERT_EQ(lis[0], str1);
|
||||
ASSERT_EQ(lis[1], str2);
|
||||
ASSERT_EQ(lis[2], str3);
|
||||
ASSERT_EQ(lis[3], str4);
|
||||
}
|
||||
|
||||
TEST(PIStringList_Tests, operator_shift_pibytearray){
|
||||
@@ -312,5 +554,5 @@ TEST(PIStringList_Tests, operator_shift_right_pibytearray){
|
||||
arr << res;
|
||||
PIStringList list;
|
||||
arr >> list;
|
||||
ASSERT_TRUE(res == list);
|
||||
ASSERT_EQ(res, list);
|
||||
}
|
||||
|
||||
@@ -118,12 +118,8 @@ TEST(PIByteArray_Tests, convert_from_base64_empty){
|
||||
|
||||
TEST(PIByteArray_Tests, to_base64){
|
||||
PIByteArray arr((void*)"PIP is great", 12);
|
||||
PIByteArray old((void*)"PIP is great", 12);
|
||||
PIByteArray arr2 = arr.toBase64();
|
||||
|
||||
ASSERT_EQ(arr, old);
|
||||
ASSERT_NE(arr2, old);
|
||||
|
||||
PIByteArray arr1(16);
|
||||
arr1[0] = 85;
|
||||
arr1[1] = 69;
|
||||
@@ -145,6 +141,13 @@ TEST(PIByteArray_Tests, to_base64){
|
||||
ASSERT_EQ(arr2, arr1);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, to_base64_immutability){
|
||||
PIByteArray arr((void*)"PIP is great", 12);
|
||||
PIByteArray old((void*)"PIP is great", 12);
|
||||
PIByteArray arr2 = arr.toBase64();
|
||||
ASSERT_EQ(arr, old);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, to_base64_empty){
|
||||
PIByteArray arr;
|
||||
arr.toBase64();
|
||||
@@ -179,7 +182,6 @@ TEST(PIByteArray_Tests, decompress_rle){
|
||||
|
||||
TEST(PIByteArray_Tests, compress_rle_point){
|
||||
PIByteArray arr((void*)"nnnnew", 6);
|
||||
PIByteArray arr2((void*)"nnnnew", 6);
|
||||
PIByteArray arr1 = arr.compressedRLE(15);
|
||||
PIByteArray res(6);
|
||||
res[0] = 19;
|
||||
@@ -189,10 +191,28 @@ TEST(PIByteArray_Tests, compress_rle_point){
|
||||
res[4] = 16;
|
||||
res[5] = 119;
|
||||
ASSERT_EQ(arr1, res);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, compress_rle_point_immutability){
|
||||
PIByteArray arr((void*)"nnnnew", 6);
|
||||
PIByteArray arr2((void*)"nnnnew", 6);
|
||||
PIByteArray arr1 = arr.compressedRLE(15);
|
||||
ASSERT_EQ(arr, arr2);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, decompress_rle_point){
|
||||
PIByteArray arr(4);
|
||||
arr[0] = 17;
|
||||
arr[1] = 110;
|
||||
arr[2] = 16;
|
||||
arr[3] = 101;
|
||||
PIByteArray arr1 = arr.decompressedRLE(15);
|
||||
PIByteArray res((void*)"nne", 3);
|
||||
ASSERT_EQ(arr1, res);
|
||||
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, decompress_rle_point_immutability){
|
||||
PIByteArray arr(4);
|
||||
arr[0] = 17;
|
||||
arr[1] = 110;
|
||||
@@ -204,8 +224,6 @@ TEST(PIByteArray_Tests, decompress_rle_point){
|
||||
arr2[2] = 16;
|
||||
arr2[3] = 101;
|
||||
PIByteArray arr1 = arr.decompressedRLE(15);
|
||||
PIByteArray res((void*)"nne", 3);
|
||||
ASSERT_EQ(arr1, res);
|
||||
ASSERT_EQ(arr, arr2);
|
||||
}
|
||||
|
||||
@@ -213,7 +231,7 @@ TEST(PIByteArray_Tests, to_string){
|
||||
PIByteArray arr((void*)"new", 3);
|
||||
PIString str = arr.toString();
|
||||
PIString res = "0x6E 0x65 0x77";
|
||||
ASSERT_TRUE(res == str);
|
||||
ASSERT_EQ(res, str);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,21 +239,21 @@ TEST(PIByteArray_Tests, to_string_10){
|
||||
PIByteArray arr((void*)"new", 3);
|
||||
PIString str = arr.toString(10);
|
||||
PIString res = "110 101 119";
|
||||
ASSERT_TRUE(res == str);
|
||||
ASSERT_EQ(res, str);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, to_string_2){
|
||||
PIByteArray arr((void*)"new", 3);
|
||||
PIString str = arr.toString(2);
|
||||
PIString res = "b1101110 b1100101 b1110111";
|
||||
ASSERT_TRUE(res == str);
|
||||
ASSERT_EQ(res, str);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, to_string_8){
|
||||
PIByteArray arr((void*)"new", 3);
|
||||
PIString str = arr.toString(8);
|
||||
PIString res = "0156 0145 0167";
|
||||
ASSERT_TRUE(res == str);
|
||||
ASSERT_EQ(res, str);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, to_hex){
|
||||
@@ -243,7 +261,7 @@ TEST(PIByteArray_Tests, to_hex){
|
||||
arr[0] = 15;
|
||||
PIString str = arr.toHex();
|
||||
PIString res = "0f";
|
||||
ASSERT_TRUE(res == str);
|
||||
ASSERT_EQ(res, str);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, append){
|
||||
@@ -735,7 +753,7 @@ TEST(PIByteArray_Tests, operator_shift_right_RawData){
|
||||
PIByteArray::RawData res((void*)"new", 3);
|
||||
PIByteArray res_arr;
|
||||
res_arr << res;
|
||||
ASSERT_TRUE(res_arr == arr);
|
||||
ASSERT_EQ(res_arr, arr);
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, operator_shift_PIPair){
|
||||
@@ -1027,13 +1045,12 @@ TEST(PIByteArray_Tests, operator_shift_right_PIVector2D){
|
||||
res.element(1, 0) = 'o';
|
||||
res.element(1, 1) = 'l';
|
||||
res.element(1, 2) = 'd';
|
||||
ASSERT_TRUE(vec2.element(0,0) == res.element(0,0) &&
|
||||
vec2.element(0,1) == res.element(0,1) &&
|
||||
vec2.element(0,2) == res.element(0,2) &&
|
||||
vec2.element(1,0) == res.element(1,0) &&
|
||||
vec2.element(1,1) == res.element(1,1) &&
|
||||
vec2.element(1,2) == res.element(1,2));
|
||||
|
||||
ASSERT_EQ(vec2.element(0,0), res.element(0,0));
|
||||
ASSERT_EQ(vec2.element(0,1), res.element(0,1));
|
||||
ASSERT_EQ(vec2.element(0,2), res.element(0,2));
|
||||
ASSERT_EQ(vec2.element(1,0), res.element(1,0));
|
||||
ASSERT_EQ(vec2.element(1,1), res.element(1,1));
|
||||
ASSERT_EQ(vec2.element(1,2), res.element(1,2));
|
||||
}
|
||||
|
||||
TEST(PIByteArray_Tests, operator_shift_template){
|
||||
|
||||
@@ -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