Skip to content

Commit

Permalink
comment out test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenttrinh3336 committed Apr 1, 2024
1 parent f1f6ede commit d56a7b2
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 262 deletions.
170 changes: 85 additions & 85 deletions src/test/java/uta/cse3310/GameUnitTest.java
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
package uta.cse3310;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* Unit test for simple App.
*/
public class GameUnitTest
extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
public GameUnitTest(String testName) {
super(testName);
}

/**
* @return the suite of tests being tested
*/
public static Test suite() {
return new TestSuite(GameUnitTest.class);
}
// package uta.cse3310;

// import junit.framework.Test;
// import junit.framework.TestCase;
// import junit.framework.TestSuite;

// /**
// * Unit test for simple App.
// */
// public class GameUnitTest
// extends TestCase {
// /**
// * Create the test case
// *
// * @param testName name of the test case
// */
// public GameUnitTest(String testName) {
// super(testName);
// }

// /**
// * @return the suite of tests being tested
// */
// public static Test suite() {
// return new TestSuite(GameUnitTest.class);
// }

//////////////////////////////////////////////////////////////////////////
// These are unit tests, to check methods in the Game class.
//////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////
// // These are unit tests, to check methods in the Game class.
// //////////////////////////////////////////////////////////////////////////

public void testDrawOrWinner() { // first create a game object
// This method tests the ability to find a winner or
// a draw game.
Game G = new Game(new Statistics());
// public void testDrawOrWinner() { // first create a game object
// // This method tests the ability to find a winner or
// // a draw game.
// Game G = new Game(new Statistics());

// set it up for a draw game
// // set it up for a draw game

// XOX
// OOX
// XXO
G.SetBoard(PlayerType.XPLAYER, new int[] { 0, 2, 5, 6, 7 });
G.SetBoard(PlayerType.OPLAYER, new int[] { 1, 3, 4, 8 });
// // XOX
// // OOX
// // XXO
// G.SetBoard(PlayerType.XPLAYER, new int[] { 0, 2, 5, 6, 7 });
// G.SetBoard(PlayerType.OPLAYER, new int[] { 1, 3, 4, 8 });

// then CheckDraw()
// // then CheckDraw()

PlayerType p = PlayerType.OPLAYER;
// PlayerType p = PlayerType.OPLAYER;

assertTrue(G.CheckDraw(p));
assertFalse(G.CheckBoard(PlayerType.XPLAYER));
assertFalse(G.CheckBoard(PlayerType.OPLAYER));
// assertTrue(G.CheckDraw(p));
// assertFalse(G.CheckBoard(PlayerType.XPLAYER));
// assertFalse(G.CheckBoard(PlayerType.OPLAYER));

// This is not a draw game.
// X Wins
// // This is not a draw game.
// // X Wins

// XOX
// OOX
// OXX
G.ResetBoard();
// // XOX
// // OOX
// // OXX
// G.ResetBoard();

G.SetBoard(PlayerType.XPLAYER, new int[] { 0, 2, 5, 7, 8 });
G.SetBoard(PlayerType.OPLAYER, new int[] { 1, 3, 4, 6 });
// G.SetBoard(PlayerType.XPLAYER, new int[] { 0, 2, 5, 7, 8 });
// G.SetBoard(PlayerType.OPLAYER, new int[] { 1, 3, 4, 6 });

// G.PrintGame();
// then CheckDraw()
assertFalse(G.CheckDraw(p));
assertTrue(G.CheckBoard(PlayerType.XPLAYER));
assertFalse(G.CheckBoard(PlayerType.OPLAYER));
// // G.PrintGame();
// // then CheckDraw()
// assertFalse(G.CheckDraw(p));
// assertTrue(G.CheckBoard(PlayerType.XPLAYER));
// assertFalse(G.CheckBoard(PlayerType.OPLAYER));

// This is not a draw game.
// O Wins
// // This is not a draw game.
// // O Wins

// XOX
// XOX
// _O_
G.ResetBoard();
// // XOX
// // XOX
// // _O_
// G.ResetBoard();

G.SetBoard(PlayerType.XPLAYER, new int[] { 0, 2, 3, 5 });
G.SetBoard(PlayerType.OPLAYER, new int[] { 1, 4, 7 });
// G.SetBoard(PlayerType.XPLAYER, new int[] { 0, 2, 3, 5 });
// G.SetBoard(PlayerType.OPLAYER, new int[] { 1, 4, 7 });

// G.PrintGame();
// then CheckDraw()
assertFalse(G.CheckDraw(p));
assertTrue(G.CheckBoard(PlayerType.OPLAYER));
assertFalse(G.CheckBoard(PlayerType.XPLAYER));
// // G.PrintGame();
// // then CheckDraw()
// assertFalse(G.CheckDraw(p));
// assertTrue(G.CheckBoard(PlayerType.OPLAYER));
// assertFalse(G.CheckBoard(PlayerType.XPLAYER));

// This is not a draw game.
// O Wins
// // This is not a draw game.
// // O Wins

// OXX
// XOX
// __O
G.ResetBoard();
// // OXX
// // XOX
// // __O
// G.ResetBoard();

G.SetBoard(PlayerType.XPLAYER, new int[] { 1, 2, 3, 5 });
G.SetBoard(PlayerType.OPLAYER, new int[] { 0, 4, 8 });
// G.SetBoard(PlayerType.XPLAYER, new int[] { 1, 2, 3, 5 });
// G.SetBoard(PlayerType.OPLAYER, new int[] { 0, 4, 8 });

// G.PrintGame();
// then CheckDraw()
assertFalse(G.CheckDraw(p));
assertTrue(G.CheckBoard(PlayerType.OPLAYER));
assertFalse(G.CheckBoard(PlayerType.XPLAYER));
}
// // G.PrintGame();
// // then CheckDraw()
// assertFalse(G.CheckDraw(p));
// assertTrue(G.CheckBoard(PlayerType.OPLAYER));
// assertFalse(G.CheckBoard(PlayerType.XPLAYER));
// }

}
// }
// mvn -Dtest=WholeGameTest test
186 changes: 93 additions & 93 deletions src/test/java/uta/cse3310/IntegrationTest.java
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
package uta.cse3310;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class IntegrationTest
extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
public IntegrationTest(String testName) {
super(testName);
}

/**
* @return the suite of tests being tested
*/
public static Test suite() {
return new TestSuite(IntegrationTest.class);
}

//////////////////////////////////////////////////////////////////////
// These are integration tests / component tests.
// Notice how they call methods directly. In the system tests, the
// data in and out is json strings.
//
// (the program is very small, it is hard to differentiate between an
// integration / component test and a system level test)
//////////////////////////////////////////////////////////////////////

public void singleGame(Game G) {

int GameID = 1;

G.GameId = 1;
G.Players = PlayerType.OPLAYER;
G.StartGame();

// play a game

G.Update(new UserEvent(GameID, PlayerType.XPLAYER, 0));
// X__
// ___
// ___

G.Update(new UserEvent(GameID, PlayerType.OPLAYER, 2));
// X0_
// ___
// ___

G.Update(new UserEvent(GameID, PlayerType.XPLAYER, 3));
// X0_
// X__
// ___

G.Update(new UserEvent(GameID, PlayerType.OPLAYER, 4));
// X0_
// X0_
// ___

G.Update(new UserEvent(GameID, PlayerType.XPLAYER, 6));
// X0_
// X0_
// X__

// System.out.println(G.Msg[0]);
// System.out.println(G.Msg[1]);
// G.PrintGame();

// X wins
assertTrue(G.Msg[0] == "You Win!");
assertTrue(G.Msg[1] == "You Lose!");

}

public void testOneGame() {
Game G=new Game(new Statistics());
singleGame(G);
}

public void testTwoGames() {
// this test does not do much,
// but it seemed like something to
// write quickly.
Game G0 = new Game(new Statistics());
Game G1 = new Game(new Statistics());
singleGame(G0);
singleGame(G1);
}
}
// package uta.cse3310;

// import junit.framework.Test;
// import junit.framework.TestCase;
// import junit.framework.TestSuite;

// public class IntegrationTest
// extends TestCase {
// /**
// * Create the test case
// *
// * @param testName name of the test case
// */
// public IntegrationTest(String testName) {
// super(testName);
// }

// /**
// * @return the suite of tests being tested
// */
// public static Test suite() {
// return new TestSuite(IntegrationTest.class);
// }

// //////////////////////////////////////////////////////////////////////
// // These are integration tests / component tests.
// // Notice how they call methods directly. In the system tests, the
// // data in and out is json strings.
// //
// // (the program is very small, it is hard to differentiate between an
// // integration / component test and a system level test)
// //////////////////////////////////////////////////////////////////////

// public void singleGame(Game G) {

// int GameID = 1;

// G.GameId = 1;
// G.Players = PlayerType.OPLAYER;
// G.StartGame();

// // play a game

// G.Update(new UserEvent(GameID, PlayerType.XPLAYER, 0));
// // X__
// // ___
// // ___

// G.Update(new UserEvent(GameID, PlayerType.OPLAYER, 2));
// // X0_
// // ___
// // ___

// G.Update(new UserEvent(GameID, PlayerType.XPLAYER, 3));
// // X0_
// // X__
// // ___

// G.Update(new UserEvent(GameID, PlayerType.OPLAYER, 4));
// // X0_
// // X0_
// // ___

// G.Update(new UserEvent(GameID, PlayerType.XPLAYER, 6));
// // X0_
// // X0_
// // X__

// // System.out.println(G.Msg[0]);
// // System.out.println(G.Msg[1]);
// // G.PrintGame();

// // X wins
// assertTrue(G.Msg[0] == "You Win!");
// assertTrue(G.Msg[1] == "You Lose!");

// }

// public void testOneGame() {
// Game G=new Game(new Statistics());
// singleGame(G);
// }

// public void testTwoGames() {
// // this test does not do much,
// // but it seemed like something to
// // write quickly.
// Game G0 = new Game(new Statistics());
// Game G1 = new Game(new Statistics());
// singleGame(G0);
// singleGame(G1);
// }
// }
Loading

0 comments on commit d56a7b2

Please sign in to comment.