Skip to content

Commit

Permalink
Merge 44e8d87 into c754e21
Browse files Browse the repository at this point in the history
  • Loading branch information
ahcorde authored Oct 26, 2022
2 parents c754e21 + 44e8d87 commit a3e3c05
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Noise_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include <ignition/common/Console.hh>
#include <ignition/math/Rand.hh>

#include <sdf/Noise.hh>


#include "ignition/sensors/Noise.hh"
#include "ignition/sensors/GaussianNoiseModel.hh"

Expand Down Expand Up @@ -414,6 +417,31 @@ TEST(NoiseTest, OnApplyNoise)
}
}

/////////////////////////////////////////////////
TEST(NoiseTest, NoiseFailures)
{
sensors::Noise noise(sensors::NoiseType::CUSTOM);

EXPECT_DOUBLE_EQ(9, noise.Apply(9, 0.1));
EXPECT_DOUBLE_EQ(9, noise.ApplyImpl(9, 0.1));
std::ostringstream out;
noise.Print(out);
EXPECT_EQ("Noise with type[1] does not have an overloaded Print function. "
"No more information is available.", out.str());

sensors::Noise noiseGaussian(sensors::NoiseType::GAUSSIAN);

sensors::NoisePtr noiseFactory =
sensors::NoiseFactory::NewNoiseModel(
NoiseSdf("gaussian", 0, 0, 0, 0, 0), "camera");

sdf::Noise sdfNoise;
sdfNoise.SetType(static_cast<sdf::NoiseType>(99));
sensors::NoisePtr noiseFactory2 =
sensors::NoiseFactory::NewNoiseModel(
sdfNoise, "camera");
}

/////////////////////////////////////////////////
int main(int argc, char **argv)
{
Expand Down

0 comments on commit a3e3c05

Please sign in to comment.