Skip to content

Commit

Permalink
add hash tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-urban committed Dec 8, 2023
1 parent a98d08e commit 11c6a9f
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/tests/geoprocessing/backtracers/btconstantsvp.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ TEST_CASE("BTConstantSVP should support common functions", TESTTAG)
REQUIRE_THAT(ypr[0], Catch::Matchers::WithinAbs(0.f, 0.0001));
REQUIRE_THAT(ypr[1], Catch::Matchers::WithinAbs(location.pitch, 0.0001));
REQUIRE_THAT(ypr[2], Catch::Matchers::WithinAbs(location.roll, 0.0001));

// test hash
REQUIRE(backtracer.binary_hash() == 3830516406371434649);
REQUIRE(backtracer.binary_hash() == BTConstantSVP(backtracer).binary_hash());
REQUIRE(backtracer.binary_hash() ==
BTConstantSVP(backtracer.from_binary(backtracer.to_binary())).binary_hash());
}

TEST_CASE("BTConstantSVP reproduce some pre computed results (single points)", TESTTAG)
Expand Down
6 changes: 6 additions & 0 deletions src/tests/geoprocessing/backtracers/i_backtracer.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ TEST_CASE("I_Backtracer should support common functions", TESTTAG)
REQUIRE_THAT(ypr[0], Catch::Matchers::WithinAbs(0.f, 0.0001));
REQUIRE_THAT(ypr[1], Catch::Matchers::WithinAbs(location.pitch, 0.0001));
REQUIRE_THAT(ypr[2], Catch::Matchers::WithinAbs(location.roll, 0.0001));

// test hash
REQUIRE(backtracer.binary_hash() == 11759859546874707158ull);
REQUIRE(backtracer.binary_hash() == I_Backtracer(backtracer).binary_hash());
REQUIRE(backtracer.binary_hash() ==
I_Backtracer(backtracer.from_binary(backtracer.to_binary())).binary_hash());
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ TEST_CASE("BeamSampleParameters should support common functions", TESTTAG)

// test print does not crash
REQUIRE(param.info_string().size() != 0);

// test hash
REQUIRE(param.binary_hash() == 4652324683533098954);
REQUIRE(param.binary_hash() == BeamSampleParameters(param).binary_hash());
REQUIRE(param.binary_hash() ==
BeamSampleParameters(param.from_binary(param.to_binary())).binary_hash());
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ TEST_CASE("RaytraceResult should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 5760038646027523138);
REQUIRE(location.binary_hash() == RaytraceResult(location).binary_hash());
REQUIRE(location.binary_hash() ==
RaytraceResult(location.from_binary(location.to_binary())).binary_hash());
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,10 @@ TEST_CASE("RaytraceResults should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 4496877549998357265);
REQUIRE(location.binary_hash() == RaytraceResults(location).binary_hash());
REQUIRE(location.binary_hash() ==
RaytraceResults(location.from_binary(location.to_binary())).binary_hash());
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ TEST_CASE("SampleDirections should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 7946198183670543780);
REQUIRE(location.binary_hash() == SampleDirections(location).binary_hash());
REQUIRE(location.binary_hash() ==
SampleDirections(location.from_binary(location.to_binary())).binary_hash());
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ TEST_CASE("SampleDirectionsRange should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 15106317722440586394);
REQUIRE(location.binary_hash() == SampleDirectionsRange(location).binary_hash());
REQUIRE(location.binary_hash() ==
SampleDirectionsRange(location.from_binary(location.to_binary())).binary_hash());
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ TEST_CASE("SampleDirectionsTime should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 15106317722440586394);
REQUIRE(location.binary_hash() == SampleDirectionsTime(location).binary_hash());
REQUIRE(location.binary_hash() ==
SampleDirectionsTime(location.from_binary(location.to_binary())).binary_hash());
}
6 changes: 6 additions & 0 deletions src/tests/geoprocessing/datastructures/sampleindices.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ TEST_CASE("SampleIndices should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 545582192469170180);
REQUIRE(location.binary_hash() == SampleIndices(location).binary_hash());
REQUIRE(location.binary_hash() ==
SampleIndices(location.from_binary(location.to_binary())).binary_hash());
}
6 changes: 6 additions & 0 deletions src/tests/geoprocessing/datastructures/xyz.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ TEST_CASE("XYZ should support common functions", TESTTAG)

// test print does not crash
REQUIRE(location.info_string().size() != 0);

// test hash
REQUIRE(location.binary_hash() == 1848392524124629315);
REQUIRE(location.binary_hash() == XYZ(location).binary_hash());
REQUIRE(location.binary_hash() ==
XYZ(location.from_binary(location.to_binary())).binary_hash());
}
8 changes: 7 additions & 1 deletion src/tests/geoprocessing/raytracers/i_raytracer.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ TEST_CASE("I_Raytracer should support common functions", TESTTAG)

auto ypr = raytracer.get_sensor_orientation_quat_ypr();

//REQUIRE_THAT(ypr[0], Catch::Matchers::WithinAbs(location.yaw, 0.0001));
// REQUIRE_THAT(ypr[0], Catch::Matchers::WithinAbs(location.yaw, 0.0001));
REQUIRE_THAT(ypr[0], Catch::Matchers::WithinAbs(0.f, 0.0001));
REQUIRE_THAT(ypr[1], Catch::Matchers::WithinAbs(location.pitch, 0.0001));
REQUIRE_THAT(ypr[2], Catch::Matchers::WithinAbs(location.roll, 0.0001));

// test hash
REQUIRE(raytracer.binary_hash() == 17645473512760939812);
REQUIRE(raytracer.binary_hash() == I_Raytracer(raytracer).binary_hash());
REQUIRE(raytracer.binary_hash() ==
I_Raytracer(raytracer.from_binary(raytracer.to_binary())).binary_hash());
}
6 changes: 6 additions & 0 deletions src/tests/geoprocessing/raytracers/rtconstantsvp.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ TEST_CASE("RTConstantSVP should support common functions", TESTTAG)
REQUIRE_THAT(ypr[2], Catch::Matchers::WithinAbs(location.roll, 0.0001));

REQUIRE_THAT(raytracer.get_sound_velocity(), Catch::Matchers::WithinAbs(c, 0.0001));

// test hash
REQUIRE(raytracer.binary_hash() == 16667922773826043259);
REQUIRE(raytracer.binary_hash() == RTConstantSVP(raytracer).binary_hash());
REQUIRE(raytracer.binary_hash() ==
RTConstantSVP(raytracer.from_binary(raytracer.to_binary())).binary_hash());
}

TEST_CASE("RTConstantSVP reproduce some pre computed results (single points)", TESTTAG)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: dbf0076cc41e11d5cb58f2334f0b5ee2b2704a680af85c68bb7952cad111d86e
//sourcehash: 58d3441fb8ebf674aba5746105458f87b5941ce1a5043d63191931d71e501c0f

/*
This file contains docstrings for use in the Python bindings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: eadffc59f2b84922204021d6f5bef71316a067e42e884367467852ada75bb0ac
//sourcehash: f152bb1dc010635984d5e650b6ced86c981b3d64f3a06a29323d040b696a52ca

/*
This file contains docstrings for use in the Python bindings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: 5a68f451b97699dda1d8e75f89b4e0792a2f981ceb1db885779cef4cd84c0afb
//sourcehash: 5aa3d0c68c65bf2187663bb7840992c2c25b306e58910d096bd09e0a0987cb7f

/*
This file contains docstrings for use in the Python bindings.
Expand Down

0 comments on commit 11c6a9f

Please sign in to comment.