예제 #1
0
TEST_F(RangeTests, Normalize_Inside) {
  const Range a(-kPi, kPi);
  EXPECT_EQ(0.0f, a.Normalize(0.0f));
  EXPECT_EQ(1.0f, a.Normalize(1.0f));
  EXPECT_EQ(-1.0f, a.Normalize(-1.0f));
  EXPECT_EQ(2.1f, a.Normalize(2.1f));
}
예제 #2
0
TEST_F(RangeTests, Normalize_Above) {
  const Range a(-kPi, kPi);
  const Range zero_one(0.0f, 1.0f);
  EXPECT_EQ(0.0f, a.Normalize(2.0f * kPi));
  EXPECT_NEAR(-kPi + 1.0f, a.Normalize(kPi + 1.0f), kAngleEpsilon);
  EXPECT_NEAR(0.9f, zero_one.Normalize(1.9f), kZeroOneEpsilon);
  EXPECT_NEAR(0.5f, zero_one.Normalize(1.5f), kZeroOneEpsilon);
}
예제 #3
0
TEST_F(RangeTests, Normalize_Below) {
  const Range a(-kPi, kPi);
  const Range zero_one(0.0f, 1.0f);
  EXPECT_EQ(0.0f, a.Normalize(-2.0f * kPi));
  EXPECT_NEAR(kPi - 1.0f, a.Normalize(-kPi - 1.0f), kAngleEpsilon);
  EXPECT_NEAR(0.1f, zero_one.Normalize(-0.9f), kZeroOneEpsilon);
  EXPECT_NEAR(0.5f, zero_one.Normalize(-0.5f), kZeroOneEpsilon);
}
예제 #4
0
TEST_F(RangeTests, Normalize_UpperBoundary) {
  const Range a(-kPi, kPi);
  const Range zero_one(0.0f, 1.0f);
  EXPECT_EQ(kPi, a.Normalize(kPi));
  EXPECT_EQ(1.0f, zero_one.Normalize(1.0f));
}