aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff McGlynn <jwmcglynn@google.com>2018-08-16 17:03:50 -0700
committerJeff McGlynn <jwmcglynn@google.com>2018-08-16 17:03:50 -0700
commit0e8de98a60e70bc2598f14df89ca1a2f5f0f0f1d (patch)
treeebf4d7242c397d31aafae6f4b1d991a2918caa2b
parent692fbf5865f2f5c470651aa0f56e491bbc7fffae (diff)
downloadastc-codec-0e8de98a60e70bc2598f14df89ca1a2f5f0f0f1d.tar.gz
Revert "Disable problematic test that trips ASAN"
This reverts commit 692fbf5865f2f5c470651aa0f56e491bbc7fffae. The fix has been prepared and will be uploaded alongside this revert.
-rw-r--r--src/decoder/test/integer_sequence_codec_test.cc105
1 files changed, 52 insertions, 53 deletions
diff --git a/src/decoder/test/integer_sequence_codec_test.cc b/src/decoder/test/integer_sequence_codec_test.cc
index 8c376ab..b66ff2b 100644
--- a/src/decoder/test/integer_sequence_codec_test.cc
+++ b/src/decoder/test/integer_sequence_codec_test.cc
@@ -31,59 +31,58 @@ namespace {
// Make sure that the counts returned for a specific range match what's
// expected. In particular, make sure that it fits with Table C.2.7
-// Disabled. bug: 112691516
-// TEST(ASTCIntegerSequenceCodecTest, TestGetCountsForRange) {
-// std::array<int, 3> kExpectedCounts[31] = {
-// {{ 0, 0, 1 }}, // 1
-// {{ 1, 0, 0 }}, // 2
-// {{ 0, 0, 2 }}, // 3
-// {{ 0, 1, 0 }}, // 4
-// {{ 1, 0, 1 }}, // 5
-// {{ 0, 0, 3 }}, // 6
-// {{ 0, 0, 3 }}, // 7
-// {{ 0, 1, 1 }}, // 8
-// {{ 0, 1, 1 }}, // 9
-// {{ 1, 0, 2 }}, // 10
-// {{ 1, 0, 2 }}, // 11
-// {{ 0, 0, 4 }}, // 12
-// {{ 0, 0, 4 }}, // 13
-// {{ 0, 0, 4 }}, // 14
-// {{ 0, 0, 4 }}, // 15
-// {{ 0, 1, 2 }}, // 16
-// {{ 0, 1, 2 }}, // 17
-// {{ 0, 1, 2 }}, // 18
-// {{ 0, 1, 2 }}, // 19
-// {{ 1, 0, 3 }}, // 20
-// {{ 1, 0, 3 }}, // 21
-// {{ 1, 0, 3 }}, // 22
-// {{ 1, 0, 3 }}, // 23
-// {{ 0, 0, 5 }}, // 24
-// {{ 0, 0, 5 }}, // 25
-// {{ 0, 0, 5 }}, // 26
-// {{ 0, 0, 5 }}, // 27
-// {{ 0, 0, 5 }}, // 28
-// {{ 0, 0, 5 }}, // 29
-// {{ 0, 0, 5 }}, // 30
-// {{ 0, 0, 5 }}, // 31
-// };
-//
-// int t, q, b;
-// for (int i = 1; i < 32; ++i) {
-// IntegerSequenceCodec::GetCountsForRange(i, &t, &q, &b);
-// EXPECT_EQ(t, kExpectedCounts[i - 1][0]);
-// EXPECT_EQ(q, kExpectedCounts[i - 1][1]);
-// EXPECT_EQ(b, kExpectedCounts[i - 1][2]);
-// }
-//
-// ASSERT_DEBUG_DEATH(IntegerSequenceCodec::GetCountsForRange(0, &t, &q, &b), "");
-// ASSERT_DEBUG_DEATH(
-// IntegerSequenceCodec::GetCountsForRange(256, &t, &q, &b), "");
-//
-// IntegerSequenceCodec::GetCountsForRange(1, &t, &q, &b);
-// EXPECT_EQ(t, 0);
-// EXPECT_EQ(q, 0);
-// EXPECT_EQ(b, 1);
-// }
+TEST(ASTCIntegerSequenceCodecTest, TestGetCountsForRange) {
+ std::array<int, 3> kExpectedCounts[31] = {
+ {{ 0, 0, 1 }}, // 1
+ {{ 1, 0, 0 }}, // 2
+ {{ 0, 0, 2 }}, // 3
+ {{ 0, 1, 0 }}, // 4
+ {{ 1, 0, 1 }}, // 5
+ {{ 0, 0, 3 }}, // 6
+ {{ 0, 0, 3 }}, // 7
+ {{ 0, 1, 1 }}, // 8
+ {{ 0, 1, 1 }}, // 9
+ {{ 1, 0, 2 }}, // 10
+ {{ 1, 0, 2 }}, // 11
+ {{ 0, 0, 4 }}, // 12
+ {{ 0, 0, 4 }}, // 13
+ {{ 0, 0, 4 }}, // 14
+ {{ 0, 0, 4 }}, // 15
+ {{ 0, 1, 2 }}, // 16
+ {{ 0, 1, 2 }}, // 17
+ {{ 0, 1, 2 }}, // 18
+ {{ 0, 1, 2 }}, // 19
+ {{ 1, 0, 3 }}, // 20
+ {{ 1, 0, 3 }}, // 21
+ {{ 1, 0, 3 }}, // 22
+ {{ 1, 0, 3 }}, // 23
+ {{ 0, 0, 5 }}, // 24
+ {{ 0, 0, 5 }}, // 25
+ {{ 0, 0, 5 }}, // 26
+ {{ 0, 0, 5 }}, // 27
+ {{ 0, 0, 5 }}, // 28
+ {{ 0, 0, 5 }}, // 29
+ {{ 0, 0, 5 }}, // 30
+ {{ 0, 0, 5 }}, // 31
+ };
+
+ int t, q, b;
+ for (int i = 1; i < 32; ++i) {
+ IntegerSequenceCodec::GetCountsForRange(i, &t, &q, &b);
+ EXPECT_EQ(t, kExpectedCounts[i - 1][0]);
+ EXPECT_EQ(q, kExpectedCounts[i - 1][1]);
+ EXPECT_EQ(b, kExpectedCounts[i - 1][2]);
+ }
+
+ ASSERT_DEBUG_DEATH(IntegerSequenceCodec::GetCountsForRange(0, &t, &q, &b), "");
+ ASSERT_DEBUG_DEATH(
+ IntegerSequenceCodec::GetCountsForRange(256, &t, &q, &b), "");
+
+ IntegerSequenceCodec::GetCountsForRange(1, &t, &q, &b);
+ EXPECT_EQ(t, 0);
+ EXPECT_EQ(q, 0);
+ EXPECT_EQ(b, 1);
+}
// Test to make sure that we're calculating the number of bits needed to
// encode a given number of values based on the range of the values.