Example #1
0
class TestTablero(unittest.TestCase):
    def setUp(self):
        self.f = Ficha()
        self.ju = Jugador(self.f, "Alex")
        self.t = Tablero()
        
    def test_init_tablero(self):
        self.assertIsInstance(self.t, Tablero)
        
    def llenaTablero(self):
        for i in xrange(self.t.w):
            for j in xrange(self.t.h):
                self.t._inserta(Jugada(i,self.ju))
                
    def vaciaTablero(self):
        for i in xrange(self.t.w):
            for j in xrange(self.t.h):
               self.t.matrix[j][i] = None
               
    def test_lleno_tablero(self):
        self.llenaTablero()
        for i in xrange(self.t.w):
            for j in xrange(self.t.h):
                self.assertEquals(self.t.matrix[j][i], self.f)

    def test_no_caben(self):
        self.llenaTablero()
        for i in xrange(self.t.w):
            self.assertEquals(self.t._columnaLlena(Jugada(i,self.ju)),True)
            self.assertNotEquals(self.t._valida(Jugada(i, self.ju)),True)

    def test_tableroLleno(self):
        self.llenaTablero()
        self.assertEquals(self.t._tableroLleno(),True)
        self.vaciaTablero()
        self.assertEquals(self.t._tableroLleno(), False)
Example #2
0
 def setUp(self):
     self.f = Ficha()
     self.ju = Jugador(self.f, "Alex")
     self.t = Tablero()