from unittest import TestCase

from oo.carro import Motor, Direction


class CarroTestCase(TestCase):
    def teste_velocidade_inicial(self):
        motor = Motor()
        self.assertEqual(0,motor.speed)

    def teste_acelerar(self):
        motor = Motor()
        motor.increase_speed()
        self.assertEqual(1, motor.speed)

    def teste_acelerar_2(self):
        motor = Motor()
        for _ in range(2):
            motor.increase_speed()
        self.assertEqual(2, motor.speed)

    def teste_acelerar_3(self):
        motor = Motor()
        for _ in range(3):
            motor.increase_speed()
        self.assertEqual(3, motor.speed)

    def teste_freio(self):
        motor = Motor()
        for _ in range(3):
            motor.increase_speed()
        motor.brakes()
        self.assertEqual(1, motor.speed)

    def teste_freio2(self):
        motor = Motor()
        for _ in range(1):
            motor.increase_speed()
        motor.brakes()
        self.assertEqual(0, motor.speed)

    def teste_direcao(self):
        direcao = Direction()
        self.assertEqual('North', direcao.direction)

    def teste_direcao_2(self):
        direcao = Direction()
        direcao.turn_right()
        self.assertEqual('East', direcao.direction)

    def teste_direcao_3(self):
        direcao = Direction()
        direcao.turn_right()
        direcao.turn_left()
        direcao.turn_left()
        direcao.turn_right()