v3
This commit is contained in:
parent
459e111f2f
commit
6ca06962d9
9 changed files with 642 additions and 21 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Tóth Dániel Mátyás | IFPQYY | v2
|
||||
// Tóth Dániel Mátyás | IFPQYY | v3
|
||||
#include "pch.h"
|
||||
#include "CppUnitTest.h"
|
||||
#include <CMyString.h>
|
||||
|
|
@ -108,7 +108,14 @@ namespace UnitTest1
|
|||
}
|
||||
}
|
||||
catch (const CMyStringException& e) {
|
||||
Assert::AreEqual(CMyStringException::ErrInvalidChar, e.what());
|
||||
if (repeatchargs[i] == '\0')
|
||||
{
|
||||
Assert::AreEqual(CMyStringException::ErrInvalidChar, e.what());
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert::AreEqual(CMyStringException::ErrCount, e.what());
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -226,8 +233,14 @@ namespace UnitTest1
|
|||
Assert::IsTrue(false);
|
||||
}
|
||||
}
|
||||
CMyString str1 = CMyString("test");
|
||||
CMyString str2 = str1;
|
||||
CMyString str1 = CMyString("narancsnarancsnarancs");
|
||||
CMyString str2 = CMyString("eper");
|
||||
const char* cptr = str1.c_str();
|
||||
str1 = str2;
|
||||
str1.shrink_to_fit();
|
||||
Assert::AreEqual((size_t)4, str1.size());
|
||||
Assert::AreEqual((size_t)5, str1.capacity());
|
||||
Assert::AreNotEqual(cptr, str1.c_str());
|
||||
}
|
||||
|
||||
TEST_METHOD(GetAtTests) {
|
||||
|
|
@ -452,6 +465,7 @@ namespace UnitTest1
|
|||
Assert::IsTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
TEST_METHOD(ReverseTests) {
|
||||
CMyString str[]{
|
||||
|
|
@ -495,6 +509,7 @@ namespace UnitTest1
|
|||
CMyString("test"),
|
||||
CMyString("banan"),
|
||||
CMyString("banan"),
|
||||
CMyString("alma"),
|
||||
};
|
||||
const char* text[] = {
|
||||
"",
|
||||
|
|
@ -509,6 +524,7 @@ namespace UnitTest1
|
|||
"a",
|
||||
"narancs",
|
||||
"narancs",
|
||||
"dio",
|
||||
};
|
||||
size_t extraargs[][2] = {
|
||||
{ 0, ~0 },
|
||||
|
|
@ -523,6 +539,7 @@ namespace UnitTest1
|
|||
{ 0, ~0 },
|
||||
{ 0, ~0 },
|
||||
{ 2, 2 },
|
||||
{ 3, 1 },
|
||||
};
|
||||
int sizes[][2] = {
|
||||
{ 0, 1 },
|
||||
|
|
@ -537,6 +554,7 @@ namespace UnitTest1
|
|||
{ 5, 12 },
|
||||
{ 12, 26 },
|
||||
{ 7, 16 },
|
||||
{ 4, 5 },
|
||||
};
|
||||
const char* expected[] = {
|
||||
"",
|
||||
|
|
@ -551,6 +569,7 @@ namespace UnitTest1
|
|||
"testa",
|
||||
"banannarancs",
|
||||
"bananra",
|
||||
"alma",
|
||||
};
|
||||
int testcount = sizeof(text) / sizeof(char*);
|
||||
for (size_t i = 0; i < testcount; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue