generated from Trianta/cpp-unity-template
Final Changes #13
@ -10,7 +10,3 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
|
||||||
add_subdirectory(test)
|
|
||||||
endif()
|
|
||||||
|
45
README.md
45
README.md
@ -1,5 +1,35 @@
|
|||||||
# markov-generator
|
# markov-generator
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
This program was tested using aces-up.txt and stalemate.txt
|
||||||
|
|
||||||
|
stalemate replaced aces-up for more interesting generation
|
||||||
|
|
||||||
|
A k=8 input resulted in the best output since it stopped words from being cut off
|
||||||
|
|
||||||
|
### Favorites
|
||||||
|
|
||||||
|
*All k's were generated from stalemate.txt with n=32*
|
||||||
|
|
||||||
|
>k=0: thinopreareBunofothinothinealoupa
|
||||||
|
|
||||||
|
>k=1: wit. thimp worg thanc thelescrope
|
||||||
|
|
||||||
|
>k=2: thate anyh out. IRS. God. some IN
|
||||||
|
|
||||||
|
>k=3: that. There. high fough that' fin
|
||||||
|
|
||||||
|
>k=4: protec you?" its infrin that?" Un
|
||||||
|
|
||||||
|
>k=5: United ankles can't having younge
|
||||||
|
|
||||||
|
>k=6: thing, God. You'll forgotte shave
|
||||||
|
|
||||||
|
>k=7: three into wounded? online away.
|
||||||
|
|
||||||
|
>k=8: both. several whatsoever thing, s
|
||||||
|
|
||||||
## Compiling the project
|
## Compiling the project
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
@ -18,18 +48,3 @@ Simply run the program using:
|
|||||||
|
|
||||||
build/bin/markov
|
build/bin/markov
|
||||||
|
|
||||||
## 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
|
|
||||||
|
@ -116,14 +116,7 @@ void Generator::Train(void) {
|
|||||||
|
|
||||||
std::cout << "[Setup - Info] Begin training" << std::endl;
|
std::cout << "[Setup - Info] Begin training" << std::endl;
|
||||||
for (const auto& word : words) {
|
for (const auto& word : words) {
|
||||||
if (word.size() < setup.prefixLength) {
|
trie.Insert(word);
|
||||||
trie.Insert(word);
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < word.size() - setup.prefixLength; ++i) {
|
|
||||||
trie.Insert(word.substr(i, setup.prefixLength));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
std::cout << "[Setup - Info] Finished training" << std::endl;
|
std::cout << "[Setup - Info] Finished training" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
|
1057
test/stalemate.txt
Normal file
1057
test/stalemate.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -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();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user