Adding Strings tests
This commit is contained in:
parent
91b00817e3
commit
6bca7431b7
7 changed files with 357 additions and 121 deletions
|
|
@ -1,16 +1,37 @@
|
|||
|
||||
#include "Testing.hpp"
|
||||
#include "Tests.hpp"
|
||||
#include "Strings.hpp"
|
||||
|
||||
TEST_DEF_STATIC(StringLogic) {
|
||||
// TEST(false);
|
||||
}
|
||||
using namespace tp;
|
||||
|
||||
struct TestStruct {
|
||||
String str = "test data";
|
||||
};
|
||||
|
||||
TEST_DEF_STATIC(Simple) {
|
||||
// TEST(false);
|
||||
String str;
|
||||
TEST(str.getIsConstFlag());
|
||||
TEST(str.getReferenceCount() == 2);
|
||||
|
||||
String str2;
|
||||
TEST(str.getIsConstFlag());
|
||||
TEST(str.getReferenceCount() == 3);
|
||||
|
||||
auto tmp = new TestStruct();
|
||||
TEST(tmp->str.getIsConstFlag());
|
||||
TEST(tmp->str.getReferenceCount() == 1);
|
||||
|
||||
str = tmp->str;
|
||||
|
||||
TEST(str.getIsConstFlag());
|
||||
TEST(str.getReferenceCount() == 2);
|
||||
|
||||
delete tmp;
|
||||
|
||||
TEST(str.getIsConstFlag());
|
||||
TEST(str.getReferenceCount() == 1);
|
||||
}
|
||||
|
||||
TEST_DEF(Strings) {
|
||||
testStringLogic();
|
||||
testSimple();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue