Beispiel #1
0
TEST_F(RangeTests, NormalizeWild_Border) {
  const Range a(-kPi, kPi);
  const Range zero_one(0.0f, 1.0f);
  EXPECT_EQ(kPi, a.NormalizeWildValue(-kPi));
  EXPECT_EQ(kPi, a.NormalizeWildValue(kPi));
  EXPECT_EQ(1.0f, zero_one.NormalizeWildValue(0.0f));
  EXPECT_EQ(1.0f, zero_one.NormalizeWildValue(1.0f));
}
Beispiel #2
0
TEST_F(RangeTests, NormalizeWild_Distant) {
  const Range a(-kPi, kPi);
  const Range zero_one(0.0f, 1.0f);
  EXPECT_NEAR(0.0f, a.NormalizeWildValue(-10.0f * kPi), kAngleEpsilon);
  EXPECT_NEAR(1.0f, a.NormalizeWildValue(100.0f * kPi + 1.0f), kAngleEpsilon);
  EXPECT_NEAR(0.7f, zero_one.NormalizeWildValue(-19.3f), kZeroOneEpsilon);
  EXPECT_NEAR(0.5f, zero_one.NormalizeWildValue(10.5f), kZeroOneEpsilon);
}
Beispiel #3
0
TEST_F(RangeTests, NormalizeWild_Inside) {
  const Range a(-kPi, kPi);
  const Range zero_one(0.0f, 1.0f);
  EXPECT_EQ(0.0f, a.NormalizeWildValue(0.0f));
  EXPECT_NEAR(kPi - 0.1f, a.NormalizeWildValue(kPi - 0.1f), kAngleEpsilon);
  EXPECT_EQ(1.0f, zero_one.NormalizeWildValue(1.0f));
  EXPECT_EQ(0.5f, zero_one.NormalizeWildValue(0.5f));
}