Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs2-23wi
project02
Commits
fdcafa14
Commit
fdcafa14
authored
2 years ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Fix NSEE nonsense
parent
689436d7
master
No related merge requests found
Pipeline
#76028
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/edu/caltech/cs2/project02/ChooserTests.java
+13
-6
tests/edu/caltech/cs2/project02/ChooserTests.java
with
13 additions
and
6 deletions
+13
-6
tests/edu/caltech/cs2/project02/ChooserTests.java
View file @
fdcafa14
package
edu.caltech.cs2.project02
;
import
edu.caltech.cs2.helpers.CaptureSystemOutput
;
import
edu.caltech.cs2.helpers.FileSource
;
import
edu.caltech.cs2.helpers.Inspection
;
import
edu.caltech.cs2.helpers.Reflection
;
import
edu.caltech.cs2.helpers.*
;
import
edu.caltech.cs2.project02.choosers.EvilHangmanChooser
;
import
edu.caltech.cs2.project02.choosers.RandomHangmanChooser
;
import
edu.caltech.cs2.project02.guessers.ConsoleHangmanGuesser
;
import
edu.caltech.cs2.project02.interfaces.IHangmanChooser
;
import
org.junit.jupiter.api.*
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.jupiter.params.ParameterizedTest
;
import
java.io.FileNotFoundException
;
...
...
@@ -179,6 +177,7 @@ public class ChooserTests {
"trace14.txt"
,
}
)
public
void
testPlayGameWithRandomChooser
(
Map
<
String
,
String
>
arguments
,
String
expectedOutput
,
CaptureSystemOutput
.
OutputCapture
capture
)
throws
FileNotFoundException
{
// Parse arguments
int
seed
=
Integer
.
parseInt
(
arguments
.
get
(
"seed"
));
...
...
@@ -320,6 +319,7 @@ public class ChooserTests {
"trace14-evil.txt"
,
}
)
public
void
testPlayGameWithEvilChooser
(
Map
<
String
,
String
>
arguments
,
String
expectedOutput
,
CaptureSystemOutput
.
OutputCapture
capture
)
throws
FileNotFoundException
{
// Parse arguments
int
length
=
Integer
.
parseInt
(
arguments
.
get
(
"word length"
));
...
...
@@ -327,8 +327,15 @@ public class ChooserTests {
String
guesses
=
arguments
.
get
(
"guesses"
);
// Run the actual game
runTestGame
(
EvilHangmanChooser
.
class
,
length
,
wrongAllowed
,
guesses
);
NoSuchElementException
toThrow
=
null
;
try
{
runTestGame
(
EvilHangmanChooser
.
class
,
length
,
wrongAllowed
,
guesses
);
}
catch
(
NoSuchElementException
e
)
{
toThrow
=
e
;
}
assertEquals
(
expectedOutput
.
replace
(
"\r\n"
,
"\n"
).
strip
(),
capture
.
toString
().
replace
(
"\r\n"
,
"\n"
).
strip
());
if
(
toThrow
!=
null
)
{
throw
toThrow
;
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help