devonmpowell / r3d

Fast, robust polyhedral intersections, analytic integration, and conservative voxelization.
37 stars 19 forks source link

Tests give 1 warning #1

Closed certik closed 8 years ago

certik commented 8 years ago

I compiled the latest version (070b3b46f38a7fecc6272184bfdda65856fcd71f) and ran 3D tests. They give 1 warning:

certik@redhawk:~/repos/r3d/tests(test)$ ./r3d_unit_tests 
===========================
Running 9 unit tests...
===========================
split_tet_thru_centroid
[ PASS - 0.0 ms ]
---------------------------
split_nonconvex
[ PASS - 0.0 ms ]
---------------------------
recursive_splitting_nondegenerate
Recursively splitting 10 tetrahedra, maximum splits per tet is 16.
[ PASS - 40.0 ms ]
---------------------------
recursive_splitting_degenerate
Recursively splitting 10 tetrahedra, maximum splits per tet is 16.
[ PASS - 70.0 ms ]
---------------------------
recursive_splitting_degenerate_perturbed
Recursively splitting 10 tetrahedra, maximum splits per tet is 16.
EXPECT_EQ( -4.081e-12 , -4.081e-12 , 1.000e-08 ) failed ( err = 1.532e-07 ):
  r3d_unit_tests.c, line 484.
[ WARN - 50.0 ms ]
---------------------------
tet_tet_timing
Intersecting 100000 pairs of tetrahedra.
[ PASS - 420.0 ms ]
---------------------------
torus_load_and_chop
[ PASS - 10.0 ms ]
---------------------------
moments
Computing moments of order 20, 1000 trials.
[ PASS - 700.0 ms ]
---------------------------
voxelization
Voxelizing a tetrahedron to a grid with dx = 0.043478 0.043478 0.043478 and moments of order 4
Minimum index box = 1 4 2 to 23 16 19
[ PASS - 0.0 ms ]
---------------------------
...done.
8 x [ PASS ]
1 x [ WARN ]
0 x [ FAIL ]
===========================

But if I run it again, the warning sometimes disappears.

certik commented 8 years ago

And the 2d tests give 2 warnings:

certik@redhawk:~/repos/r3d/tests(test)$ ./r2d_unit_tests 
===========================
Running 8 unit tests...
===========================
split_tri_thru_centroid
[ PASS - 0.0 ms ]
---------------------------
recursive_splitting_nondegenerate
Recursively splitting 100 triangles, maximum splits per tri is 16.
EXPECT_EQ( -8.333e-16 , -8.333e-16 , 1.000e-08 ) failed ( err = 2.184e-08 ):
  r2d_unit_tests.c, line 156.
[ WARN - 370.0 ms ]
---------------------------
recursive_splitting_degenerate
Recursively splitting 100 triangles, maximum splits per tri is 16.
[ PASS - 50.0 ms ]
---------------------------
recursive_splitting_degenerate_perturbed
Recursively splitting 100 triangles, maximum splits per tri is 16.
EXPECT_EQ( -4.628e-10 , -4.628e-10 , 1.000e-08 ) failed ( err = 1.591e-08 ):
  r2d_unit_tests.c, line 365.
EXPECT_EQ( 8.609e-10 , 8.609e-10 , 1.000e-08 ) failed ( err = 1.020e-08 ):
  r2d_unit_tests.c, line 365.
EXPECT_EQ( 1.325e-09 , 1.325e-09 , 1.000e-08 ) failed ( err = 1.095e-08 ):
  r2d_unit_tests.c, line 365.
EXPECT_EQ( 6.271e-09 , 6.271e-09 , 1.000e-08 ) failed ( err = 1.114e-08 ):
  r2d_unit_tests.c, line 365.
EXPECT_EQ( 3.843e-09 , 3.843e-09 , 1.000e-08 ) failed ( err = 1.131e-08 ):
  r2d_unit_tests.c, line 365.
EXPECT_EQ( 6.271e-09 , 6.271e-09 , 1.000e-08 ) failed ( err = 1.033e-08 ):
  r2d_unit_tests.c, line 365.
[ WARN - 60.0 ms ]
---------------------------
test_tri_tri_timing
Intersecting 100000 pairs of triangles.
[ PASS - 200.0 ms ]
---------------------------
random_verts
[ PASS - 10.0 ms ]
---------------------------
rasterization
Rasterizing a triangle to a grid with dx = 0.058824 0.058824 and moments of order 3
Minimum index box = 4 0 to 15 16
[ PASS - 0.0 ms ]
---------------------------
moments
[ PASS - 0.0 ms ]
---------------------------
...done.
6 x [ PASS ]
2 x [ WARN ]
0 x [ FAIL ]
===========================
certik commented 8 years ago

Finally the N unit tests also give a warning:

certik@redhawk:~/repos/r3d/tests(test)$ ./rNd_unit_tests 
===========================
Running 3 unit tests...
===========================
split_simplex_thru_centroid
[ PASS - 10.0 ms ]
---------------------------
recursive_splitting_nondegenerate
Recursively splitting 10 simplices, maximum splits per simplex is 6.
EXPECT_EQ( 2.356e-07 , 2.356e-07 , 1.000e-08 ) failed ( err = 1.648e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 1.621e-08 , 1.621e-08 , 1.000e-08 ) failed ( err = 3.674e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 6.651e-08 , 6.651e-08 , 1.000e-08 ) failed ( err = 2.786e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 1.119e-07 , 1.119e-07 , 1.000e-08 ) failed ( err = 2.339e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 2.154e-07 , 2.154e-07 , 1.000e-08 ) failed ( err = 1.201e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 5.689e-08 , 5.689e-08 , 1.000e-08 ) failed ( err = 2.748e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 7.743e-08 , 7.743e-08 , 1.000e-08 ) failed ( err = 1.029e-08 ):
  rNd_unit_tests.c, line 200.
^[[BEXPECT_EQ( 5.853e-08 , 5.853e-08 , 1.000e-08 ) failed ( err = 1.978e-08 ):
  rNd_unit_tests.c, line 200.
EXPECT_EQ( 3.593e-08 , 3.593e-08 , 1.000e-08 ) failed ( err = 4.504e-08 ):
  rNd_unit_tests.c, line 200.
[ WARN - 40090.0 ms ]
---------------------------
moments
Computing moments of order 0, 1000 trials.
[ PASS - 1070.0 ms ]
---------------------------
...done.
2 x [ PASS ]
1 x [ WARN ]
0 x [ FAIL ]
===========================
devonmpowell commented 8 years ago

Don't worry about the warnings here -- All warnings and failures are done via an error tolerance, and the error tolerance for a warning is set to 1.0e-8 here. You'll notice that nothing really failed here - the errors in e.g. EXPECT_EQ( -8.333e-16 , -8.333e-16 , 1.000e-08 ) failed ( err = 2.184e-08 ) are still quite small. You can increase this tolerance if the warning messages bother you by modifying TOL_WARN in rXd_unit_tests.c. The warnings disappearing are because the input for the unit tests are generated randomly. If you want something deterministic, add srand(12345) or whatever at the beginning of the function setup() in rXd_unit_tests.c.