blob: c3523598303bf19491ab6bdfe0a264778a65fb7f [file] [log] [blame]
Tyler Chatowd28951f2019-02-16 20:12:28 -08001#include "y2019/joystick_angle.h"
2#include <iostream>
3#include "aos/input/driver_station_data.h"
4#include "gtest/gtest.h"
5
6using y2019::input::joysticks::JoystickAngle;
7using y2019::input::joysticks::GetJoystickPosition;
8
9TEST(JoystickAngleTest, JoystickAngleTest) {
10 EXPECT_EQ(JoystickAngle::kUpperRight, GetJoystickPosition(0.75, -0.75));
11 EXPECT_EQ(JoystickAngle::kMiddleRight, GetJoystickPosition(0.75, 0));
12 EXPECT_EQ(JoystickAngle::kLowerRight, GetJoystickPosition(0.75, 0.75));
13 EXPECT_EQ(JoystickAngle::kUpperLeft, GetJoystickPosition(-0.75, -0.75));
14 EXPECT_EQ(JoystickAngle::kMiddleLeft, GetJoystickPosition(-0.75, 0));
15 EXPECT_EQ(JoystickAngle::kLowerLeft, GetJoystickPosition(-0.75, 0.75));
16
17 EXPECT_EQ(JoystickAngle::kDefault, GetJoystickPosition(0, 0));
18}