Merge pull request 'Updated README and usage help' (#2) from dev into master

Reviewed-on: #2
This commit is contained in:
Trianta 2023-11-12 20:43:17 -06:00
commit 4a538dda85
5 changed files with 27 additions and 50 deletions

View File

@ -10,7 +10,3 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_subdirectory(src)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_subdirectory(test)
endif()

View File

@ -1,4 +1,22 @@
# cpp-unity-template
# bayesian-spam-filter
## Report
Given SMSSpamCollection.txt was split in half for report
First half was used for generation, second half for actual filter
(Files included in test for convenience)
Results:
Spam precision: 0.935135
Spam recall: 0.39229
Ham precision: 0.780777
Ham recall: 0.987584
Spam F-Score: 0.552716
Ham F-Score: 0.872088
Accuracy: 0.689937
## Compiling the project
@ -12,24 +30,11 @@ In order to compile the project, simply run these two commands:
## Running the Project
The program should now be compiled at build/bin/something
The program should now be compiled at build/bin/filter
Simply run the program using:
build/bin/something
build/bin/filter
## Testing the Project
Prerequisites
- [Unity (Throw the Switch)](https://github.com/ThrowTheSwitch/Unity) | [AUR](https://aur.archlinux.org/packages/unity-test)
In order to compile the tests for the project, simply run these two commands:
cmake -DCMAKE_BUILD_TYPE=Debug -B build -S .
cmake --build build
The program should now be compiled at build/bin/tests
Simply run the tests using:
build/bin/tests
## Usage
Use the `--help` argument for usage help

View File

@ -147,6 +147,10 @@ void SMSMessageFilter::ReadArguments(int argc, char* argv[]) {
is_input_defined = true;
filter_file_path.assign(argv[i+1]);
}
if (argument_string == "--help") {
PrintHelp();
exit(0);
}
}
if (!is_input_defined) {
std::cerr << "Usage error: Please specify file to filter" << std::endl;

View File

@ -1,7 +0,0 @@
find_package(unity REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/src)
add_executable(testing
test.cpp
)
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(testing unity)

View File

@ -1,21 +0,0 @@
#include <unity/unity.h>
#include <unity/unity_internals.h>
void setUp() { ; }
void tearDown() { ; }
int Math(void) {
return 2+2;
}
void test_Math(void) {
TEST_ASSERT_EQUAL_INT(4, Math());
}
int main(void) {
UNITY_BEGIN();
RUN_TEST(test_Math);
return UNITY_END();
}