Skip to content

Commit fcf4740

Browse files
authored
Synced exercise to problem specs and regenerated tests. (#4302)
1 parent e66a0c9 commit fcf4740

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎exercises/practice/state-of-tic-tac-toe/.meta/tests.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ reimplements = "b1dc8b13-46c4-47db-a96d-aa90eedc4e8d"
9999

100100
[4801cda2-f5b7-4c36-8317-3cdd167ac22c]
101101
description = "Invalid boards -> Invalid board: players kept playing after a win"
102+
103+
[5a84757a-fc86-4328-aec9-a5759e6ed35d]
104+
description = "Invalid boards -> Invalid board: O kept playing after X wins"
105+
106+
[cf25543d-583a-4656-b9ab-f82dc00a4a02]
107+
description = "Invalid boards -> Invalid board: X kept playing after O wins"

‎exercises/practice/state-of-tic-tac-toe/state_of_tic_tac_toe_test.py‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These tests are auto-generated with test data from:
22
# https://github.com/exercism/problem-specifications/tree/main/exercises/state-of-tic-tac-toe/canonical-data.json
3-
# File last updated on 2026-01-30
3+
# File last updated on 2026-09-30
44

55
import unittest
66

@@ -243,3 +243,31 @@ def test_invalid_board_players_kept_playing_after_a_win(self):
243243
err.exception.args[0],
244244
"Impossible board: game should have ended after the game was won",
245245
)
246+
247+
def test_invalid_board_o_kept_playing_after_x_wins(self):
248+
board = [
249+
"OO ",
250+
"XXX",
251+
" O ",
252+
]
253+
with self.assertRaises(ValueError) as err:
254+
gamestate(board)
255+
self.assertEqual(type(err.exception), ValueError)
256+
self.assertEqual(
257+
err.exception.args[0],
258+
"Impossible board: game should have ended after the game was won",
259+
)
260+
261+
def test_invalid_board_x_kept_playing_after_o_wins(self):
262+
board = [
263+
"XX ",
264+
"OOO",
265+
" XX",
266+
]
267+
with self.assertRaises(ValueError) as err:
268+
gamestate(board)
269+
self.assertEqual(type(err.exception), ValueError)
270+
self.assertEqual(
271+
err.exception.args[0],
272+
"Impossible board: game should have ended after the game was won",
273+
)

0 commit comments

Comments
 (0)