Skip to content

Commit

Permalink
double big gulp cup
Browse files Browse the repository at this point in the history
  • Loading branch information
maxspier committed Nov 28, 2023
1 parent 297329b commit 48d7a15
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/test/java/com/team766/shooter/ShooterTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import edu.wpi.first.wpilibj.Filesystem;


public class ShooterTestCase{
public class ShooterTestCase {

static ArrayList<Double> distancesToTest = new ArrayList<Double>();
static ArrayList<Double> powersThatWork = new ArrayList<Double>();
Expand Down Expand Up @@ -53,7 +53,8 @@ public static void setUp() throws Exception {


public void go() {
for(int i = 0; i<distancesToTest.size(); i++){

for(int i = 0; i < distancesToTest.size(); i++){
double power = calibration.shootAndCalculate(distancesToTest.get(i).doubleValue());

//generous error margin
Expand All @@ -62,14 +63,14 @@ public void go() {
}else{
double lastPower = power;

while(Math.abs(lastPower - powersThatWork.get(i).doubleValue()) < 0.03){
while(Math.abs(lastPower - powersThatWork.get(i).doubleValue()) > 0.03){
if(lastPower > powersThatWork.get(i).doubleValue()){
lastPower = goAgain(false, true);
}else{
lastPower = goAgain(false, false);
}
}

calibration.thisHappenedWithShot(true, false);
}
}
calibration.reset();
Expand Down Expand Up @@ -99,7 +100,7 @@ protected void isCorrect(){

for(int i = 0; i < distancesToTest.size(); i++){

assertEquals("Distances tested need to equal each other", (double)distancesToTest.get(i), (double)dist.get(i));
assertEquals("Distances tested need to equal each other", (double)distancesToTest.get(i), (double)dist.get(i),0);
assertEquals("Powers tested should be within a reasonable difference of what actually works", (double)powersThatWork.get(i), (double)pow.get(i), 0.03); // see look how generoys
}

Expand Down

0 comments on commit 48d7a15

Please sign in to comment.