Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit bc7a5e5

Browse files
author
Corvin Bazgan
committed
Added the testForward case for AutoMoveTo. This test also fails and the bug needs fixing.
1 parent ff28259 commit bc7a5e5

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Robot2018/test/org/usfirst/frc/team199/Robot2018/AutoMoveToTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,26 @@ void testForwardAndRight() {
112112
assertEquals(12, AutoUtils.getX());
113113
assertEquals(12, AutoUtils.getY());
114114
}
115+
116+
@Test
117+
void testForward() {
118+
String[] args = {"(0,12)"};
119+
120+
AutoUtils.setRot(0);
121+
AutoUtils.setX(0);
122+
AutoUtils.setY(0);
123+
124+
PIDSource pidGyroSrc = mock(PIDSource.class);
125+
when(pidGyroSrc.getPIDSourceType()).thenReturn(PIDSourceType.kDisplacement);
126+
DrivetrainInterface dt = mock(DrivetrainInterface.class);
127+
when(dt.getGyro()).thenReturn(pidGyroSrc);
128+
SmartDashboardInterface sd = mock(SmartDashboardInterface.class);
129+
PIDSource pidMoveSrc = mock(PIDSource.class);
130+
131+
AutoMoveTo testAMT = new AutoMoveTo(args, dt, sd, pidMoveSrc);
132+
133+
assertEquals(0, AutoUtils.getRot());
134+
assertEquals(0, AutoUtils.getX());
135+
assertEquals(12, AutoUtils.getY());
136+
}
115137
}

0 commit comments

Comments
 (0)