Fixed unittest failure in LogLevelTest. Added config dir with logback
config file that set logging to stdout and level to Error. Modified unittest target used by travis-ci to use new logback config file to reduce clutter in unittest output. Commented out superfluous System.println's from various unit tests to also reduce clutter.
This commit is contained in:
parent
b1b2bc5abe
commit
845780a2bc
@ -326,6 +326,7 @@ ${nonascii}</fail>
|
|||||||
<!-- <formatter type="xml"/> -->
|
<!-- <formatter type="xml"/> -->
|
||||||
<formatter type="plain" usefile="false" />
|
<formatter type="plain" usefile="false" />
|
||||||
</batchtest>
|
</batchtest>
|
||||||
|
<jvmarg value="-Dlogback.configurationFile=config/logback-stdout-level-error.xml"/>
|
||||||
</junit>
|
</junit>
|
||||||
<fail if="junit.failure" message="Unit test(s) failed. See output above for failures."/>
|
<fail if="junit.failure" message="Unit test(s) failed. See output above for failures."/>
|
||||||
<echo>
|
<echo>
|
||||||
|
14
core/config/logback-stdout-level-error.xml
Normal file
14
core/config/logback-stdout-level-error.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<configuration>
|
||||||
|
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<!-- encoders are assigned the type
|
||||||
|
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="ERROR">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
@ -320,7 +320,7 @@ public class TestRockets {
|
|||||||
finset.setFinCount(4);
|
finset.setFinCount(4);
|
||||||
|
|
||||||
finset.setCantAngle(0 * Math.PI / 180);
|
finset.setCantAngle(0 * Math.PI / 180);
|
||||||
System.err.println("Fin cant angle: " + (finset.getCantAngle() * 180 / Math.PI));
|
//System.err.println("Fin cant angle: " + (finset.getCantAngle() * 180 / Math.PI));
|
||||||
|
|
||||||
mcomp = new MassComponent(0.2, 0.03, 0.045 + 0.060);
|
mcomp = new MassComponent(0.2, 0.03, 0.045 + 0.060);
|
||||||
mcomp.setRelativePosition(Position.TOP);
|
mcomp.setRelativePosition(Position.TOP);
|
||||||
@ -539,7 +539,7 @@ public class TestRockets {
|
|||||||
|
|
||||||
|
|
||||||
finset.setCantAngle(0 * Math.PI / 180);
|
finset.setCantAngle(0 * Math.PI / 180);
|
||||||
System.err.println("Fin cant angle: " + (finset.getCantAngle() * 180 / Math.PI));
|
//System.err.println("Fin cant angle: " + (finset.getCantAngle() * 180 / Math.PI));
|
||||||
|
|
||||||
|
|
||||||
// Stage construction
|
// Stage construction
|
||||||
|
@ -227,10 +227,11 @@ public class UpdateInfoTest extends BaseTestCase {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
} catch (InterruptedException e) { }
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Waiting took " + (System.currentTimeMillis()-t) + " ms");
|
//System.out.println("Waiting took " + (System.currentTimeMillis()-t) + " ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@ public class TestDirectoryIterator {
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
System.out.println("" + iterator.next());
|
// TODO need checks here to ensure correct things were done
|
||||||
|
//System.out.println("" + iterator.next());
|
||||||
|
iterator.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,17 +41,18 @@ public class RocksimDocumentDTOTest extends RocksimTestBase {
|
|||||||
RocksimDocumentDTO message = new RocksimDocumentDTO();
|
RocksimDocumentDTO message = new RocksimDocumentDTO();
|
||||||
message.setDesign(design);
|
message.setDesign(design);
|
||||||
|
|
||||||
|
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
marshaller.marshal(message, stringWriter);
|
marshaller.marshal(message, stringWriter);
|
||||||
|
|
||||||
String response = stringWriter.toString();
|
String response = stringWriter.toString();
|
||||||
|
|
||||||
System.err.println(response);
|
// TODO need checks here to validation that correct things were done
|
||||||
|
//System.err.println(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRoundTrip() throws Exception {
|
public void testRoundTrip() throws Exception {
|
||||||
|
// TODO need checks here to validate that correct things were done
|
||||||
OpenRocketDocument ord = RocksimLoaderTest.loadRocksimRocket3(new RocksimLoader());
|
OpenRocketDocument ord = RocksimLoaderTest.loadRocksimRocket3(new RocksimLoader());
|
||||||
|
|
||||||
Assert.assertNotNull(ord);
|
Assert.assertNotNull(ord);
|
||||||
|
@ -1,22 +1,64 @@
|
|||||||
package net.sf.openrocket.logging;
|
package net.sf.openrocket.logging;
|
||||||
|
|
||||||
import static net.sf.openrocket.logging.LogLevel.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class LogLevelTest {
|
public class LogLevelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLevels() {
|
public void testLogLevelSeverityCompares() {
|
||||||
assertTrue(DEBUG.atLeast(DEBUG));
|
|
||||||
assertFalse(DEBUG.atLeast(INFO));
|
|
||||||
assertTrue(ERROR.atLeast(WARN));
|
|
||||||
|
|
||||||
assertTrue(ERROR.moreThan(WARN));
|
// tests comparing level to itself
|
||||||
assertFalse(ERROR.moreThan(ERROR));
|
assertTrue(LogLevel.DEBUG.atLeast(LogLevel.DEBUG));
|
||||||
|
assertFalse(LogLevel.DEBUG.moreThan(LogLevel.DEBUG));
|
||||||
|
|
||||||
assertEquals(5, LENGTH);
|
// tests comparing high severity to lower severity (positive tests)
|
||||||
|
assertTrue(LogLevel.ERROR.atLeast(LogLevel.WARN));
|
||||||
|
assertTrue(LogLevel.ERROR.moreThan(LogLevel.WARN));
|
||||||
|
assertTrue(LogLevel.STDERR.atLeast(LogLevel.VBOSE));
|
||||||
|
assertTrue(LogLevel.STDERR.moreThan(LogLevel.VBOSE));
|
||||||
|
|
||||||
|
// tests comparing lower severity to higher severity (negative tests)
|
||||||
|
assertFalse(LogLevel.WARN.atLeast(LogLevel.ERROR));
|
||||||
|
assertFalse(LogLevel.WARN.moreThan(LogLevel.ERROR));
|
||||||
|
assertFalse(LogLevel.VBOSE.atLeast(LogLevel.STDERR));
|
||||||
|
assertFalse(LogLevel.VBOSE.moreThan(LogLevel.STDERR));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLogLevelFromString() {
|
||||||
|
|
||||||
|
LogLevel logLevelReturned;
|
||||||
|
|
||||||
|
// null value should return default
|
||||||
|
logLevelReturned = LogLevel.fromString(null, LogLevel.INFO);
|
||||||
|
assertTrue(logLevelReturned == LogLevel.INFO);
|
||||||
|
|
||||||
|
// invalid value should return default
|
||||||
|
logLevelReturned = LogLevel.fromString("not a valid log level", LogLevel.INFO);
|
||||||
|
assertTrue(logLevelReturned == LogLevel.INFO);
|
||||||
|
|
||||||
|
// lowercase value should be uppercased and return correct same value
|
||||||
|
logLevelReturned = LogLevel.fromString("debug", LogLevel.INFO);
|
||||||
|
assertTrue(logLevelReturned == LogLevel.DEBUG);
|
||||||
|
|
||||||
|
// leading and trailing whitespace in value should be trimmed and return correct same value
|
||||||
|
logLevelReturned = LogLevel.fromString(" DEBUG ", LogLevel.INFO);
|
||||||
|
assertTrue(logLevelReturned == LogLevel.DEBUG);
|
||||||
|
|
||||||
|
// value of all should return lowest level (most verbose) of logging
|
||||||
|
logLevelReturned = LogLevel.fromString("all", LogLevel.INFO);
|
||||||
|
assertTrue(logLevelReturned == LogLevel.LOWEST);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMaxLengthOfAnyLogLevelName() {
|
||||||
|
assertEquals("Max length of at least one log level name is different than expected.", 6, LogLevel.LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class ComponentCompareTest extends BaseTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testComponentEquality() {
|
public void testComponentEquality() {
|
||||||
|
|
||||||
System.out.println("TEST CLASSPATH: " + System.getProperty("java.class.path"));
|
//System.out.println("TEST CLASSPATH: " + System.getProperty("java.class.path"));
|
||||||
|
|
||||||
Rocket r1 = net.sf.openrocket.util.TestRockets.makeBigBlue();
|
Rocket r1 = net.sf.openrocket.util.TestRockets.makeBigBlue();
|
||||||
Rocket r2 = net.sf.openrocket.util.TestRockets.makeBigBlue();
|
Rocket r2 = net.sf.openrocket.util.TestRockets.makeBigBlue();
|
||||||
|
@ -24,14 +24,14 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
double volume = Math.PI / 3.0;
|
double volume = Math.PI / 3.0;
|
||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -58,15 +58,15 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
double volume = Math.PI / 3.0;
|
double volume = Math.PI / 3.0;
|
||||||
volume += Math.PI;
|
volume += Math.PI;
|
||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume + "\t" + mass);
|
//System.out.println(volume + "\t" + mass);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -90,8 +90,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
double volume = Math.PI / 3.0; // outer volume
|
double volume = Math.PI / 3.0; // outer volume
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -132,8 +132,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
double volume = Math.PI / 3.0; // outer volume
|
double volume = Math.PI / 3.0; // outer volume
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -175,14 +175,14 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
double volume = Math.PI / 3.0 * (2.0 * 2.0 + 2.0 * 1.0 + 1.0 * 1.0) * 4.0;
|
double volume = Math.PI / 3.0 * (2.0 * 2.0 + 2.0 * 1.0 + 1.0 * 1.0) * 4.0;
|
||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -213,8 +213,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
double volume = Math.PI / 3.0 * (2.0 * 2.0 + 2.0 * 1.0 + 1.0 * 1.0) * 4.0;
|
double volume = Math.PI / 3.0 * (2.0 * 2.0 + 2.0 * 1.0 + 1.0 * 1.0) * 4.0;
|
||||||
// plus aft shoulder:
|
// plus aft shoulder:
|
||||||
@ -224,7 +224,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -249,8 +249,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
// Volume of filled transition =
|
// Volume of filled transition =
|
||||||
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
||||||
@ -271,7 +271,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -302,8 +302,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
// Volume of filled transition =
|
// Volume of filled transition =
|
||||||
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
||||||
@ -329,7 +329,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -354,8 +354,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
// Volume of filled transition =
|
// Volume of filled transition =
|
||||||
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
||||||
@ -377,7 +377,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
@ -409,8 +409,8 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
Coordinate cg = nc.getCG();
|
Coordinate cg = nc.getCG();
|
||||||
|
|
||||||
System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
//System.out.println(nc.getComponentVolume() + "\t" + nc.getMass());
|
||||||
System.out.println(cg);
|
//System.out.println(cg);
|
||||||
|
|
||||||
// Volume of filled transition =
|
// Volume of filled transition =
|
||||||
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
double filledVolume = Math.PI / 3.0 * (1.0 * 1.0 + 1.0 * 0.5 + 0.5 * 0.5) * 1.0;
|
||||||
@ -438,7 +438,7 @@ public class SymmetricComponentVolumeTest extends BaseTestCase {
|
|||||||
|
|
||||||
double mass = density * volume;
|
double mass = density * volume;
|
||||||
|
|
||||||
System.out.println(volume);
|
//System.out.println(volume);
|
||||||
|
|
||||||
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
assertEquals(volume, nc.getComponentVolume(), epsilonPercent * volume);
|
||||||
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
assertEquals(mass, nc.getMass(), epsilonPercent * mass);
|
||||||
|
@ -17,7 +17,7 @@ public class TestExpressions extends BaseTestCase {
|
|||||||
//CustomExpression exp = new CustomExpression(doc, "Kinetic energy", "Ek", "J", ".5*m*Vt^2");
|
//CustomExpression exp = new CustomExpression(doc, "Kinetic energy", "Ek", "J", ".5*m*Vt^2");
|
||||||
|
|
||||||
CustomExpression exp = new CustomExpression(doc, "Average mass", "Mavg", "kg", "mean(m[0:t])");
|
CustomExpression exp = new CustomExpression(doc, "Average mass", "Mavg", "kg", "mean(m[0:t])");
|
||||||
System.out.println(exp.getExpressionString());
|
//System.out.println(exp.getExpressionString());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package net.sf.openrocket.util;
|
package net.sf.openrocket.util;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class Base64Test {
|
public class Base64Test {
|
||||||
@ -35,7 +35,6 @@ public class Base64Test {
|
|||||||
if (!Arrays.equals(array, decoded)) {
|
if (!Arrays.equals(array, decoded)) {
|
||||||
fail("Data differs! n=" + n);
|
fail("Data differs! n=" + n);
|
||||||
}
|
}
|
||||||
System.out.println("n="+n+" ok!");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.sf.openrocket.util;
|
package net.sf.openrocket.util;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -25,11 +26,11 @@ public class GeodeticComputationStrategyTest {
|
|||||||
WorldCoordinate wc = new WorldCoordinate(lat1, lon1, 0.0);
|
WorldCoordinate wc = new WorldCoordinate(lat1, lon1, 0.0);
|
||||||
wc = GeodeticComputationStrategy.SPHERICAL.addCoordinate(wc, coord);
|
wc = GeodeticComputationStrategy.SPHERICAL.addCoordinate(wc, coord);
|
||||||
|
|
||||||
System.out.println(wc.getLatitudeDeg());
|
//System.out.println(wc.getLatitudeDeg());
|
||||||
System.out.println(lat2);
|
//System.out.println(lat2);
|
||||||
|
|
||||||
System.out.println(wc.getLongitudeDeg());
|
//System.out.println(wc.getLongitudeDeg());
|
||||||
System.out.println(lon2);
|
//System.out.println(lon2);
|
||||||
|
|
||||||
assertEquals(lat2, wc.getLatitudeDeg(), 0.001);
|
assertEquals(lat2, wc.getLatitudeDeg(), 0.001);
|
||||||
assertEquals(lon2, wc.getLongitudeDeg(), 0.001);
|
assertEquals(lon2, wc.getLongitudeDeg(), 0.001);
|
||||||
@ -45,7 +46,7 @@ public class GeodeticComputationStrategyTest {
|
|||||||
|
|
||||||
|
|
||||||
// Test zero movement
|
// Test zero movement
|
||||||
System.out.println("\nTesting zero movement");
|
//System.out.println("\nTesting zero movement");
|
||||||
testAddCoordinate(50.0, 20.0, 0, 123, 50.0, 20.0, false);
|
testAddCoordinate(50.0, 20.0, 0, 123, 50.0, 20.0, false);
|
||||||
|
|
||||||
|
|
||||||
@ -56,27 +57,27 @@ public class GeodeticComputationStrategyTest {
|
|||||||
|
|
||||||
// Long distance NE over England, crosses Greenwich meridian
|
// Long distance NE over England, crosses Greenwich meridian
|
||||||
// 50 03N 005 42W to 58 38N 003 04E is 1109km at 027 16'07"
|
// 50 03N 005 42W to 58 38N 003 04E is 1109km at 027 16'07"
|
||||||
System.out.println("\nTesting 1109km NE over England");
|
//System.out.println("\nTesting 1109km NE over England");
|
||||||
testAddCoordinate(50 + 3 * min, -5 - 42 * min, 1109000, 27 + 16 * min + 7 * sec, 58 + 38 * min, 3 + 4 * min, false);
|
testAddCoordinate(50 + 3 * min, -5 - 42 * min, 1109000, 27 + 16 * min + 7 * sec, 58 + 38 * min, 3 + 4 * min, false);
|
||||||
|
|
||||||
// SW over Brazil
|
// SW over Brazil
|
||||||
// -10N -60E to -11N -61E is 155.9km at 224 25'34"
|
// -10N -60E to -11N -61E is 155.9km at 224 25'34"
|
||||||
System.out.println("\nTesting 155km SW over Brazil");
|
//System.out.println("\nTesting 155km SW over Brazil");
|
||||||
testAddCoordinate(-10, -60, 155900, 224 + 25 * min + 34 * sec, -11, -61, true);
|
testAddCoordinate(-10, -60, 155900, 224 + 25 * min + 34 * sec, -11, -61, true);
|
||||||
|
|
||||||
// NW over the 180 meridian
|
// NW over the 180 meridian
|
||||||
// 63N -179E to 63 01N 179E is 100.9km at 271 56'34"
|
// 63N -179E to 63 01N 179E is 100.9km at 271 56'34"
|
||||||
System.out.println("\nTesting 100km NW over 180 meridian");
|
//System.out.println("\nTesting 100km NW over 180 meridian");
|
||||||
testAddCoordinate(63, -179, 100900, 271 + 56 * min + 34 * sec, 63 + 1 * min, 179, true);
|
testAddCoordinate(63, -179, 100900, 271 + 56 * min + 34 * sec, 63 + 1 * min, 179, true);
|
||||||
|
|
||||||
// NE near the north pole
|
// NE near the north pole
|
||||||
// 89 50N 0E to 89 45N 175E is 46.29 km at 003 00'01"
|
// 89 50N 0E to 89 45N 175E is 46.29 km at 003 00'01"
|
||||||
System.out.println("\nTesting 46km NE near north pole");
|
//System.out.println("\nTesting 46km NE near north pole");
|
||||||
testAddCoordinate(89 + 50 * min, 0, 46290, 3 + 0 * min + 1 * sec, 89 + 45 * min, 175, false);
|
testAddCoordinate(89 + 50 * min, 0, 46290, 3 + 0 * min + 1 * sec, 89 + 45 * min, 175, false);
|
||||||
|
|
||||||
// S directly over south pole
|
// S directly over south pole
|
||||||
// -89 50N 12E to -89 45N 192E is 46.33km at 180 00'00"
|
// -89 50N 12E to -89 45N 192E is 46.33km at 180 00'00"
|
||||||
System.out.println("\nTesting 46km directly over south pole ");
|
//System.out.println("\nTesting 46km directly over south pole ");
|
||||||
testAddCoordinate(-89 - 50 * min, 12, 46330, 180, -89 - 45 * min, -168, false);
|
testAddCoordinate(-89 - 50 * min, 12, 46330, 180, -89 - 45 * min, -168, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -97,11 +98,11 @@ public class GeodeticComputationStrategyTest {
|
|||||||
|
|
||||||
// Test SPHERICAL
|
// Test SPHERICAL
|
||||||
tolerance = 0.0015 * distance / 111325;
|
tolerance = 0.0015 * distance / 111325;
|
||||||
System.out.println("\nSpherical tolerance: " + tolerance);
|
//System.out.println("\nSpherical tolerance: " + tolerance);
|
||||||
WorldCoordinate result = GeodeticComputationStrategy.SPHERICAL.addCoordinate(wc, coord);
|
WorldCoordinate result = GeodeticComputationStrategy.SPHERICAL.addCoordinate(wc, coord);
|
||||||
|
|
||||||
System.out.println("Difference Lat: " + Math.abs(finalLatitude - result.getLatitudeDeg()));
|
//System.out.println("Difference Lat: " + Math.abs(finalLatitude - result.getLatitudeDeg()));
|
||||||
System.out.println("Difference Lon: " + Math.abs(finalLongitude - result.getLongitudeDeg()));
|
//System.out.println("Difference Lon: " + Math.abs(finalLongitude - result.getLongitudeDeg()));
|
||||||
assertEquals(finalLatitude, result.getLatitudeDeg(), tolerance);
|
assertEquals(finalLatitude, result.getLatitudeDeg(), tolerance);
|
||||||
assertEquals(finalLongitude, result.getLongitudeDeg(), tolerance);
|
assertEquals(finalLongitude, result.getLongitudeDeg(), tolerance);
|
||||||
assertEquals(1000.0, result.getAltitude(), 0.0);
|
assertEquals(1000.0, result.getAltitude(), 0.0);
|
||||||
@ -115,11 +116,11 @@ public class GeodeticComputationStrategyTest {
|
|||||||
* the greatest.
|
* the greatest.
|
||||||
*/
|
*/
|
||||||
tolerance = 0.04 * distance / 111325;
|
tolerance = 0.04 * distance / 111325;
|
||||||
System.out.println("\nWGS84 tolerance: " + tolerance);
|
//System.out.println("\nWGS84 tolerance: " + tolerance);
|
||||||
result = GeodeticComputationStrategy.WGS84.addCoordinate(wc, coord);
|
result = GeodeticComputationStrategy.WGS84.addCoordinate(wc, coord);
|
||||||
|
|
||||||
System.out.println("Difference Lat: " + Math.abs(finalLatitude - result.getLatitudeDeg()));
|
//System.out.println("Difference Lat: " + Math.abs(finalLatitude - result.getLatitudeDeg()));
|
||||||
System.out.println("Difference Lon: " + Math.abs(finalLongitude - result.getLongitudeDeg()));
|
//System.out.println("Difference Lon: " + Math.abs(finalLongitude - result.getLongitudeDeg()));
|
||||||
assertEquals(finalLatitude, result.getLatitudeDeg(), tolerance);
|
assertEquals(finalLatitude, result.getLatitudeDeg(), tolerance);
|
||||||
assertEquals(finalLongitude, result.getLongitudeDeg(), tolerance);
|
assertEquals(finalLongitude, result.getLongitudeDeg(), tolerance);
|
||||||
assertEquals(1000.0, result.getAltitude(), 0.0);
|
assertEquals(1000.0, result.getAltitude(), 0.0);
|
||||||
@ -128,11 +129,11 @@ public class GeodeticComputationStrategyTest {
|
|||||||
// Test FLAT
|
// Test FLAT
|
||||||
if (testFlat) {
|
if (testFlat) {
|
||||||
tolerance = 0.02 * distance / 111325;
|
tolerance = 0.02 * distance / 111325;
|
||||||
System.out.println("\nFlat tolerance: " + tolerance);
|
//System.out.println("\nFlat tolerance: " + tolerance);
|
||||||
result = GeodeticComputationStrategy.FLAT.addCoordinate(wc, coord);
|
result = GeodeticComputationStrategy.FLAT.addCoordinate(wc, coord);
|
||||||
|
|
||||||
System.out.println("Difference Lat: " + Math.abs(finalLatitude - result.getLatitudeDeg()));
|
//System.out.println("Difference Lat: " + Math.abs(finalLatitude - result.getLatitudeDeg()));
|
||||||
System.out.println("Difference Lon: " + Math.abs(finalLongitude - result.getLongitudeDeg()));
|
//System.out.println("Difference Lon: " + Math.abs(finalLongitude - result.getLongitudeDeg()));
|
||||||
assertEquals(finalLatitude, result.getLatitudeDeg(), tolerance);
|
assertEquals(finalLatitude, result.getLatitudeDeg(), tolerance);
|
||||||
assertEquals(finalLongitude, result.getLongitudeDeg(), tolerance);
|
assertEquals(finalLongitude, result.getLongitudeDeg(), tolerance);
|
||||||
assertEquals(1000.0, result.getAltitude(), 0.0);
|
assertEquals(1000.0, result.getAltitude(), 0.0);
|
||||||
@ -150,7 +151,7 @@ public class GeodeticComputationStrategyTest {
|
|||||||
Coordinate velocity = new Coordinate(-1000, 0, 0);
|
Coordinate velocity = new Coordinate(-1000, 0, 0);
|
||||||
WorldCoordinate wc = new WorldCoordinate(45, 0, 0);
|
WorldCoordinate wc = new WorldCoordinate(45, 0, 0);
|
||||||
double north_accel = GeodeticComputationStrategy.SPHERICAL.getCoriolisAcceleration(wc, velocity).y;
|
double north_accel = GeodeticComputationStrategy.SPHERICAL.getCoriolisAcceleration(wc, velocity).y;
|
||||||
System.out.println("North accel " + north_accel);
|
//System.out.println("North accel " + north_accel);
|
||||||
assertTrue(north_accel < 0.0);
|
assertTrue(north_accel < 0.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.sf.openrocket.util;
|
package net.sf.openrocket.util;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class QuaternionTest {
|
public class QuaternionTest {
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public class QuaternionTest {
|
|||||||
|
|
||||||
Coordinate r = q.rotate(c);
|
Coordinate r = q.rotate(c);
|
||||||
|
|
||||||
System.out.println("Rotated: " + q.rotate(c));
|
//System.out.println("Rotated: " + q.rotate(c));
|
||||||
|
|
||||||
assertEquals(-42312599.537, r.x, 0.001);
|
assertEquals(-42312599.537, r.x, 0.001);
|
||||||
assertEquals(-48162747.551, r.y, 0.001);
|
assertEquals(-48162747.551, r.y, 0.001);
|
||||||
@ -33,9 +34,9 @@ public class QuaternionTest {
|
|||||||
c = new Coordinate(0, 1, 0);
|
c = new Coordinate(0, 1, 0);
|
||||||
Coordinate rot = new Coordinate(Math.PI / 4, 0, 0);
|
Coordinate rot = new Coordinate(Math.PI / 4, 0, 0);
|
||||||
|
|
||||||
System.out.println("Before: "+c);
|
//System.out.println("Before: "+c);
|
||||||
c = Quaternion.rotation(rot).invRotate(c);
|
c = Quaternion.rotation(rot).invRotate(c);
|
||||||
System.out.println("After: "+c);
|
//System.out.println("After: "+c);
|
||||||
|
|
||||||
assertEquals(0.0, c.x, 0.001);
|
assertEquals(0.0, c.x, 0.001);
|
||||||
assertEquals(0.707, c.y, 0.001);
|
assertEquals(0.707, c.y, 0.001);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user