Ejemplo n.º 1
0
def test_direction_reverse_to_right():
    state = {
        'current_direction': constants.DIRECTION_REVERSE,
        'left_motor_speed': -50,
        'right_motor_speed': -50
    }
    expect(MotorSpeedResolver().resolve(state,
                                        constants.TARGET_ACTION_RIGHT)).to(
                                            equal({
                                                'left_motor_speed': -55,
                                                'right_motor_speed': -45
                                            }))
Ejemplo n.º 2
0
def test_direction_forward_to_left():
    state = {
        'current_direction': constants.DIRECTION_FORWARD,
        'left_motor_speed': 50,
        'right_motor_speed': 50
    }
    expect(MotorSpeedResolver().resolve(state,
                                        constants.TARGET_ACTION_LEFT)).to(
                                            equal({
                                                'left_motor_speed': 45,
                                                'right_motor_speed': 55
                                            }))
Ejemplo n.º 3
0
def test_direction_reverse_right_to_forward():
    state = {
        'current_direction': constants.DIRECTION_REVERSE_RIGHT,
        'left_motor_speed': -80,
        'right_motor_speed': -50
    }
    expect(MotorSpeedResolver().resolve(state,
                                        constants.TARGET_ACTION_FORWARD)).to(
                                            equal({
                                                'left_motor_speed': -70,
                                                'right_motor_speed': -40
                                            }))
Ejemplo n.º 4
0
def test_direction_reverse_left_to_reverse():
    state = {
        'current_direction': constants.DIRECTION_REVERSE_LEFT,
        'left_motor_speed': -50,
        'right_motor_speed': -80
    }
    expect(MotorSpeedResolver().resolve(state,
                                        constants.TARGET_ACTION_REVERSE)).to(
                                            equal({
                                                'left_motor_speed': -80,
                                                'right_motor_speed': -80
                                            }))
Ejemplo n.º 5
0
def test_direction_left_to_right():
    state = {
        'current_direction': constants.DIRECTION_LEFT,
        'left_motor_speed': -50,
        'right_motor_speed': 50
    }
    expect(MotorSpeedResolver().resolve(state,
                                        constants.TARGET_ACTION_RIGHT)).to(
                                            equal({
                                                'left_motor_speed': -40,
                                                'right_motor_speed': 40
                                            }))
Ejemplo n.º 6
0
def test_direction_forward_left_to_reverse():
    state = {
        'current_direction': constants.DIRECTION_FORWARD_LEFT,
        'left_motor_speed': 40,
        'right_motor_speed': 60
    }
    # TODO
    expect(MotorSpeedResolver().resolve(state,
                                        constants.TARGET_ACTION_REVERSE)).to(
                                            equal({
                                                'left_motor_speed': 30,
                                                'right_motor_speed': 50
                                            }))