diff --git a/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java b/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java index 20906e7e..46cb5813 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java @@ -18,35 +18,38 @@ public class RotationNRTest { @Test public void test() { int failCount = 0; - for(int i=0;i<100;i++){ - double tilt= Math.toRadians(Math.random()*360.0-180); - double elevation= Math.toRadians(Math.random()*360.0-180); - double azumus=Math.toRadians(Math.random()*360.0-180); - RotationNR rotTest = new RotationNR( Math.toDegrees(tilt), Math.toDegrees(azumus),Math.toDegrees(elevation)); - System.out.println("\n\nTest #"+i); - System.out.println("Testing Az="+Math.toDegrees(azumus)+ - " El="+Math.toDegrees(elevation)+ - " Tl="+Math.toDegrees(tilt)); - System.out.println("Got Az="+Math.toDegrees(rotTest.getRotationAzimuth())+ - " El="+Math.toDegrees(rotTest.getRotationElevation())+ - " Tl="+Math.toDegrees(rotTest.getRotationTilt())); - if(!RotationNR.bound(tilt-.001, tilt+.001, rotTest.getRotationTilt())){ + for (int i = 0; i < 100; i++) { + double tilt = Math.toRadians(Math.random() * 360.0 - 180); + double elevation = Math.toRadians(Math.random() * 360.0 - 180); + double azumus = Math.toRadians(Math.random() * 360.0 - 180); + RotationNR rotTest = new RotationNR(Math.toDegrees(tilt), Math.toDegrees(azumus), + Math.toDegrees(elevation)); + System.out.println("\n\nTest #" + i); + System.out.println("Testing Az=" + Math.toDegrees(azumus) + " El=" + Math.toDegrees(elevation) + " Tl=" + + Math.toDegrees(tilt)); + System.out.println("Got Az=" + Math.toDegrees(rotTest.getRotationAzimuth()) + " El=" + + Math.toDegrees(rotTest.getRotationElevation()) + " Tl=" + + Math.toDegrees(rotTest.getRotationTilt())); + if (!RotationNR.bound(tilt - .001, tilt + .001, rotTest.getRotationTilt())) { failCount++; - System.err.println("Rotation Tilt is not consistant. expected "+ Math.toDegrees(tilt)+" got " +Math.toDegrees(rotTest.getRotationTilt())); + System.err.println("Rotation Tilt is not consistant. expected " + Math.toDegrees(tilt) + " got " + + Math.toDegrees(rotTest.getRotationTilt())); } - if(!RotationNR.bound(elevation-.001, elevation+.001, rotTest.getRotationElevation())){ + if (!RotationNR.bound(elevation - .001, elevation + .001, rotTest.getRotationElevation())) { failCount++; - System.err.println("Rotation Elevation is not consistant. expected "+ Math.toDegrees(elevation)+" got " +Math.toDegrees(rotTest.getRotationElevation())); + System.err.println("Rotation Elevation is not consistant. expected " + Math.toDegrees(elevation) + + " got " + Math.toDegrees(rotTest.getRotationElevation())); } - if(!RotationNR.bound(azumus-.001, azumus+.001, rotTest.getRotationAzimuth())){ + if (!RotationNR.bound(azumus - .001, azumus + .001, rotTest.getRotationAzimuth())) { failCount++; - System.err.println("Rotation Tilt is not consistant. expected "+Math.toDegrees( azumus)+" got " +Math.toDegrees(rotTest.getRotationAzimuth())); + System.err.println("Rotation Tilt is not consistant. expected " + Math.toDegrees(azumus) + " got " + + Math.toDegrees(rotTest.getRotationAzimuth())); } } - - if(failCount>200){ - fail("Rotation failed "+failCount+" times"); - + + if (failCount > 200) { + fail("Rotation failed " + failCount + " times"); + } }