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 | |
| parent | Restored completed Homework 1 that was accidentally completed, Code should be... (diff) | |
| download | archived-homework-1-chaninnohea-4646ce2a21cd6cba10af60cc3e821eb83ee7e5f9.tar.xz archived-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')
| -rw-r--r-- | CST 126/UnitTests/NodeUnitTests.cpp | 48 | ||||
| -rw-r--r-- | CST 126/UnitTests/UnitTests.cpp | 29 | ||||
| -rw-r--r-- | CST 126/UnitTests/UnitTests.vcxproj | 1 |
3 files changed, 51 insertions, 27 deletions
diff --git a/CST 126/UnitTests/NodeUnitTests.cpp b/CST 126/UnitTests/NodeUnitTests.cpp index cefe395..cd0756f 100644 --- a/CST 126/UnitTests/NodeUnitTests.cpp +++ b/CST 126/UnitTests/NodeUnitTests.cpp @@ -1,24 +1,24 @@ -#include "pcd.h" -#include "CppUnitTest.h"" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -#include "node.hpp" -#include "crt_check_memory.hpp" - -using namespace CST126; - -namespace LinkedListUnitTests -{ - TEST_CLASS(NodeUnitTests) - { - public: - - TEST_METHOD(NodeEmptyConstructor_Success) - { - //Arrange - Node<int>* newNode = new Node<int>() - - } - }; -}
\ No newline at end of file +//#include "pcd.h" +//#include "CppUnitTest.h"" +// +//using namespace Microsoft::VisualStudio::CppUnitTestFramework; +// +//#include "node.hpp" +//#include "crt_check_memory.hpp" +// +//using namespace CST126; +// +//namespace LinkedListUnitTests +//{ +// TEST_CLASS(NodeUnitTests) +// { +// public: +// +// TEST_METHOD(NodeEmptyConstructor_Success) +// { +// //Arrange +// Node<int>* newNode = new Node<int>() +// +// } +// }; +//}
\ No newline at end of file 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); } }; } diff --git a/CST 126/UnitTests/UnitTests.vcxproj b/CST 126/UnitTests/UnitTests.vcxproj index e76d443..74883d6 100644 --- a/CST 126/UnitTests/UnitTests.vcxproj +++ b/CST 126/UnitTests/UnitTests.vcxproj @@ -77,6 +77,7 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> + <IncludePath>C:\Users\chani\OneDrive\Desktop\CS126\Repos\CST 126\Homework_3</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> |