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

Side by Side Diff: webrtc/base/random_unittest.cc

Issue 2358993004: Enable the -Wundef warning for clang (Closed)
Patch Set: rebase Created 4 years, 2 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/base/proxydetect.cc ('k') | webrtc/base/rate_limiter_unittest.cc » ('j') | 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
11 #include <math.h> 11 #include <math.h>
12 12
13 #include <limits> 13 #include <limits>
14 #include <vector> 14 #include <vector>
15 15
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "webrtc/test/gtest.h"
17 #include "webrtc/base/mathutils.h" // unsigned difference 17 #include "webrtc/base/mathutils.h" // unsigned difference
18 #include "webrtc/base/random.h" 18 #include "webrtc/base/random.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 namespace { 22 namespace {
23 // Computes the positive remainder of x/n. 23 // Computes the positive remainder of x/n.
24 template <typename T> 24 template <typename T>
25 T fdiv_remainder(T x, T n) { 25 T fdiv_remainder(T x, T n) {
26 RTC_CHECK_GE(n, static_cast<T>(0)); 26 RTC_CHECK_GE(n, static_cast<T>(0));
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 double f_mid = kScale * exp((n - kMean) * (n - kMean) / kDiv); 300 double f_mid = kScale * exp((n - kMean) * (n - kMean) / kDiv);
301 double f_right = kScale * exp((n - kMean + 0.5) * (n - kMean + 0.5) / kDiv); 301 double f_right = kScale * exp((n - kMean + 0.5) * (n - kMean + 0.5) / kDiv);
302 double normal_dist = (f_left + 4 * f_mid + f_right) / 6; 302 double normal_dist = (f_left + 4 * f_mid + f_right) / 6;
303 // Expect the number of samples to be within 3 standard deviations 303 // Expect the number of samples to be within 3 standard deviations
304 // (rounded up) of the expected number of samples in the bucket. 304 // (rounded up) of the expected number of samples in the bucket.
305 EXPECT_NEAR(buckets[n], kN * normal_dist, 3 * sqrt(kN * normal_dist) + 1); 305 EXPECT_NEAR(buckets[n], kN * normal_dist, 3 * sqrt(kN * normal_dist) + 1);
306 } 306 }
307 } 307 }
308 308
309 } // namespace webrtc 309 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/proxydetect.cc ('k') | webrtc/base/rate_limiter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698