-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathElevatorTest.java
60 lines (42 loc) · 1.85 KB
/
ElevatorTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 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 frc;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import edu.wpi.first.wpilibj.PWMTalonSRX;
import frc.robot.subsystems.elevator.ElevatorSubsystem;
/**
* Elevator JUnit tests
*/
public class ElevatorTest {
@Test
public void elevatorLevelIncreaseTest() {
ElevatorSubsystem elevator = new ElevatorSubsystem(new PWMTalonSRX(0));
elevator.increaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 2, true);
elevator.increaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 3, true);
elevator.increaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 3, true);
elevator.close();
}
@Test
public void elevatorLevelDecreaseTest() {
ElevatorSubsystem elevator = new ElevatorSubsystem(new PWMTalonSRX(1));
elevator.increaseLevel();
elevator.increaseLevel();
elevator.increaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 3, true);
elevator.decreaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 2, true);
elevator.decreaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 1, true);
elevator.decreaseLevel();
assertEquals(elevator.getCurrentLevelNum() == 1, true);
elevator.close();
}
}