Cleaned up repo

This commit is contained in:
TriantaTV 2023-09-14 14:20:21 -05:00
parent 629d1e657a
commit 1f39fc8366
5 changed files with 51 additions and 2 deletions

2
.gitignore vendored
View File

@ -32,3 +32,5 @@
*.out
*.app
# Extras
build

View File

@ -16,3 +16,15 @@ The program should now be compiled at ./build/bin/proxy-network
Simply run the program using:
build/bin/proxy-network
## Testing the Project
The Unity framework is used for testing
Build the tests using:
cmake -DCMAKE_BUILD_TYPE=Debug -B build -S .
cmake --build build
Then run the tests using:
build/bin/testing

View File

@ -0,0 +1,7 @@
add_subdirectory(Unity)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(testing
./test.cpp
)
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(testing unity)

View File

@ -28,7 +28,7 @@
//= History: KJC (12/29/00) - Genesis (from server.c) =
//= HF (01/25/01) - Ported to multi-platform environment =
//=============================================================================
#define WIN // WIN for Windows environment, UNIX for BSD or LINUX env.
#define UNIX // WIN for Windows environment, UNIX for BSD or LINUX env.
//----- Include files ---------------------------------------------------------
#include <stdio.h> // Needed for printf()
@ -301,4 +301,4 @@ void child_proc(int server_s, int client_s)
close(client_s);
}
#endif
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */

28
test/test.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <cassert>
#include <iostream>
int math();
void test_math();
void IsEqual(bool lhs, bool rhs);
int main() {
test_math();
return 0;
}
int math() {
return 2+2;
}
void test_math() {
IsEqual(math(), 4);
IsEqual(math(), 6);
}
void IsEqual(bool lhs, bool rhs) {
if (lhs == rhs) {
std::cout << "Test Success" << std::endl;
} else {
std::cout << "Test Failure" << std::endl;
}
}