blob: 7173b80e3dd12521b155f85f9135bb6138bfeffa [file] [log] [blame]
Tyler Chatowd28951f2019-02-16 20:12:28 -08001#include "y2019/joystick_angle.h"
James Kuszmaul7077d342021-06-09 20:23:58 -07002
Tyler Chatowd28951f2019-02-16 20:12:28 -08003#include <iostream>
James Kuszmaul7077d342021-06-09 20:23:58 -07004
5#include "frc971/input/driver_station_data.h"
Tyler Chatowd28951f2019-02-16 20:12:28 -08006#include "gtest/gtest.h"
7
Tyler Chatowd28951f2019-02-16 20:12:28 -08008using y2019::input::joysticks::GetJoystickPosition;
James Kuszmaul7077d342021-06-09 20:23:58 -07009using y2019::input::joysticks::JoystickAngle;
Tyler Chatowd28951f2019-02-16 20:12:28 -080010
11TEST(JoystickAngleTest, JoystickAngleTest) {
Tyler Chatowc8012ca2019-02-18 22:33:01 -080012 EXPECT_EQ(JoystickAngle::kUpperRight, GetJoystickPosition(0.75, 0.75));
Tyler Chatowd28951f2019-02-16 20:12:28 -080013 EXPECT_EQ(JoystickAngle::kMiddleRight, GetJoystickPosition(0.75, 0));
Tyler Chatowc8012ca2019-02-18 22:33:01 -080014 EXPECT_EQ(JoystickAngle::kLowerRight, GetJoystickPosition(0.75, -0.75));
15 EXPECT_EQ(JoystickAngle::kUpperLeft, GetJoystickPosition(-0.75, 0.75));
Tyler Chatowd28951f2019-02-16 20:12:28 -080016 EXPECT_EQ(JoystickAngle::kMiddleLeft, GetJoystickPosition(-0.75, 0));
Tyler Chatowc8012ca2019-02-18 22:33:01 -080017 EXPECT_EQ(JoystickAngle::kLowerLeft, GetJoystickPosition(-0.75, -0.75));
Tyler Chatowd28951f2019-02-16 20:12:28 -080018
19 EXPECT_EQ(JoystickAngle::kDefault, GetJoystickPosition(0, 0));
20}