MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TestCeilOfRatio

Function TestCeilOfRatio

tensorflow/core/lib/math/math_util_test.cc:34–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template <typename IntegralType, typename TestDataType>
34void TestCeilOfRatio(const TestDataType test_data[][kNumTestArguments],
35 int num_tests) {
36 for (int i = 0; i < num_tests; ++i) {
37 const IntegralType numerator = test_data[i][0];
38 const IntegralType denominator = test_data[i][1];
39 const IntegralType expected_floor = test_data[i][2];
40 const IntegralType expected_ceil = test_data[i][3];
41 // Make sure the two ways to compute the floor return the same thing.
42 IntegralType floor_1 = MathUtil::FloorOfRatio(numerator, denominator);
43 IntegralType floor_2 = MathUtil::CeilOrFloorOfRatio<IntegralType, false>(
44 numerator, denominator);
45 EXPECT_EQ(floor_1, floor_2);
46 EXPECT_EQ(expected_floor, floor_1)
47 << "FloorOfRatio fails with numerator = " << numerator
48 << ", denominator = " << denominator << " "
49 << (8 * sizeof(IntegralType)) << " bits";
50 IntegralType ceil_1 = MathUtil::CeilOfRatio(numerator, denominator);
51 IntegralType ceil_2 = MathUtil::CeilOrFloorOfRatio<IntegralType, true>(
52 numerator, denominator);
53 EXPECT_EQ(ceil_1, ceil_2);
54 EXPECT_EQ(expected_ceil, ceil_1)
55 << "CeilOfRatio fails with numerator = " << numerator
56 << ", denominator = " << denominator << " "
57 << (8 * sizeof(IntegralType)) << " bits";
58 }
59}
60
61template <typename UnsignedIntegralType>
62void TestCeilOfRatioUnsigned(uint64 kMax) {

Callers

nothing calls this directly

Calls 2

FloorOfRatioFunction · 0.85
CeilOfRatioFunction · 0.50

Tested by

no test coverage detected