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
ebd0687b
Commit
ebd0687b
authored
7 years ago
by
dsjohns2
Browse files
Options
Downloads
Patches
Plain Diff
week1 submission
parent
35f14239
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Main.java
+3
-0
3 additions, 0 deletions
Main.java
Test.java
+51
-0
51 additions, 0 deletions
Test.java
with
54 additions
and
0 deletions
Main.java
+
3
−
0
View file @
ebd0687b
...
...
@@ -7,6 +7,9 @@ import java.util.concurrent.TimeUnit;
*/
public
class
Main
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
Test
test
=
new
Test
();
test
.
run_tests
();
Game
my_game
=
new
Game
();
my_game
.
initialize_board
();
my_game
.
print_board
(
my_game
.
board
);
...
...
This diff is collapsed.
Click to expand it.
Test.java
+
51
−
0
View file @
ebd0687b
package
com.company
;
import
java.util.List
;
import
java.util.Vector
;
/**
* This is the testing class
*/
public
class
Test
{
/**
* A method to run all my tests
*/
public
void
run_tests
(){
get_piece_name_test
();
}
/**
* A method to test the get_piece_name method
*/
public
void
get_piece_name_test
(){
Game
test_game
=
new
Game
();
assert
(
test_game
.
get_piece_name
(
1
,
6
)
==
"P"
);
assert
(
test_game
.
get_piece_name
(
0
,
4
)
==
"K"
);
assert
(
test_game
.
get_piece_name
(
7
,
6
)
==
"R"
);
}
/**
* A method to test the make_move method
*/
public
void
make_move_test
()
throws
InterruptedException
{
Game
test_game
=
new
Game
();
test_game
.
initialize_board
();
assert
(
test_game
.
make_move
()
==
-
1
);
}
/**
* A method to test the pick_move method
*/
public
void
pick_move_test
()
throws
InterruptedException
{
Game
test_game
=
new
Game
();
test_game
.
initialize_board
();
assert
(
test_game
.
make_move
()
==
-
1
);
}
/**
* A method to test the legal_square_addition method
*/
public
void
legal_square_addition_test
()
throws
InterruptedException
{
Piece
test_piece
=
new
Piece
();
List
<
int
[]>
squares
=
new
Vector
<
int
[]>();
int
[]
square
=
new
int
[
2
];
square
[
0
]
=
2
;
square
[
1
]
=
3
;
squares
.
add
(
square
);
assert
(
test_piece
.
legal_square_addition
(
2
,
3
)
==
squares
);
}
}
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