From e57173d536465fe12cea8a605d7b0d0e4f02bbf1 Mon Sep 17 00:00:00 2001 From: Chanin Timbal Date: Sat, 1 Jun 2024 11:55:26 -0700 Subject: trying to fix! --- CST 126/CST_126.sln | 39 +++-- CST 126/Homework 2/Base64Converter.hpp | 25 --- CST 126/Homework 2/Homework2/Base64Converter.hpp | 25 --- CST 126/Homework 2/Homework2/FindingPi.exe | Bin 3496762 -> 0 bytes CST 126/Homework 2/Homework2/destination_file.txt | 0 CST 126/Homework 2/Homework2/helpers.hpp | 88 ----------- CST 126/Homework 2/helpers.hpp | 88 ----------- .../Homework 3/Homework 3/linked_list_nodes.hpp | 24 --- CST 126/Homework 3/Homework 3/node.hpp | 50 ------ CST 126/Homework_2/Base64Converter.hpp | 25 +++ CST 126/Homework_2/FindingPi.exe | Bin 0 -> 3496762 bytes CST 126/Homework_2/Homework_2.vcxproj | 142 +++++++++++++++++ CST 126/Homework_2/Homework_2.vcxproj.filters | 35 +++++ CST 126/Homework_2/destination_file.txt | 0 CST 126/Homework_2/helpers.hpp | 88 +++++++++++ CST 126/Homework_3/Homework_3.vcxproj | 136 ++++++++++++++++ CST 126/Homework_3/Homework_3.vcxproj.filters | 25 +++ CST 126/Homework_3/linked_list_nodes.hpp | 24 +++ CST 126/Homework_3/node.hpp | 50 ++++++ CST 126/UnitTests/NodeUnitTests.cpp | 24 +++ CST 126/UnitTests/UnitTests.cpp | 16 ++ CST 126/UnitTests/UnitTests.vcxproj | 175 +++++++++++++++++++++ CST 126/UnitTests/UnitTests.vcxproj.filters | 36 +++++ CST 126/UnitTests/crt_check_memory.hpp | 40 +++++ CST 126/UnitTests/pch.cpp | 5 + CST 126/UnitTests/pch.h | 12 ++ CST 126/Unit_Tests/NodeUnitTests.cpp.cpp | 24 --- CST 126/Unit_Tests/crt_check_memory.hpp | 40 ----- 28 files changed, 863 insertions(+), 373 deletions(-) delete mode 100644 CST 126/Homework 2/Base64Converter.hpp delete mode 100644 CST 126/Homework 2/Homework2/Base64Converter.hpp delete mode 100644 CST 126/Homework 2/Homework2/FindingPi.exe delete mode 100644 CST 126/Homework 2/Homework2/destination_file.txt delete mode 100644 CST 126/Homework 2/Homework2/helpers.hpp delete mode 100644 CST 126/Homework 2/helpers.hpp delete mode 100644 CST 126/Homework 3/Homework 3/linked_list_nodes.hpp delete mode 100644 CST 126/Homework 3/Homework 3/node.hpp create mode 100644 CST 126/Homework_2/Base64Converter.hpp create mode 100644 CST 126/Homework_2/FindingPi.exe create mode 100644 CST 126/Homework_2/Homework_2.vcxproj create mode 100644 CST 126/Homework_2/Homework_2.vcxproj.filters create mode 100644 CST 126/Homework_2/destination_file.txt create mode 100644 CST 126/Homework_2/helpers.hpp create mode 100644 CST 126/Homework_3/Homework_3.vcxproj create mode 100644 CST 126/Homework_3/Homework_3.vcxproj.filters create mode 100644 CST 126/Homework_3/linked_list_nodes.hpp create mode 100644 CST 126/Homework_3/node.hpp create mode 100644 CST 126/UnitTests/NodeUnitTests.cpp create mode 100644 CST 126/UnitTests/UnitTests.cpp create mode 100644 CST 126/UnitTests/UnitTests.vcxproj create mode 100644 CST 126/UnitTests/UnitTests.vcxproj.filters create mode 100644 CST 126/UnitTests/crt_check_memory.hpp create mode 100644 CST 126/UnitTests/pch.cpp create mode 100644 CST 126/UnitTests/pch.h delete mode 100644 CST 126/Unit_Tests/NodeUnitTests.cpp.cpp delete mode 100644 CST 126/Unit_Tests/crt_check_memory.hpp diff --git a/CST 126/CST_126.sln b/CST 126/CST_126.sln index fe04bb4..9dea01f 100644 --- a/CST 126/CST_126.sln +++ b/CST 126/CST_126.sln @@ -5,7 +5,11 @@ VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework 1", "Homework 1\Homework 1.vcxproj", "{63480B39-FB46-498B-A592-F4EAAF597F78}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "In-Class", "In-Class\In-Class.vcxproj", "{4447AFE1-22A8-48A1-BF74-2191012CBD74}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework_2", "Homework_2\Homework_2.vcxproj", "{B4079F93-9F2B-440C-AB0D-7774AB0A8635}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework_3", "Homework_3\Homework_3.vcxproj", "{5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{B7312D2D-6842-4E8B-90BB-477022B77347}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,20 +20,37 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x64.ActiveCfg = Debug|x64 + {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x64.Build.0 = Debug|x64 {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x86.ActiveCfg = Debug|Win32 {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x86.Build.0 = Debug|Win32 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x64.ActiveCfg = Release|x64 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x64.Build.0 = Release|x64 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x86.ActiveCfg = Release|Win32 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x86.Build.0 = Release|Win32 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x64.ActiveCfg = Debug|x64 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x64.Build.0 = Debug|x64 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x86.ActiveCfg = Debug|Win32 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x86.Build.0 = Debug|Win32 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x64.ActiveCfg = Release|x64 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x64.Build.0 = Release|x64 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x86.ActiveCfg = Release|Win32 - {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x86.Build.0 = Release|Win32 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Debug|x64.ActiveCfg = Debug|x64 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Debug|x64.Build.0 = Debug|x64 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Debug|x86.ActiveCfg = Debug|Win32 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Debug|x86.Build.0 = Debug|Win32 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Release|x64.ActiveCfg = Release|x64 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Release|x64.Build.0 = Release|x64 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Release|x86.ActiveCfg = Release|Win32 + {B4079F93-9F2B-440C-AB0D-7774AB0A8635}.Release|x86.Build.0 = Release|Win32 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Debug|x64.ActiveCfg = Debug|x64 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Debug|x64.Build.0 = Debug|x64 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Debug|x86.ActiveCfg = Debug|Win32 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Debug|x86.Build.0 = Debug|Win32 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Release|x64.ActiveCfg = Release|x64 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Release|x64.Build.0 = Release|x64 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Release|x86.ActiveCfg = Release|Win32 + {5738C8A2-2FA6-4F57-9D5A-61DF6CAEA555}.Release|x86.Build.0 = Release|Win32 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Debug|x64.ActiveCfg = Debug|x64 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Debug|x64.Build.0 = Debug|x64 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Debug|x86.ActiveCfg = Debug|Win32 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Debug|x86.Build.0 = Debug|Win32 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Release|x64.ActiveCfg = Release|x64 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Release|x64.Build.0 = Release|x64 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Release|x86.ActiveCfg = Release|Win32 + {B7312D2D-6842-4E8B-90BB-477022B77347}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CST 126/Homework 2/Base64Converter.hpp b/CST 126/Homework 2/Base64Converter.hpp deleted file mode 100644 index 36e55e4..0000000 --- a/CST 126/Homework 2/Base64Converter.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef BASE64_CONVERTER_HPP -#define BASE64_CONVERTER_HPP - -char characterMap[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', -'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', -'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', -'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', -'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '/', '+'}; - - - -inline char* Base64Encode(char* buffer, size_t& size) -{ - - - - - - - - - -} - -#endif \ No newline at end of file diff --git a/CST 126/Homework 2/Homework2/Base64Converter.hpp b/CST 126/Homework 2/Homework2/Base64Converter.hpp deleted file mode 100644 index 36e55e4..0000000 --- a/CST 126/Homework 2/Homework2/Base64Converter.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef BASE64_CONVERTER_HPP -#define BASE64_CONVERTER_HPP - -char characterMap[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', -'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', -'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', -'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', -'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '/', '+'}; - - - -inline char* Base64Encode(char* buffer, size_t& size) -{ - - - - - - - - - -} - -#endif \ No newline at end of file diff --git a/CST 126/Homework 2/Homework2/FindingPi.exe b/CST 126/Homework 2/Homework2/FindingPi.exe deleted file mode 100644 index 4b128d3..0000000 Binary files a/CST 126/Homework 2/Homework2/FindingPi.exe and /dev/null differ diff --git a/CST 126/Homework 2/Homework2/destination_file.txt b/CST 126/Homework 2/Homework2/destination_file.txt deleted file mode 100644 index e69de29..0000000 diff --git a/CST 126/Homework 2/Homework2/helpers.hpp b/CST 126/Homework 2/Homework2/helpers.hpp deleted file mode 100644 index e448cc9..0000000 --- a/CST 126/Homework 2/Homework2/helpers.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef HELPERS_HPP -#define HELPERS_HPP - - -//file reading things -inline char* ReadTextFromFile(const char* fileName, char* buffer) -{ - return buffer; -} - -inline char* ReadFileAsBinary(const char* fileName, char* buffer, size_t& size) -{ - try - { - //open the fstream in input mode, with binary mode - std::fstream file(fileName, std::ios::in | std::ios::binary); - - if (!file.is.open()) - { - std::cerr << "Could not open file for binary input: " << fileName; - return buffer; - } - - file.seekg(0, std::ios::end); - - std::streamsize size = file.tellg(); - - file.seekg(0, std::ios::beg); - - delete[] buffer; - - buffer = nullptr; - - //size the buffer with a new - buffer = new char[size]; - - file.read(buffer, size); - - file.close(); - - return buffer; - } - catch (const std::exception& ex) - { - std::cerr << "Exception during binary file input: " << fileName << "was not successfully streamed to binary"; - ex.what() - return buffer; - } -} - -//file writing things -inline bool WriteTextToFile(const char* fileName, const char* fileContents) -{ - std::ostream file(fileName); - - if (!file.is_open()) - { - std::cerr << "Could not open file: " << fileName; - return false; - } - - file << fileContents; - - file.close(); - - return false; -} - -inline bool WriteFileFromBinary(const char* fileName, const char* buffer) -{ - return false; -} - - - - - - - - - - - - - - - -#endif \ No newline at end of file diff --git a/CST 126/Homework 2/helpers.hpp b/CST 126/Homework 2/helpers.hpp deleted file mode 100644 index e448cc9..0000000 --- a/CST 126/Homework 2/helpers.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef HELPERS_HPP -#define HELPERS_HPP - - -//file reading things -inline char* ReadTextFromFile(const char* fileName, char* buffer) -{ - return buffer; -} - -inline char* ReadFileAsBinary(const char* fileName, char* buffer, size_t& size) -{ - try - { - //open the fstream in input mode, with binary mode - std::fstream file(fileName, std::ios::in | std::ios::binary); - - if (!file.is.open()) - { - std::cerr << "Could not open file for binary input: " << fileName; - return buffer; - } - - file.seekg(0, std::ios::end); - - std::streamsize size = file.tellg(); - - file.seekg(0, std::ios::beg); - - delete[] buffer; - - buffer = nullptr; - - //size the buffer with a new - buffer = new char[size]; - - file.read(buffer, size); - - file.close(); - - return buffer; - } - catch (const std::exception& ex) - { - std::cerr << "Exception during binary file input: " << fileName << "was not successfully streamed to binary"; - ex.what() - return buffer; - } -} - -//file writing things -inline bool WriteTextToFile(const char* fileName, const char* fileContents) -{ - std::ostream file(fileName); - - if (!file.is_open()) - { - std::cerr << "Could not open file: " << fileName; - return false; - } - - file << fileContents; - - file.close(); - - return false; -} - -inline bool WriteFileFromBinary(const char* fileName, const char* buffer) -{ - return false; -} - - - - - - - - - - - - - - - -#endif \ No newline at end of file diff --git a/CST 126/Homework 3/Homework 3/linked_list_nodes.hpp b/CST 126/Homework 3/Homework 3/linked_list_nodes.hpp deleted file mode 100644 index a3122c7..0000000 --- a/CST 126/Homework 3/Homework 3/linked_list_nodes.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef LINKED_LIST_NODE_HPP -#define LINKED_LIST_NODE_HPP - -#include "node.hpp" - -namespace CST126 -{ - template - class singly_linked_node : Node - { - protected: - singly_linked_node* _next{ nullptr }; - - }; - - template - class doubly_linked_node final : singly_linked_node - { - protected: - doubly_linked_node* _prev{ nullptr }; - }; -} - -#endif \ No newline at end of file diff --git a/CST 126/Homework 3/Homework 3/node.hpp b/CST 126/Homework 3/Homework 3/node.hpp deleted file mode 100644 index 32894c8..0000000 --- a/CST 126/Homework 3/Homework 3/node.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef NODE_HPP -#define NODE_HPP - -namespace CST126 { - - template - class Node - { - public: - Node() = default; - Node(const T& data); - - ~Node() = default; - - T& Data(); - T Data() const; - void Data(const T& data); - - - - private: - T _data{}; - }; - - template - Node::Node(const T& data) : _data(data) {}; - - - template - void Node::Data(const T& data) - { - _data = data; - } - - template - T& Node::Data() - { - return _data; - } - - template - T& Node::Data(const T& data) - { - _data = data;; - } -} - - - -#endif \ No newline at end of file diff --git a/CST 126/Homework_2/Base64Converter.hpp b/CST 126/Homework_2/Base64Converter.hpp new file mode 100644 index 0000000..36e55e4 --- /dev/null +++ b/CST 126/Homework_2/Base64Converter.hpp @@ -0,0 +1,25 @@ +#ifndef BASE64_CONVERTER_HPP +#define BASE64_CONVERTER_HPP + +char characterMap[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', +'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', +'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', +'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', +'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '/', '+'}; + + + +inline char* Base64Encode(char* buffer, size_t& size) +{ + + + + + + + + + +} + +#endif \ No newline at end of file diff --git a/CST 126/Homework_2/FindingPi.exe b/CST 126/Homework_2/FindingPi.exe new file mode 100644 index 0000000..4b128d3 Binary files /dev/null and b/CST 126/Homework_2/FindingPi.exe differ diff --git a/CST 126/Homework_2/Homework_2.vcxproj b/CST 126/Homework_2/Homework_2.vcxproj new file mode 100644 index 0000000..85f5a4d --- /dev/null +++ b/CST 126/Homework_2/Homework_2.vcxproj @@ -0,0 +1,142 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {b4079f93-9f2b-440c-ab0d-7774ab0a8635} + Homework2 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CST 126/Homework_2/Homework_2.vcxproj.filters b/CST 126/Homework_2/Homework_2.vcxproj.filters new file mode 100644 index 0000000..7f35e06 --- /dev/null +++ b/CST 126/Homework_2/Homework_2.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + + + Source Files + + + \ No newline at end of file diff --git a/CST 126/Homework_2/destination_file.txt b/CST 126/Homework_2/destination_file.txt new file mode 100644 index 0000000..e69de29 diff --git a/CST 126/Homework_2/helpers.hpp b/CST 126/Homework_2/helpers.hpp new file mode 100644 index 0000000..e448cc9 --- /dev/null +++ b/CST 126/Homework_2/helpers.hpp @@ -0,0 +1,88 @@ +#ifndef HELPERS_HPP +#define HELPERS_HPP + + +//file reading things +inline char* ReadTextFromFile(const char* fileName, char* buffer) +{ + return buffer; +} + +inline char* ReadFileAsBinary(const char* fileName, char* buffer, size_t& size) +{ + try + { + //open the fstream in input mode, with binary mode + std::fstream file(fileName, std::ios::in | std::ios::binary); + + if (!file.is.open()) + { + std::cerr << "Could not open file for binary input: " << fileName; + return buffer; + } + + file.seekg(0, std::ios::end); + + std::streamsize size = file.tellg(); + + file.seekg(0, std::ios::beg); + + delete[] buffer; + + buffer = nullptr; + + //size the buffer with a new + buffer = new char[size]; + + file.read(buffer, size); + + file.close(); + + return buffer; + } + catch (const std::exception& ex) + { + std::cerr << "Exception during binary file input: " << fileName << "was not successfully streamed to binary"; + ex.what() + return buffer; + } +} + +//file writing things +inline bool WriteTextToFile(const char* fileName, const char* fileContents) +{ + std::ostream file(fileName); + + if (!file.is_open()) + { + std::cerr << "Could not open file: " << fileName; + return false; + } + + file << fileContents; + + file.close(); + + return false; +} + +inline bool WriteFileFromBinary(const char* fileName, const char* buffer) +{ + return false; +} + + + + + + + + + + + + + + + +#endif \ No newline at end of file diff --git a/CST 126/Homework_3/Homework_3.vcxproj b/CST 126/Homework_3/Homework_3.vcxproj new file mode 100644 index 0000000..5edcf5c --- /dev/null +++ b/CST 126/Homework_3/Homework_3.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {5738c8a2-2fa6-4f57-9d5a-61df6caea555} + Homework3 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/CST 126/Homework_3/Homework_3.vcxproj.filters b/CST 126/Homework_3/Homework_3.vcxproj.filters new file mode 100644 index 0000000..0f7b42e --- /dev/null +++ b/CST 126/Homework_3/Homework_3.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/CST 126/Homework_3/linked_list_nodes.hpp b/CST 126/Homework_3/linked_list_nodes.hpp new file mode 100644 index 0000000..a3122c7 --- /dev/null +++ b/CST 126/Homework_3/linked_list_nodes.hpp @@ -0,0 +1,24 @@ +#ifndef LINKED_LIST_NODE_HPP +#define LINKED_LIST_NODE_HPP + +#include "node.hpp" + +namespace CST126 +{ + template + class singly_linked_node : Node + { + protected: + singly_linked_node* _next{ nullptr }; + + }; + + template + class doubly_linked_node final : singly_linked_node + { + protected: + doubly_linked_node* _prev{ nullptr }; + }; +} + +#endif \ No newline at end of file diff --git a/CST 126/Homework_3/node.hpp b/CST 126/Homework_3/node.hpp new file mode 100644 index 0000000..32894c8 --- /dev/null +++ b/CST 126/Homework_3/node.hpp @@ -0,0 +1,50 @@ +#ifndef NODE_HPP +#define NODE_HPP + +namespace CST126 { + + template + class Node + { + public: + Node() = default; + Node(const T& data); + + ~Node() = default; + + T& Data(); + T Data() const; + void Data(const T& data); + + + + private: + T _data{}; + }; + + template + Node::Node(const T& data) : _data(data) {}; + + + template + void Node::Data(const T& data) + { + _data = data; + } + + template + T& Node::Data() + { + return _data; + } + + template + T& Node::Data(const T& data) + { + _data = data;; + } +} + + + +#endif \ No newline at end of file diff --git a/CST 126/UnitTests/NodeUnitTests.cpp b/CST 126/UnitTests/NodeUnitTests.cpp new file mode 100644 index 0000000..cefe395 --- /dev/null +++ b/CST 126/UnitTests/NodeUnitTests.cpp @@ -0,0 +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* newNode = new Node() + + } + }; +} \ No newline at end of file diff --git a/CST 126/UnitTests/UnitTests.cpp b/CST 126/UnitTests/UnitTests.cpp new file mode 100644 index 0000000..0908160 --- /dev/null +++ b/CST 126/UnitTests/UnitTests.cpp @@ -0,0 +1,16 @@ +#include "pch.h" +#include "CppUnitTest.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace UnitTests +{ + TEST_CLASS(UnitTests) + { + public: + + TEST_METHOD(TestMethod1) + { + } + }; +} diff --git a/CST 126/UnitTests/UnitTests.vcxproj b/CST 126/UnitTests/UnitTests.vcxproj new file mode 100644 index 0000000..e76d443 --- /dev/null +++ b/CST 126/UnitTests/UnitTests.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {B7312D2D-6842-4E8B-90BB-477022B77347} + Win32Proj + UnitTests + 10.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v143 + Unicode + false + + + DynamicLibrary + false + v143 + true + Unicode + false + + + DynamicLibrary + true + v143 + Unicode + false + + + DynamicLibrary + false + v143 + true + Unicode + false + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + + Create + Create + Create + Create + + + + + + + + + + + \ No newline at end of file diff --git a/CST 126/UnitTests/UnitTests.vcxproj.filters b/CST 126/UnitTests/UnitTests.vcxproj.filters new file mode 100644 index 0000000..317d8de --- /dev/null +++ b/CST 126/UnitTests/UnitTests.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/CST 126/UnitTests/crt_check_memory.hpp b/CST 126/UnitTests/crt_check_memory.hpp new file mode 100644 index 0000000..9cb4ab2 --- /dev/null +++ b/CST 126/UnitTests/crt_check_memory.hpp @@ -0,0 +1,40 @@ +#ifndef CRTCHECKMEMORY_H +#define CRTCHECKMEMORY_H + +#include "pch.h" +#include "CppUnitTest.h" +#include "crtdbg.h" + +#define _CRTDBG_MAP_ALLOC + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace LinkedListUnitTests +{ + struct CrtCheckMemory + { + _CrtMemState state1{}; + _CrtMemState state2{}; + _CrtMemState state3{}; + CrtCheckMemory() + { + _CrtMemCheckpoint(&state1); + } + + CrtCheckMemory(const CrtCheckMemory& copy) = delete; + CrtCheckMemory& operator=(const CrtCheckMemory& copy) = delete; + CrtCheckMemory(CrtCheckMemory&& copy) = delete; + CrtCheckMemory& operator=(CrtCheckMemory&& copy) = delete; + + ~CrtCheckMemory() + { + _CrtMemCheckpoint(&state2); + + if (_CrtMemDifference(&state3, &state1, &state2) != 0) + { + Assert::Fail(L"Detected memory leaks!"); + } + } + }; +} +#endif \ No newline at end of file diff --git a/CST 126/UnitTests/pch.cpp b/CST 126/UnitTests/pch.cpp new file mode 100644 index 0000000..64b7eef --- /dev/null +++ b/CST 126/UnitTests/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/CST 126/UnitTests/pch.h b/CST 126/UnitTests/pch.h new file mode 100644 index 0000000..9d715b0 --- /dev/null +++ b/CST 126/UnitTests/pch.h @@ -0,0 +1,12 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here + +#endif //PCH_H diff --git a/CST 126/Unit_Tests/NodeUnitTests.cpp.cpp b/CST 126/Unit_Tests/NodeUnitTests.cpp.cpp deleted file mode 100644 index cefe395..0000000 --- a/CST 126/Unit_Tests/NodeUnitTests.cpp.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#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* newNode = new Node() - - } - }; -} \ No newline at end of file diff --git a/CST 126/Unit_Tests/crt_check_memory.hpp b/CST 126/Unit_Tests/crt_check_memory.hpp deleted file mode 100644 index 9cb4ab2..0000000 --- a/CST 126/Unit_Tests/crt_check_memory.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef CRTCHECKMEMORY_H -#define CRTCHECKMEMORY_H - -#include "pch.h" -#include "CppUnitTest.h" -#include "crtdbg.h" - -#define _CRTDBG_MAP_ALLOC - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -namespace LinkedListUnitTests -{ - struct CrtCheckMemory - { - _CrtMemState state1{}; - _CrtMemState state2{}; - _CrtMemState state3{}; - CrtCheckMemory() - { - _CrtMemCheckpoint(&state1); - } - - CrtCheckMemory(const CrtCheckMemory& copy) = delete; - CrtCheckMemory& operator=(const CrtCheckMemory& copy) = delete; - CrtCheckMemory(CrtCheckMemory&& copy) = delete; - CrtCheckMemory& operator=(CrtCheckMemory&& copy) = delete; - - ~CrtCheckMemory() - { - _CrtMemCheckpoint(&state2); - - if (_CrtMemDifference(&state3, &state1, &state2) != 0) - { - Assert::Fail(L"Detected memory leaks!"); - } - } - }; -} -#endif \ No newline at end of file -- cgit v1.2.3