fix tests

release/4.3a0
Varun Agrawal 2020-11-30 17:51:50 -05:00
parent 799788672f
commit 7391c103ec
2 changed files with 6 additions and 9 deletions

View File

@ -343,8 +343,9 @@ static double Kappa(const BinaryMeasurement<T> &measurement) {
const auto &robust = boost::dynamic_pointer_cast<noiseModel::Robust>( const auto &robust = boost::dynamic_pointer_cast<noiseModel::Robust>(
measurement.noiseModel()); measurement.noiseModel());
if (robust) { if (robust) {
throw std::runtime_error( std::cout << "Verification of optimality does not work with robust cost "
"Verification of optimality does not work with robust cost function"); "function"
<< std::endl;
} else { } else {
throw std::invalid_argument( throw std::invalid_argument(
"Shonan averaging noise models must be isotropic (but robust losses " "Shonan averaging noise models must be isotropic (but robust losses "

View File

@ -66,8 +66,10 @@ TEST(BinaryMeasurement, Rot3) {
/* ************************************************************************* */ /* ************************************************************************* */
TEST(BinaryMeasurement, Rot3MakeRobust) { TEST(BinaryMeasurement, Rot3MakeRobust) {
auto huber_model = noiseModel::Robust::Create(
noiseModel::mEstimator::Huber::Create(1.345), rot3_model);
BinaryMeasurement<Rot3> rot3Measurement(kKey1, kKey2, rot3Measured, BinaryMeasurement<Rot3> rot3Measurement(kKey1, kKey2, rot3Measured,
rot3_model, true); huber_model);
EXPECT_LONGS_EQUAL(rot3Measurement.key1(), kKey1); EXPECT_LONGS_EQUAL(rot3Measurement.key1(), kKey1);
EXPECT_LONGS_EQUAL(rot3Measurement.key2(), kKey2); EXPECT_LONGS_EQUAL(rot3Measurement.key2(), kKey2);
@ -75,12 +77,6 @@ TEST(BinaryMeasurement, Rot3MakeRobust) {
const auto &robust = boost::dynamic_pointer_cast<noiseModel::Robust>( const auto &robust = boost::dynamic_pointer_cast<noiseModel::Robust>(
rot3Measurement.noiseModel()); rot3Measurement.noiseModel());
EXPECT(robust); EXPECT(robust);
// test that if we call it again nothing changes:
rot3Measurement = BinaryMeasurement<Rot3>(rot3Measurement, true);
const auto &robust2 = boost::dynamic_pointer_cast<noiseModel::Robust>(
rot3Measurement.noiseModel());
EXPECT(robust2);
} }
/* ************************************************************************* */ /* ************************************************************************* */