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

Side by Side Diff: webrtc/modules/audio_processing/intelligibility/intelligibility_utils_unittest.cc

Issue 1242943008: Remove C++11 calls from intelligibility_utils (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed merge conflict Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 // Tests UpdateFactor. 42 // Tests UpdateFactor.
43 TEST(IntelligibilityUtilsTest, TestUpdateFactor) { 43 TEST(IntelligibilityUtilsTest, TestUpdateFactor) {
44 EXPECT_EQ(0, intelligibility::UpdateFactor(0, 0, 0)); 44 EXPECT_EQ(0, intelligibility::UpdateFactor(0, 0, 0));
45 EXPECT_EQ(4, intelligibility::UpdateFactor(4, 2, 3)); 45 EXPECT_EQ(4, intelligibility::UpdateFactor(4, 2, 3));
46 EXPECT_EQ(3, intelligibility::UpdateFactor(4, 2, 1)); 46 EXPECT_EQ(3, intelligibility::UpdateFactor(4, 2, 1));
47 EXPECT_EQ(2, intelligibility::UpdateFactor(2, 4, 3)); 47 EXPECT_EQ(2, intelligibility::UpdateFactor(2, 4, 3));
48 EXPECT_EQ(3, intelligibility::UpdateFactor(2, 4, 1)); 48 EXPECT_EQ(3, intelligibility::UpdateFactor(2, 4, 1));
49 } 49 }
50 50
51 // Tests cplxfinite, cplxnormal, and zerofudge. 51 // Tests zerofudge.
52 TEST(IntelligibilityUtilsTest, TestCplx) { 52 TEST(IntelligibilityUtilsTest, TestCplx) {
53 complex<float> t0(1.f, 0.f); 53 complex<float> t0(1.f, 0.f);
54 EXPECT_TRUE(intelligibility::cplxfinite(t0));
55 EXPECT_FALSE(intelligibility::cplxnormal(t0));
56 t0 = intelligibility::zerofudge(t0); 54 t0 = intelligibility::zerofudge(t0);
57 EXPECT_NE(t0.imag(), 0.f); 55 EXPECT_NE(t0.imag(), 0.f);
58 EXPECT_NE(t0.real(), 0.f); 56 EXPECT_NE(t0.real(), 0.f);
59 const complex<float> t1(1.f, std::sqrt(-1.f));
60 EXPECT_FALSE(intelligibility::cplxfinite(t1));
61 EXPECT_FALSE(intelligibility::cplxnormal(t1));
62 const complex<float> t2(1.f, 1.f);
63 EXPECT_TRUE(intelligibility::cplxfinite(t2));
64 EXPECT_TRUE(intelligibility::cplxnormal(t2));
65 } 57 }
66 58
67 // Tests NewMean and AddToMean. 59 // Tests NewMean and AddToMean.
68 TEST(IntelligibilityUtilsTest, TestMeanUpdate) { 60 TEST(IntelligibilityUtilsTest, TestMeanUpdate) {
69 const complex<float> data[] = {{3, 8}, {7, 6}, {2, 1}, {8, 9}, {0, 6}}; 61 const complex<float> data[] = {{3, 8}, {7, 6}, {2, 1}, {8, 9}, {0, 6}};
70 const complex<float> means[] = {{3, 8}, {5, 7}, {4, 5}, {5, 6}, {4, 6}}; 62 const complex<float> means[] = {{3, 8}, {5, 7}, {4, 5}, {5, 6}, {4, 6}};
71 complex<float> mean(3, 8); 63 complex<float> mean(3, 8);
72 for (size_t i = 0; i < arraysize(data); i++) { 64 for (size_t i = 0; i < arraysize(data); i++) {
73 EXPECT_EQ(means[i], NewMean(mean, data[i], i + 1)); 65 EXPECT_EQ(means[i], NewMean(mean, data[i], i + 1));
74 AddToMean(data[i], i + 1, &mean); 66 AddToMean(data[i], i + 1, &mean);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 EXPECT_LT(out_data[i][j].real(), 1.0f); 171 EXPECT_LT(out_data[i][j].real(), 1.0f);
180 EXPECT_GT(out_data[i][j].imag(), 0.0f); 172 EXPECT_GT(out_data[i][j].imag(), 0.0f);
181 EXPECT_LT(out_data[i][j].imag(), 1.0f); 173 EXPECT_LT(out_data[i][j].imag(), 1.0f);
182 } 174 }
183 } 175 }
184 } 176 }
185 177
186 } // namespace intelligibility 178 } // namespace intelligibility
187 179
188 } // namespace webrtc 180 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698