Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: webrtc/common_audio/signal_processing/signal_processing_unittest.cc

Issue 1305983003: Convert some more things to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Support Android's C89 mode Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/common_audio/signal_processing/signal_processing_unittest.cc
diff --git a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
index a593c4d5bce6d304efded19a00b1fd2addf111d5..108f459c894898e837dec760dd9f634601c08fa4 100644
--- a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
+++ b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
@@ -221,36 +221,6 @@ TEST_F(SplTest, BasicArrayOperationsTest) {
}
}
-TEST_F(SplTest, ExeptionsHandlingMinMaxOperationsTest) {
- // Test how the functions handle exceptional cases.
- const size_t kVectorSize = 2;
- int16_t vector16[kVectorSize] = {0};
- int32_t vector32[kVectorSize] = {0};
-
- EXPECT_EQ(-1, WebRtcSpl_MaxAbsValueW16(vector16, 0));
- EXPECT_EQ(-1, WebRtcSpl_MaxAbsValueW16(NULL, kVectorSize));
- EXPECT_EQ(WEBRTC_SPL_WORD16_MIN, WebRtcSpl_MaxValueW16(vector16, 0));
- EXPECT_EQ(WEBRTC_SPL_WORD16_MIN, WebRtcSpl_MaxValueW16(NULL, kVectorSize));
- EXPECT_EQ(WEBRTC_SPL_WORD16_MAX, WebRtcSpl_MinValueW16(vector16, 0));
- EXPECT_EQ(WEBRTC_SPL_WORD16_MAX, WebRtcSpl_MinValueW16(NULL, kVectorSize));
- EXPECT_EQ(-1, WebRtcSpl_MaxAbsValueW32(vector32, 0));
- EXPECT_EQ(-1, WebRtcSpl_MaxAbsValueW32(NULL, kVectorSize));
- EXPECT_EQ(WEBRTC_SPL_WORD32_MIN, WebRtcSpl_MaxValueW32(vector32, 0));
- EXPECT_EQ(WEBRTC_SPL_WORD32_MIN, WebRtcSpl_MaxValueW32(NULL, kVectorSize));
- EXPECT_EQ(WEBRTC_SPL_WORD32_MAX, WebRtcSpl_MinValueW32(vector32, 0));
- EXPECT_EQ(WEBRTC_SPL_WORD32_MAX, WebRtcSpl_MinValueW32(NULL, kVectorSize));
- EXPECT_EQ(-1, WebRtcSpl_MaxAbsIndexW16(vector16, 0));
- EXPECT_EQ(-1, WebRtcSpl_MaxAbsIndexW16(NULL, kVectorSize));
- EXPECT_EQ(-1, WebRtcSpl_MaxIndexW16(vector16, 0));
- EXPECT_EQ(-1, WebRtcSpl_MaxIndexW16(NULL, kVectorSize));
- EXPECT_EQ(-1, WebRtcSpl_MaxIndexW32(vector32, 0));
- EXPECT_EQ(-1, WebRtcSpl_MaxIndexW32(NULL, kVectorSize));
- EXPECT_EQ(-1, WebRtcSpl_MinIndexW16(vector16, 0));
- EXPECT_EQ(-1, WebRtcSpl_MinIndexW16(NULL, kVectorSize));
- EXPECT_EQ(-1, WebRtcSpl_MinIndexW32(vector32, 0));
- EXPECT_EQ(-1, WebRtcSpl_MinIndexW32(NULL, kVectorSize));
-}
-
TEST_F(SplTest, MinMaxOperationsTest) {
const size_t kVectorSize = 17;
@@ -267,10 +237,8 @@ TEST_F(SplTest, MinMaxOperationsTest) {
WebRtcSpl_MinValueW16(vector16, kVectorSize));
EXPECT_EQ(WEBRTC_SPL_WORD32_MIN,
WebRtcSpl_MinValueW32(vector32, kVectorSize));
- EXPECT_EQ(static_cast<int>(kVectorSize - 1),
- WebRtcSpl_MinIndexW16(vector16, kVectorSize));
- EXPECT_EQ(static_cast<int>(kVectorSize - 1),
- WebRtcSpl_MinIndexW32(vector32, kVectorSize));
+ EXPECT_EQ(kVectorSize - 1, WebRtcSpl_MinIndexW16(vector16, kVectorSize));
+ EXPECT_EQ(kVectorSize - 1, WebRtcSpl_MinIndexW32(vector32, kVectorSize));
// Test the cases where maximum values have to be caught
// outside of the unrolled loops in ARM-Neon.
@@ -285,12 +253,9 @@ TEST_F(SplTest, MinMaxOperationsTest) {
WebRtcSpl_MaxAbsValueW32(vector32, kVectorSize));
EXPECT_EQ(WEBRTC_SPL_WORD32_MAX,
WebRtcSpl_MaxValueW32(vector32, kVectorSize));
- EXPECT_EQ(static_cast<int>(kVectorSize - 1),
- WebRtcSpl_MaxAbsIndexW16(vector16, kVectorSize));
- EXPECT_EQ(static_cast<int>(kVectorSize - 1),
- WebRtcSpl_MaxIndexW16(vector16, kVectorSize));
- EXPECT_EQ(static_cast<int>(kVectorSize - 1),
- WebRtcSpl_MaxIndexW32(vector32, kVectorSize));
+ EXPECT_EQ(kVectorSize - 1, WebRtcSpl_MaxAbsIndexW16(vector16, kVectorSize));
+ EXPECT_EQ(kVectorSize - 1, WebRtcSpl_MaxIndexW16(vector16, kVectorSize));
+ EXPECT_EQ(kVectorSize - 1, WebRtcSpl_MaxIndexW32(vector32, kVectorSize));
// Test the cases where multiple maximum and minimum values are present.
vector16[1] = WEBRTC_SPL_WORD16_MAX;
@@ -312,11 +277,11 @@ TEST_F(SplTest, MinMaxOperationsTest) {
WebRtcSpl_MaxValueW32(vector32, kVectorSize));
EXPECT_EQ(WEBRTC_SPL_WORD32_MIN,
WebRtcSpl_MinValueW32(vector32, kVectorSize));
- EXPECT_EQ(6, WebRtcSpl_MaxAbsIndexW16(vector16, kVectorSize));
- EXPECT_EQ(1, WebRtcSpl_MaxIndexW16(vector16, kVectorSize));
- EXPECT_EQ(1, WebRtcSpl_MaxIndexW32(vector32, kVectorSize));
- EXPECT_EQ(6, WebRtcSpl_MinIndexW16(vector16, kVectorSize));
- EXPECT_EQ(6, WebRtcSpl_MinIndexW32(vector32, kVectorSize));
+ EXPECT_EQ(6u, WebRtcSpl_MaxAbsIndexW16(vector16, kVectorSize));
+ EXPECT_EQ(1u, WebRtcSpl_MaxIndexW16(vector16, kVectorSize));
+ EXPECT_EQ(1u, WebRtcSpl_MaxIndexW32(vector32, kVectorSize));
+ EXPECT_EQ(6u, WebRtcSpl_MinIndexW16(vector16, kVectorSize));
+ EXPECT_EQ(6u, WebRtcSpl_MinIndexW32(vector32, kVectorSize));
}
TEST_F(SplTest, VectorOperationsTest) {
@@ -500,9 +465,7 @@ TEST_F(SplTest, AutoCorrelationTest) {
const int32_t expected[kVector16Size] = {302681398, 14223410, -121705063,
-85221647, -17104971, 61806945, 6644603, -669329, 43};
- EXPECT_EQ(-1, WebRtcSpl_AutoCorrelation(vector16, kVector16Size,
- kVector16Size + 1, vector32, &scale));
- EXPECT_EQ(static_cast<int>(kVector16Size),
+ EXPECT_EQ(kVector16Size,
WebRtcSpl_AutoCorrelation(vector16, kVector16Size,
kVector16Size - 1, vector32, &scale));
EXPECT_EQ(3, scale);

Powered by Google App Engine
This is Rietveld 408576698