diff options
| author | Chanin Timbal <[email protected]> | 2024-06-05 15:25:47 -0700 |
|---|---|---|
| committer | Chanin Timbal <[email protected]> | 2024-06-05 15:25:47 -0700 |
| commit | 4646ce2a21cd6cba10af60cc3e821eb83ee7e5f9 (patch) | |
| tree | e540a264b95d2aaec40709cb79db67345100b8e3 /CST 126/UnitTests/UnitTests.cpp | |
| parent | Restored completed Homework 1 that was accidentally completed, Code should be... (diff) | |
| download | homework-1-chaninnohea-4646ce2a21cd6cba10af60cc3e821eb83ee7e5f9.tar.xz homework-1-chaninnohea-4646ce2a21cd6cba10af60cc3e821eb83ee7e5f9.zip | |
Created node struct and singlylinkedlist struct, and append function. Also complete Unit Testing for this section.
Diffstat (limited to 'CST 126/UnitTests/UnitTests.cpp')
| -rw-r--r-- | CST 126/UnitTests/UnitTests.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/CST 126/UnitTests/UnitTests.cpp b/CST 126/UnitTests/UnitTests.cpp index 0908160..f34984e 100644 --- a/CST 126/UnitTests/UnitTests.cpp +++ b/CST 126/UnitTests/UnitTests.cpp @@ -3,14 +3,37 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework; -namespace UnitTests +#include "SinglyLinkedList.hpp" +#include <list> + +namespace LinkedListUnitTests { - TEST_CLASS(UnitTests) + TEST_CLASS(LinkedListUnitTests) { public: + std::list<int> my_list{ 1, 5, 6, 7, 9, 10}; - TEST_METHOD(TestMethod1) + TEST_METHOD(EmptyList) { + //Arrange + SinglyLinkedList linkedList{}; + + //Assert + Assert::AreEqual(0ull, linkedList._size); + + } + + TEST_METHOD(AppendingLinkedList) + { + //Arrange + SinglyLinkedList linkedList{}; + ListNode* node = new ListNode{ 5, nullptr }; + + //Act + bool success = Append(&linkedList, node); + + //Assert + Assert::AreEqual(5, linkedList._head->_data); } }; } |