-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from gamestate import GameState | ||
|
||
def test_set_player_position(): | ||
# Create a GameState object | ||
state = GameState() | ||
|
||
# Test case 1: Set player position | ||
new_position = (0, 0) | ||
state.set_player_position(1, new_position) | ||
assert state.playfield_value(new_position) == 1 | ||
|
||
def test_set_winner(): | ||
# Create a GameState object | ||
state = GameState() | ||
|
||
# Test case 1: Set winner | ||
state.set_winner(1) | ||
assert state.winner == 1 | ||
assert state.finished == True | ||
|
||
def test_playfield(): | ||
# Create a GameState object | ||
state = GameState() | ||
|
||
# Test case 1: Check playfield | ||
assert state.playfield == [[0, 0, 0], [0, 0, 0], [0, 0, 0]] | ||
|
||
def test_playfield_value(): | ||
# Create a GameState object | ||
state = GameState() | ||
|
||
# Test case 1: Check playfield value | ||
position = (0, 0) | ||
assert state.playfield_value(position) == 0 | ||
|
||
# Run the test cases | ||
test_set_player_position() | ||
test_set_winner() | ||
test_playfield() | ||
test_playfield_value() |