Testing removing dublicated reports

This commit is contained in:
IlushaShurupov 2023-06-30 09:07:48 +03:00
parent 47a7809398
commit 2c94e02260
3 changed files with 15 additions and 5 deletions

5
TODO
View file

@ -1,9 +1,9 @@
Containers:
ADd check copy times
ADd check copy times !
Addbuff
Vector
Vector 2d
AVL dont copy data just swap
AVL dont copy data just swap !
Strings:
Implement
@ -12,6 +12,7 @@ Math:
Implement
Utils:
Group failed checks by source !!
Stack trace fixes
Tokenizer:

View file

@ -22,7 +22,13 @@ void Testing::endTest() {
}
void Testing::addFailedCheck(const FailedCheck& info) {
mCurrent->mFailedChecks.pushBack(info);
DEBUG_BREAK(0 && info.expression);
auto lastRecord = &mCurrent->mFailedChecks.last()->data;
if (lastRecord && lastRecord->failedCheck.file == info.file && lastRecord->failedCheck.line == info.line) {
lastRecord->times++;
return;
}
mCurrent->mFailedChecks.pushBack({ info, 1 });
}
void Testing::reportState() {
@ -58,7 +64,9 @@ void Testing::TestingNode::report(const char* path) const {
auto newPath = path ? std::string(path) + "/" + mName : std::string(mName);
for (auto check : mFailedChecks) {
printf("%s Failed - (%s) %s:%llu\n", newPath.c_str(), check.data().expression, check.data().file, check.data().line);
auto failedCheck = &check.data().failedCheck;
auto times = check.data().times;
printf("%s Failed - (%s) %s:%llu x%i\n", newPath.c_str(), failedCheck->expression, failedCheck->file, failedCheck->line, (halni) times);
}
for (const auto& child : mSubTests) {

View file

@ -23,7 +23,8 @@ namespace tp {
private:
struct TestingNode {
List<FailedCheck> mFailedChecks;
struct FailedCheckRecord { FailedCheck failedCheck; ualni times; };
List<FailedCheckRecord> mFailedChecks;
List<TestingNode*> mSubTests;
const char* mName = "Unnamed";
TestingNode* mParent = nullptr;