Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
TU analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
belicfr committed Feb 7, 2024
1 parent 545723a commit bb63603
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions tests/engine/testGrille.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,39 @@ def test_est_gagnee_horizontal(self):

self.assertEqual(rond, grille.est_gagnee(3), "Les pion ronds doivent gagner")

def test_est_gagnee_horizontal_seconde_ligne(self):
grille = Grille()
rond = Rond()
croix = Croix()

for colonne in range(2):
grille.placer_pion(colonne, croix)

for colonne in range(2, 4):
grille.placer_pion(colonne, rond)

for colonne in range(4):
grille.placer_pion(colonne, rond)

self.assertEqual(rond, grille.est_gagnee(3), "Les pion ronds doivent gagner")

def test_est_gagnee_horizontal_seconde_ligne_droite(self):
grille = Grille()
rond = Rond()
croix = Croix()

grille.placer_pion(3, croix)
grille.placer_pion(4, croix)
grille.placer_pion(5, rond)
grille.placer_pion(6, rond)

grille.placer_pion(3, rond)
grille.placer_pion(4, rond)
grille.placer_pion(5, rond)
grille.placer_pion(6, rond)

self.assertEqual(rond, grille.est_gagnee(6), "Les pion ronds doivent gagner")

def test_est_gagnee_vertical(self):
grille = Grille()
rond = Rond()
Expand All @@ -87,6 +120,18 @@ def test_est_gagnee_vertical(self):

self.assertEqual(rond, grille.est_gagnee(0), "Les pion ronds doivent gagner")

def test_est_gagnee_vertical_seconde_ligne(self):
grille = Grille()
rond = Rond()
croix = Croix()

grille.placer_pion(0, croix)

for _ in range(4):
grille.placer_pion(0, rond)

self.assertEqual(rond, grille.est_gagnee(0), "Les pion ronds doivent gagner")

def test_est_gagnee_no_se(self):
grille = Grille()
rond = Rond()
Expand Down Expand Up @@ -139,7 +184,12 @@ def test_grille_est_pleine(self):

def test_dernier_pion_colonne(self):
grille = Grille()

self.assertEqual(None, grille.dernier_pion_colonne(1))
for i in range(6):

for _ in range(5):
grille.placer_pion(1, Rond())
self.assertEqual(i, grille.dernier_pion_colonne(1))

grille.placer_pion(1, Croix())

self.assertEqual(5, grille.dernier_pion_colonne(1))

0 comments on commit bb63603

Please sign in to comment.