aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrPatrickWarner <[email protected]>2024-05-11 11:39:29 -0700
committerrPatrickWarner <[email protected]>2024-05-11 11:39:29 -0700
commit781582c9580ead8900381f16447d6eead2ab62af (patch)
treeaa6234445e6f83501df6ccbe9b62977a403e09d5
parentcreated insert and deletion functions (diff)
downloadhomework-1-reecepwarner-781582c9580ead8900381f16447d6eead2ab62af.tar.xz
homework-1-reecepwarner-781582c9580ead8900381f16447d6eead2ab62af.zip
unit testing homework3
-rw-r--r--CST 126/CST_126.sln10
-rw-r--r--CST 126/Homework3/SinglyLinkedList.hpp8
-rw-r--r--CST 126/UnitTester/UnitTester.cpp18
-rw-r--r--CST 126/UnitTester/UnitTester.vcxproj174
-rw-r--r--CST 126/UnitTester/UnitTester.vcxproj.filters30
-rw-r--r--CST 126/UnitTester/pch.cpp5
-rw-r--r--CST 126/UnitTester/pch.h12
7 files changed, 253 insertions, 4 deletions
diff --git a/CST 126/CST_126.sln b/CST 126/CST_126.sln
index dfd6a7e..f2e1baf 100644
--- a/CST 126/CST_126.sln
+++ b/CST 126/CST_126.sln
@@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework2", "Homework2\Home
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework3", "Homework3\Homework3.vcxproj", "{AE105706-54B6-43BA-A937-A16C59A2A261}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTester", "UnitTester\UnitTester.vcxproj", "{EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -51,6 +53,14 @@ Global
{AE105706-54B6-43BA-A937-A16C59A2A261}.Release|x64.Build.0 = Release|x64
{AE105706-54B6-43BA-A937-A16C59A2A261}.Release|x86.ActiveCfg = Release|Win32
{AE105706-54B6-43BA-A937-A16C59A2A261}.Release|x86.Build.0 = Release|Win32
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Debug|x64.ActiveCfg = Debug|x64
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Debug|x64.Build.0 = Debug|x64
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Debug|x86.ActiveCfg = Debug|Win32
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Debug|x86.Build.0 = Debug|Win32
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Release|x64.ActiveCfg = Release|x64
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Release|x64.Build.0 = Release|x64
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Release|x86.ActiveCfg = Release|Win32
+ {EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/CST 126/Homework3/SinglyLinkedList.hpp b/CST 126/Homework3/SinglyLinkedList.hpp
index 1d30f0d..51d24f9 100644
--- a/CST 126/Homework3/SinglyLinkedList.hpp
+++ b/CST 126/Homework3/SinglyLinkedList.hpp
@@ -11,7 +11,7 @@ template<typename T>
template<typename T>
struct SinglyLinkedList
{
- size_t _size {0};
+ T _size {0};
ListNode<T>* _head{ nullptr };
@@ -27,11 +27,11 @@ inline bool Append(SinglyLinkedList<T>* list, ListNode<T>* node)
return true;
}
ListNode<T>* TraverseNode = nullptr;
- for (TravelNode = list->_head; TravelNode->_next!= nullptr;)
+ for (TraverseNode = list->_head; TraverseNode->_next!= nullptr;)
{
- TravelNode = TravelNode->_next;
+ TraverseNode = TraverseNode->_next;
}
- TravelNode->_next = node;
+ TraverseNode->_next = node;
return true;
}
diff --git a/CST 126/UnitTester/UnitTester.cpp b/CST 126/UnitTester/UnitTester.cpp
new file mode 100644
index 0000000..8cc2513
--- /dev/null
+++ b/CST 126/UnitTester/UnitTester.cpp
@@ -0,0 +1,18 @@
+#include "pch.h"
+#include "CppUnitTest.h"
+#include "SinglyLinkedList.hpp"
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+
+namespace LinkedListUnitTests
+{
+ TEST_CLASS(LinkedListUnitTests)
+ {
+ public:
+
+ TEST_METHOD(EmptyListHasZeroSize)
+ {
+ SinglyLinkedList<int> LinkedList{};
+ Assert::AreEqual(0, LinkedList._size);
+ }
+ };
+}
diff --git a/CST 126/UnitTester/UnitTester.vcxproj b/CST 126/UnitTester/UnitTester.vcxproj
new file mode 100644
index 0000000..0cbba9e
--- /dev/null
+++ b/CST 126/UnitTester/UnitTester.vcxproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>17.0</VCProjectVersion>
+ <ProjectGuid>{EAE78C46-5B7C-4F8C-A266-B5D4E3A762D1}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>UnitTester</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ <ProjectSubType>NativeUnitTestProject</ProjectSubType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>C:\Users\rpwar\source\repos\CST126\homework-1-reecepwarner\CST 126\Homework3;$(IncludePath)</IncludePath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <UseFullPaths>true</UseFullPaths>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <UseFullPaths>true</UseFullPaths>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <UseFullPaths>true</UseFullPaths>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <UseFullPaths>true</UseFullPaths>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="pch.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="UnitTester.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="pch.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/CST 126/UnitTester/UnitTester.vcxproj.filters b/CST 126/UnitTester/UnitTester.vcxproj.filters
new file mode 100644
index 0000000..7a76918
--- /dev/null
+++ b/CST 126/UnitTester/UnitTester.vcxproj.filters
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="UnitTester.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pch.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="pch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/CST 126/UnitTester/pch.cpp b/CST 126/UnitTester/pch.cpp
new file mode 100644
index 0000000..64b7eef
--- /dev/null
+++ b/CST 126/UnitTester/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/UnitTester/pch.h b/CST 126/UnitTester/pch.h
new file mode 100644
index 0000000..9d715b0
--- /dev/null
+++ b/CST 126/UnitTester/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