Skip to content
Snippets Groups Projects
Commit 07a4bb36 authored by dsjohns2's avatar dsjohns2
Browse files

add units tests!

parent cbfabbd3
No related branches found
No related tags found
No related merge requests found
......@@ -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){
......
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
......@@ -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){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment