From 09bda3cfa88220e2413e7bf35f1193e7db4fe7e3 Mon Sep 17 00:00:00 2001 From: Tijmen van Nesselrooij Date: Sat, 18 May 2019 12:59:00 +0200 Subject: [PATCH] Merge binary tree debug test cases with unit tests --- test/binarytree.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/test/binarytree.cpp b/test/binarytree.cpp index 5c8e5d4..9f7ee9a 100644 --- a/test/binarytree.cpp +++ b/test/binarytree.cpp @@ -104,7 +104,7 @@ bool TestDeletion() return true; } -bool DebugDeletionCase( +bool TestDeletionCase( std::vector const toInsert, std::vector const toDelete, std::vector const result) @@ -142,28 +142,28 @@ bool DebugDeletionCase( return ok; } -bool DebugDeletion() +bool TestDeletionCases() { std::puts("Testing deleting root with single child right."); - DebugDeletionCase( + TestDeletionCase( std::vector { 10, 12, 11, 13}, std::vector { 10 }, std::vector { 12, 11, 13 }); std::puts("Testing deleting root with single child left."); - DebugDeletionCase( + TestDeletionCase( std::vector { 15, 12, 11, 13}, std::vector { 15 }, std::vector { 12, 11, 13 }); std::puts("Testing deleting root with 2 children but no child right left."); - DebugDeletionCase( + TestDeletionCase( std::vector { 15, 10, 20, 22, 25, 18, 5}, std::vector { 20 }, std::vector { 15, 10, 22, 25, 18, 5 }); std::puts("Testing deleting root with 2 children."); - DebugDeletionCase( + TestDeletionCase( std::vector { 50, 40, 60, 75, 55, 45, 42, 58 }, std::vector { 50 }, std::vector { 40, 60, 75, 55, 45, 42, 58 }); @@ -171,18 +171,12 @@ bool DebugDeletion() return true; } -void Debug() -{ - std::puts("\n*** DEBUG ***"); - Test::Execute(DebugDeletion, "Deletion debug test"); -} - int main() { Test::Execute(TestInsert, "Insertion and find test"); Test::Execute(TestInsertNoDuplicates, "Insertion without duplicates test"); Test::Execute(TestDeletion, "Insertion and deletion test"); - Debug(); + Test::Execute(TestDeletionCases, "Deletion cases test"); return 0; } \ No newline at end of file