new gtest
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
#include "pistring.h"
|
||||
|
||||
#include "math.h"
|
||||
#include "pistringlist.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<typename T>
|
||||
bool is_equal(T x, T y) {
|
||||
return std::fabs(x - y) < std::numeric_limits<T>::epsilon();
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, constructor_empty) {
|
||||
PIString str1;
|
||||
ASSERT_TRUE(str1.isEmpty());
|
||||
@@ -498,107 +490,3 @@ TEST(PIString_Tests, operator_grater_eq_cstring_true_equal) {
|
||||
char str2[] = "t";
|
||||
ASSERT_TRUE(str1 >= str2);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_pistring) {
|
||||
PIString str1 = "shift";
|
||||
PIString str2 = " good";
|
||||
str1 << str2;
|
||||
PIString res = "shift good";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_pichar) {
|
||||
PIString str1 = "shif";
|
||||
PIChar str2 = 't';
|
||||
str1 << str2;
|
||||
PIString res = "shift";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_cstring) {
|
||||
PIString str1 = "shif";
|
||||
char str2[] = "t chat";
|
||||
str1 << str2;
|
||||
PIString res = "shift chat";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_wchar_t) {
|
||||
PIString str1 = "shif";
|
||||
wchar_t str2[] = L"t cc";
|
||||
str1 << str2;
|
||||
PIString res = "shift cc";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_int) {
|
||||
PIString str1 = "shift ";
|
||||
int numb = -2147483648;
|
||||
str1 << numb;
|
||||
PIString res = "shift -2147483648";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_uint) {
|
||||
PIString str1 = "shift ";
|
||||
uint numb = 4294967295;
|
||||
str1 << numb;
|
||||
PIString res = "shift 4294967295";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_short) {
|
||||
PIString str1 = "shift ";
|
||||
short numb = -32768;
|
||||
str1 << numb;
|
||||
PIString res = "shift -32768";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ushort) {
|
||||
PIString str1 = "shift ";
|
||||
ushort numb = 65535;
|
||||
str1 << numb;
|
||||
PIString res = "shift 65535";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_long) {
|
||||
PIString str1 = "shift ";
|
||||
long numb = -2147483648;
|
||||
str1 << numb;
|
||||
PIString res = "shift -2147483648";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ulong) {
|
||||
PIString str1 = "shift ";
|
||||
ulong numb = 4294967295;
|
||||
str1 << numb;
|
||||
PIString res = "shift 4294967295";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_llong) {
|
||||
PIString str1 = "shift ";
|
||||
llong numb = -9223372036854775807;
|
||||
str1 << numb;
|
||||
PIString res = "shift -9223372036854775807";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_ullong) {
|
||||
PIString str1 = "shift ";
|
||||
ullong numb = 1844674407370955161;
|
||||
str1 << numb;
|
||||
PIString res = "shift 1844674407370955161";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
TEST(PIString_Tests, operator_shift_float) {
|
||||
PIString str1 = "shift ";
|
||||
float numb = -67.88999939f;
|
||||
str1 << numb;
|
||||
PIString res = "shift -67.88999939";
|
||||
ASSERT_EQ(res, str1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user