Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Assignment1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dsjohns2
Assignment1
Commits
07a4bb36
Commit
07a4bb36
authored
7 years ago
by
dsjohns2
Browse files
Options
Downloads
Patches
Plain Diff
add units tests!
parent
cbfabbd3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Game.java
+0
-7
0 additions, 7 deletions
Game.java
GameTest.java
+56
-0
56 additions, 0 deletions
GameTest.java
Main.java
+1
-1
1 addition, 1 deletion
Main.java
with
57 additions
and
8 deletions
Game.java
+
0
−
7
View file @
07a4bb36
...
...
@@ -134,13 +134,6 @@ public class Game {
public
int
make_move
()
throws
InterruptedException
{
Square
[][][]
legal_moves
=
get_all_moves
(
white_turn
,
this
.
board
);
for
(
int
i
=
0
;
i
<
legal_moves
.
length
;
i
++){
TimeUnit
.
SECONDS
.
sleep
(
1
);
print_board
(
legal_moves
[
i
]);
}
/* Check for end of game */
int
end_val
=
check_for_end_of_game
(
legal_moves
);
if
(
end_val
>
0
){
...
...
This diff is collapsed.
Click to expand it.
GameTest.java
0 → 100755
+
56
−
0
View file @
07a4bb36
package
com.company
;
import
static
org
.
junit
.
Assert
.*;
/**
* This is the JUnit4 tests for the program
*/
public
class
GameTest
{
@org
.
junit
.
Test
public
void
get_piece_name
()
{
Game
test_game
=
new
Game
();
assertEquals
(
test_game
.
get_piece_name
(
1
,
6
),
"P"
);
assertEquals
(
test_game
.
get_piece_name
(
0
,
4
),
"K"
);
assertEquals
(
test_game
.
get_piece_name
(
7
,
6
),
"N"
);
}
@org
.
junit
.
Test
public
void
make_move
()
throws
InterruptedException
{
Game
test_game
=
new
Game
();
test_game
.
initialize_board
();
assertEquals
(
test_game
.
make_move
(),
-
1
);
}
/*
@org.junit.Test
public void initialize_board() {
}
@org.junit.Test
public void add_piece_to_location() {
}
@org.junit.Test
public void print_board() {
}
@org.junit.Test
public void check_for_end_of_game() {
}
@org.junit.Test
public void pick_move() {
}
@org.junit.Test
public void get_all_moves() {
}
@org.junit.Test
public void get_legal_moves() {
}
@org.junit.Test
public void remove_moves_into_check() {
}
*/
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Main.java
+
1
−
1
View file @
07a4bb36
...
...
@@ -17,7 +17,7 @@ public class Main {
int
end_of_game
=
-
1
;
while
(
end_of_game
==
-
1
){
end_of_game
=
my_game
.
make_move
();
TimeUnit
.
SECONDS
.
sleep
(
5
);
TimeUnit
.
SECONDS
.
sleep
(
1
);
my_game
.
print_board
(
my_game
.
board
);
}
if
(
end_of_game
==
0
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment