Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .run/Run Jacoco.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Jacoco" type="GradleRunConfiguration" factoryName="Gradle" folderName="Unit Tests">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="TeamCode:testWithCoverage" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ public class DriveControlsTest {
MockMotorUtil mockMotor = new MockMotorUtil();

@BeforeEach
void motorSetup(){
void motorSetup() {
mockMotor.setUp();
driveControls = new DriveControls(mockMotor.hardwareMap);
}



@DisplayName("Pushing left stick Y fully should set all motors to 1.0")
@Test
void testSetDrivePower_forwardOnly() {
Expand Down Expand Up @@ -56,7 +55,8 @@ void testSetDrivePower_strafeRightOnly() {

@DisplayName("Pushing right stick X fully should set the left motors to 1.0" +
" and the right motors to -1.0")
@Test void testSetDrivePower_turnRight() {
@Test
void testSetDrivePower_turnRight() {
driveControls.setDrivePower(0.0f, 0.0f, -1.0f,
0.0f);

Expand Down Expand Up @@ -86,4 +86,16 @@ void testDriveBrakeInactive() {
verify(mockMotor.leftBack).setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
verify(mockMotor.rightBack).setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
}

@DisplayName("Go Forward when only left stick is assigned")
@Test
void testDriveForwardOnly() {
driveControls.setDrivePower(-1.0f);

// Expected power: all motors get 1.0
verify(mockMotor.leftFront).setPower(-1.0);
verify(mockMotor.rightFront).setPower(-1.0);
verify(mockMotor.leftBack).setPower(-1.0);
verify(mockMotor.rightBack).setPower(-1.0);
}
}