19 #include "gtest/gtest.h" 25 TEST(FixedRatioSamplerTest, AlwaysTrue) {
26 FixedRatioSampler fixed_ratio_sampler(1.);
27 for (
int i = 0; i < 100; ++i) {
28 EXPECT_TRUE(fixed_ratio_sampler.Pulse());
32 TEST(FixedRatioSamplerTest, AlwaysFalse) {
33 FixedRatioSampler fixed_ratio_sampler(0.);
34 for (
int i = 0; i < 100; ++i) {
35 EXPECT_FALSE(fixed_ratio_sampler.Pulse());
39 TEST(FixedRatioSamplerTest, NonSensicalRatio) {
40 EXPECT_DEATH(FixedRatioSampler(2.),
"ratio");
41 EXPECT_DEATH(FixedRatioSampler(-0.1),
"ratio");
44 TEST(FixedRatioSamplerTest, SometimesTrue) {
45 FixedRatioSampler fixed_ratio_sampler(0.5);
46 for (
int i = 0; i < 100; ++i) {
47 EXPECT_EQ(i % 2 == 0, fixed_ratio_sampler.Pulse());
51 TEST(FixedRatioSamplerTest, FirstPulseIsTrue) {
53 FixedRatioSampler fixed_ratio_sampler(1e-20);
54 EXPECT_TRUE(fixed_ratio_sampler.Pulse());
55 for (
int i = 0; i < 100; ++i) {
56 EXPECT_FALSE(fixed_ratio_sampler.Pulse());
TEST(TrajectoryConnectivityStateTest, UnknownTrajectory)