mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 00:38:01 -06:00
Add UtilityTest Template
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.utility;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import org.junit.*;
|
||||
|
||||
import edu.wpi.first.wpilibj.*;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public class UtilityTest {
|
||||
@Test
|
||||
public void testExample() {
|
||||
// Arrange
|
||||
boolean isFalse = false;
|
||||
int i = 0;
|
||||
double d = 0.0;
|
||||
|
||||
// Act
|
||||
wait(1);
|
||||
isFalse = !isFalse;
|
||||
i++;
|
||||
d -= Math.PI;
|
||||
|
||||
// Assert
|
||||
assertEquals(1, i);
|
||||
assertEquals(-Math.PI, d, 0.001);
|
||||
assertEquals(true, isFalse);
|
||||
}
|
||||
|
||||
private void wait(int millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user