From 544d876e36b2a9cc2bdef4369283f86f5a2d1df5 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 12 May 2023 11:09:16 +0200 Subject: [PATCH 1/4] Cleaned up output --- .../java/org/ode4j/ode/internal/DLCP.java | 13 ++++--- .../ode4j/ode/internal/OdeFactoryImpl.java | 3 +- .../main/java/org/ode4j/democpp/DemoI.java | 2 +- .../main/java/org/ode4j/democpp/DemoOde.java | 2 +- .../main/java/org/ode4j/democpp/DemoStep.java | 2 +- .../org/ode4j/tests/libccd/TestBoxBox.java | 4 +-- .../org/ode4j/tests/libccd/TestCylCyl.java | 2 +- .../org/ode4j/tests/libccd/TestMPRBoxBox.java | 4 +-- .../org/ode4j/tests/libccd/TestMPRCylCyl.java | 2 +- .../org/ode4j/tests/libccd/TestPolytope.java | 35 ++++++++++++------- demo/src/main/java/org/ode4j/demo/DemoI.java | 2 +- .../src/main/java/org/ode4j/demo/DemoOde.java | 2 +- .../main/java/org/ode4j/demo/DemoStep.java | 2 +- .../org/ode4j/tests/DemoCollisionTest.java | 23 +++++++++--- .../java/org/ode4j/tests/DemoOdeTest.java | 9 +---- .../org/ode4j/tests/SpacePerformanceTest.java | 4 +-- 16 files changed, 65 insertions(+), 46 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/DLCP.java b/core/src/main/java/org/ode4j/ode/internal/DLCP.java index c66c52ea..b5db6a6c 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DLCP.java +++ b/core/src/main/java/org/ode4j/ode/internal/DLCP.java @@ -1381,9 +1381,8 @@ static int EstimateTestSolveLCPMemoryReq(int n) return -1; } - //TODO API? //extern "C" ODE_API - public static int dTestSolveLCP() + public static int dTestSolveLCP(boolean print) { final int n = 100; @@ -1409,7 +1408,9 @@ public static int dTestSolveLCP() } else { tol = 1e-4f; } - System.out.println ("dTestSolveLCP()"); + if (print) { + System.out.println("dTestSolveLCP()"); + } // double[] A = new double[n*nskip];//ALLOCA (dReal,A,n*nskip*sizeof(dReal)); // double[] x = new double[n];//ALLOCA (dReal,x,n*sizeof(dReal)); @@ -1540,8 +1541,10 @@ else if (xi >= lo[i] && xi <= hi[i] && wi == 0) { } // pacifier - printf ("passed: NL=%3d NH=%3d C=%3d ",n1,n2,n3); - printf ("time=%10.3f ms avg=%10.4f\n",time * 1000.0,average); + if (print) { + printf("passed: NL=%3d NH=%3d C=%3d ", n1, n2, n3); + printf("time=%10.3f ms avg=%10.4f\n", time * 1000.0, average); + } } arena.END_STATE_SAVE(saveInner); } diff --git a/core/src/main/java/org/ode4j/ode/internal/OdeFactoryImpl.java b/core/src/main/java/org/ode4j/ode/internal/OdeFactoryImpl.java index 82a6ca18..f814f771 100644 --- a/core/src/main/java/org/ode4j/ode/internal/OdeFactoryImpl.java +++ b/core/src/main/java/org/ode4j/ode/internal/OdeFactoryImpl.java @@ -252,8 +252,7 @@ public void dTestDataStructures() for (i=0; i 0) { double failure_ratio = (double) failcount / (double) total_reps; - System.out.printf("FAILED (%.2f%%) at line %s\n", failure_ratio * 100.0, last_failed_line); + if (PRINT) { + System.out.printf("FAILED (%.2f%%) at line %s\n", failure_ratio * 100.0, last_failed_line); + } assertTrue(failure_ratio < max_failure_ratio); } else { - System.out.println("ok"); + if (PRINT) { + System.out.println("ok"); + } } } diff --git a/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java b/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java index 6bab0369..9a66e59c 100644 --- a/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java +++ b/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java @@ -473,13 +473,6 @@ public void testCholeskySolveM3() { @Test public void testInvertPDMatrix() { - for (int i = 0; i < 100; ++i) { - testInvertPDMatrix2(); - } - } - - - void testInvertPDMatrix2() { int i, j, ok; int matrixSize = MSIZE4 * MSIZE; double[] A = new double[matrixSize], Ainv = new double[matrixSize]; @@ -1355,7 +1348,7 @@ public static void afterClass() { @Test public void testSolveDLCP() { - DLCP.dTestSolveLCP(); + DLCP.dTestSolveLCP(false); } @Test diff --git a/demo/src/test/java/org/ode4j/tests/SpacePerformanceTest.java b/demo/src/test/java/org/ode4j/tests/SpacePerformanceTest.java index 8f52cb48..d390630b 100644 --- a/demo/src/test/java/org/ode4j/tests/SpacePerformanceTest.java +++ b/demo/src/test/java/org/ode4j/tests/SpacePerformanceTest.java @@ -49,7 +49,7 @@ private void test_performance_with_dynamic_world(int iterations, int staticGeoms private void test_performance_with_dynamic_world(DSpace space, int iterations, int passiveGeomNum, int geomNum) { spaceCollisions = 0; geomCollisions = 0; - System.out.println("==== " + space.getClass().getSimpleName()); + System.out.printf(" %-16s ", space.getClass().getSimpleName()); DGeom[] passiveGeoms = new DGeom[passiveGeomNum]; Random r = new Random(123); for (int i = 0; i < passiveGeomNum; i++) { @@ -141,7 +141,7 @@ private void test_performance_with_static_world(int iterations, int staticGeoms, private void test_performance_with_static_world(DSpace space, int iterations, int passiveGeomNum, int geomNum) { spaceCollisions = 0; geomCollisions = 0; - System.out.println("==== " + space.getClass().getSimpleName()); + System.out.printf(" %-16s ", space.getClass().getSimpleName()); DGeom[] passiveGeoms = new DGeom[passiveGeomNum]; Random r = new Random(123); for (int i = 0; i < passiveGeomNum; i++) { From 91e5de8b8ee5f38bbb9ee02cf6dd8208c822b07e Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 12 May 2023 11:12:26 +0200 Subject: [PATCH 2/4] Cleaned up output --- demo-cpp/src/main/java/org/ode4j/democpp/DemoStep.java | 2 +- demo/src/main/java/org/ode4j/demo/DemoStep.java | 2 +- demo/src/test/java/org/ode4j/tests/DemoOdeTest.java | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/demo-cpp/src/main/java/org/ode4j/democpp/DemoStep.java b/demo-cpp/src/main/java/org/ode4j/democpp/DemoStep.java index 14a1fa92..ad01c71a 100644 --- a/demo-cpp/src/main/java/org/ode4j/democpp/DemoStep.java +++ b/demo-cpp/src/main/java/org/ode4j/democpp/DemoStep.java @@ -69,7 +69,7 @@ * version, for various systems. currently you have to define COMPARE_METHODS * in step.cpp for this to work properly. * - * @@@ report MAX error + * report MAX error */ class DemoStep extends dsFunctions { diff --git a/demo/src/main/java/org/ode4j/demo/DemoStep.java b/demo/src/main/java/org/ode4j/demo/DemoStep.java index fe838dc1..2c6d96be 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoStep.java +++ b/demo/src/main/java/org/ode4j/demo/DemoStep.java @@ -43,7 +43,7 @@ * version, for various systems. currently you have to define COMPARE_METHODS * in step.cpp for this to work properly. * - * @@@ report MAX error + * report MAX error */ class DemoStep extends dsFunctions { diff --git a/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java b/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java index 9a66e59c..7476ff48 100644 --- a/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java +++ b/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java @@ -38,7 +38,6 @@ import org.ode4j.ode.internal.OdeFactoryImpl; import java.util.ArrayList; -import java.util.Arrays; import static org.junit.Assert.*; From 4b39c0f050503ff4021d1d015c1c29f111b4a957 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 12 May 2023 11:37:37 +0200 Subject: [PATCH 3/4] Cleaned up output --- .../org/ode4j/tests/PRGetInfo1_Fixture_2.java | 13 +++++---- .../bugs/Test_Bug0019_OdeRayToCylinder.java | 2 +- .../java/org/ode4j/tests/DemoJointsTest.java | 27 ++++++++++++++----- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/demo-cpp/src/test/java/org/ode4j/tests/PRGetInfo1_Fixture_2.java b/demo-cpp/src/test/java/org/ode4j/tests/PRGetInfo1_Fixture_2.java index 5665f5ab..811b241f 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/PRGetInfo1_Fixture_2.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/PRGetInfo1_Fixture_2.java @@ -224,11 +224,11 @@ public static void DESTRUCTOR() { dJointSetPRParam(jId, dParamVel, (7.0) ); CHECK_EQUAL((7.0), joint.limotP.vel); + // TODO ? TZ: Probably not, //#ifdef D_PARAM_NAMES.dParamFudgeFactor1 // if (D_PARAM_NAMES.dParamFudgeFactor1) { - System.err.println("FIXME: test_SetPRParam()"); - //TODO dJointSetPRParam(jId, D_PARAM_NAMES.dParamFudgeFactor1, (5.5) ); - //TODO CHECK_EQUAL((5.5), joint.limotP.get(D_PARAM_NAMES.dParamFudgeFactor)); + // dJointSetPRParam(jId, D_PARAM_NAMES.dParamFudgeFactor1, (5.5) ); + // CHECK_EQUAL((5.5), joint.limotP.get(D_PARAM_NAMES.dParamFudgeFactor)); // } //#endif //TZ unnecessary dJointSetPRParam(jId, dParamCFM2, (9.0) ); @@ -251,11 +251,10 @@ public static void DESTRUCTOR() { dJointGetPRParam(jId, dParamVel) ); //#ifdef D_PARAM_NAMES.dParamFudgeFactor1 //TZ unnecessary - System.err.println("FIXME: test_GetPRParam()"); - //TODO joint.limotP.set(D_PARAM_NAMES.dParamFudgeFactor, 5.5) ;//) = (5.5); + // joint.limotP.set(D_PARAM_NAMES.dParamFudgeFactor, 5.5) ;//) = (5.5); - //TODO CHECK_EQUAL(joint.limotP.get(D_PARAM_NAMES.dParamFudgeFactor), - //TODO dJointGetPRParam(jId, D_PARAM_NAMES.dParamFudgeFactor1) ); + // CHECK_EQUAL(joint.limotP.get(D_PARAM_NAMES.dParamFudgeFactor), + // dJointGetPRParam(jId, D_PARAM_NAMES.dParamFudgeFactor1) ); //#endif joint.limotR.normal_cfm = (9.0); diff --git a/demo-cpp/src/test/java/org/ode4j/tests/bugs/Test_Bug0019_OdeRayToCylinder.java b/demo-cpp/src/test/java/org/ode4j/tests/bugs/Test_Bug0019_OdeRayToCylinder.java index 07482aa5..076f731c 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/bugs/Test_Bug0019_OdeRayToCylinder.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/bugs/Test_Bug0019_OdeRayToCylinder.java @@ -79,7 +79,7 @@ public void call(Object data, DGeom o1, DGeom o2) { } DContact contact = contacts.get(0); - System.out.println(contact.geom.normal); + // System.out.println(contact.geom.normal); assertTrue(Math.abs(contact.geom.normal.get0()) < 0.01); assertTrue(Math.abs(contact.geom.normal.get1()) < 0.01); assertTrue(Math.abs(contact.geom.normal.get2()) > 0.99); diff --git a/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java b/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java index 709924f8..bff808a6 100644 --- a/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java +++ b/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java @@ -59,6 +59,8 @@ //@RunWith(Parameterized.class) public class DemoJointsTest { + private static final boolean PRINT = false; + //// some constants //#define NUM_JOINTS 10 // number of joints to test (the `xx' value) //#define SIDE (0.5f) // side length of a box - don't change this @@ -136,6 +138,18 @@ private double cmpIdentity(final DMatrix3C A) { return dMaxDifference(A, I); } + private static void print(String s) { + if (PRINT) { + System.out.print(s); + } + } + + private static void println(String s) { + if (PRINT) { + System.out.println(s); + } + } + //**************************************************************************** // test world construction and utilities private void constructWorldForTest(double gravity, int bodycount, @@ -1042,12 +1056,13 @@ private void doTest(int n) { S = null; // print results - System.out.print("test " + n + ": "); - if (max_error == dInfinity) System.out.println("error not computed"); - else { - System.out.print("max scaled error = " + max_error); - if (max_error < 1) System.out.println(" - passed"); - else System.out.println(" - FAILED\n"); + print("test " + n + ": "); + if (max_error == dInfinity) { + println("error not computed"); + } else { + print("max scaled error = " + max_error); + if (max_error < 1) println(" - passed"); + else println(" - FAILED\n"); Assert.assertTrue(max_error < 1); } } From ef4dd2a91ddfa3dac2d6113aad9dae111d3bb073 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 12 May 2023 11:40:00 +0200 Subject: [PATCH 4/4] Cleaned up output --- CHANGELOG.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a172ec06..25ed438a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -12,7 +12,9 @@ TODO for 0.5.0 - [WARNING] bootstrap class path not set in conjunction with -source 8 when using: mvn clean install -P on-jdk-9-plus - CI: Fail build on warning?! -- CI: remove "temurin"...?! +- What is the deal with DJoint PARAM vs PARAM_N? + ODE doesn´t have PARAM_N (e.g. dParamBounce1)! -> ode4j shouldn´;t have them either... + Remove (deprecate) and replace with PARAM, or at least document what is goigh on! --> See TODO.txt @@ -22,6 +24,7 @@ Check: 0.5.0 (unreleased) ===== +- Cleaned up unit test output. [#102](https://github.com/tzaeschke/ode4j/pull/102) - Fix maven warnings of type "Use Import/Export Package directive -split-package [...]" [#101](https://github.com/tzaeschke/ode4j/pull/101) - Port updates until 0.16.3. [#100](https://github.com/tzaeschke/ode4j/pull/100)