-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Up Tests #16
Open
ncmatson
wants to merge
27
commits into
master
Choose a base branch
from
test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Set Up Tests #16
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3df50cd
remove setters
ncmatson 7346ad2
update makefile and create test folder
ncmatson a23c33a
fix linker error
ncmatson c8c0dc5
fix
ncmatson d4f6e0a
model module-based test architecture
claytongentry 30995ad
update makefile
ncmatson 9bffa46
word module
ncmatson 9275d6e
update word_test
ncmatson 6e8cc31
update word_test
ncmatson 1995700
add utils test cases
claytongentry c5d2a88
word_test modlue update
ncmatson eae0846
wordList test
ncmatson c04ae9a
clean up word test
claytongentry 4aa7087
updat word_list test
ncmatson b2e695d
update makefile
ncmatson f073bbf
add nouncer test
claytongentry 68d1915
Merge branch 'test' of https://github.com/claytongentry/JeezyAI into …
claytongentry d9927d2
clean up nouncer and utils
ncmatson 7444102
updat randinrange
ncmatson 8ed53af
update filp and utils test
ncmatson d04397e
add test suite tags
ncmatson 3971e5e
update makefile and start denouncer test
ncmatson fdd1a59
remove unused functions denouncer
ncmatson fd1e13a
denouncer test
ncmatson f77a41c
rhymer test (fails)
ncmatson 8089a46
battle test (wip)
ncmatson d1d7ac1
Merge branch 'master' into test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN | ||
|
||
#include "doctest.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "doctest.h" | ||
|
||
#include "utils.cpp" | ||
|
||
TEST_CASE("capitalizes a string") { | ||
CHECK(Utils::allCaps("test") == "TEST"); | ||
CHECK(Utils::allCaps("TEST") == "TEST"); | ||
CHECK(Utils::allCaps("under_score") == "UNDER_SCORE"); | ||
CHECK(Utils::allCaps("") == ""); | ||
} | ||
|
||
TEST_CASE("downcases a string") { | ||
CHECK(Utils::noCaps("TEST") == "test"); | ||
CHECK(Utils::noCaps("test") == "test"); | ||
CHECK(Utils::noCaps("UNDER_SCORE") == "under_score"); | ||
CHECK(Utils::noCaps("") == ""); | ||
} | ||
|
||
TEST_CASE("removes punctuation from string") { | ||
CHECK(Utils::removePunc("google.com") == "googlecom"); | ||
CHECK(Utils::removePunc("*&!((.#))") == ""); | ||
CHECK(Utils::removePunc("hello world") == "hello world"); | ||
} | ||
|
||
TEST_CASE("flips a string") { | ||
CHECK(Utils::flip("goof ball") == "ball goof"); | ||
CHECK(Utils::flip("foo") == "foo"); | ||
CHECK(Utils::flip("Foo bar baz.") == "baz bar Foo."); | ||
} | ||
|
||
TEST_CASE("excludes a number from a range") { | ||
CHECK(Utils::randInRangeExclude(1, 2, 2) == 1); | ||
CHECK(Utils::randInRangeExclude(1, 0, 0) == 1); | ||
CHECK(Utils::randInRangeExclude(1, 1, 1) == NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "doctest.h" | ||
|
||
#include "word.cpp" | ||
|
||
|
||
TEST_CASE("initialize member variables") { | ||
Word w("gravy", "su"); | ||
CHECK(w.getVal() == "gravy"); | ||
CHECK(w.getFrequency() == 1); | ||
CHECK(w.getStressPattern() == "su"); | ||
|
||
} | ||
|
||
TEST_CASE("copy constructor") { | ||
Word w("gravy", "su"); | ||
|
||
Word x = w; | ||
|
||
CHECK(x.getVal() == "gravy"); | ||
CHECK(x.getFrequency() == 1); | ||
CHECK(w.getStressPattern() == "su"); | ||
|
||
CHECK(&w != &x); | ||
} | ||
|
||
TEST_CASE("update frequency") { | ||
Word w("gravy", "su"); | ||
w.incrementFrequency(); | ||
|
||
CHECK(w.getFrequency() == 2); | ||
} | ||
|
||
TEST_CASE("comparison operator") { | ||
Word w("gravy", "su"); | ||
Word x("gravy", "su"); | ||
|
||
Word y("gravy", "uu"); | ||
|
||
Word z("notgravy", "su"); | ||
Word u("notgravy", "uu"); | ||
|
||
CHECK((w==x) == true); | ||
CHECK((w==y) == true); | ||
CHECK((w==z) == false); | ||
CHECK((w==u) == false); | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "doctest.h" | ||
|
||
|
||
#include "wordList.cpp" | ||
|
||
|
||
TEST_SUITE("wordlist"); | ||
|
||
TEST_CASE("constructor") { | ||
Word w("gravy", "su"); | ||
Word n("_NULL_", ""); | ||
|
||
WordList l(w); | ||
|
||
CHECK( (l.getBase() == w) == true ); | ||
CHECK( l.getLeaders().size() == 1 ); | ||
CHECK( (l.getLeaders().at(0) == n) == true ); | ||
} | ||
|
||
TEST_CASE("add leader") { | ||
Word w("gravy", "su"); | ||
Word x("boat", "s"); | ||
Word y("train", "s"); | ||
|
||
WordList l(w); | ||
|
||
l.addLeader(x); | ||
|
||
CHECK( l.getLeaders().size() == 2); | ||
CHECK( (l.getLeaders().at(1) == x) == true ); | ||
|
||
l.addLeader(y); | ||
|
||
CHECK( l.getLeaders().size() == 3); | ||
CHECK( (l.getLeaders().at(2) == y) == true ); | ||
} | ||
|
||
TEST_CASE("pick leader") { | ||
Word w("gravy", "su"); | ||
|
||
WordList l(w); | ||
} | ||
|
||
|
||
TEST_SUITE_END(); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't have to assert
== true
or==false
. Can't you just doCHECK(w==x);
andCHECK(w!=z);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope cannot, at least not that I can tell