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

Side by Side Diff: remoting/base/running_average_unittest.cc

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 4 years, 12 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 | « remoting/base/running_average.h ('k') | remoting/base/scoped_sc_handle_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h>
6 #include <stdint.h>
7
8 #include "base/macros.h"
5 #include "remoting/base/running_average.h" 9 #include "remoting/base/running_average.h"
6 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
7 11
8 namespace remoting { 12 namespace remoting {
9 13
10 static const int64 kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 }; 14 static const int64_t kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 };
11 15
12 // Average across a single element, i.e. just return the most recent. 16 // Average across a single element, i.e. just return the most recent.
13 TEST(RunningAverageTest, OneElementWindow) { 17 TEST(RunningAverageTest, OneElementWindow) {
14 RunningAverage running_average(1); 18 RunningAverage running_average(1);
15 EXPECT_EQ(0, running_average.Average()); 19 EXPECT_EQ(0, running_average.Average());
16 20
17 for (size_t i = 0; i < arraysize(kTestValues); ++i) { 21 for (size_t i = 0; i < arraysize(kTestValues); ++i) {
18 running_average.Record(kTestValues[i]); 22 running_average.Record(kTestValues[i]);
19 EXPECT_EQ(static_cast<double>(kTestValues[i]), running_average.Average()); 23 EXPECT_EQ(static_cast<double>(kTestValues[i]), running_average.Average());
20 } 24 }
(...skipping 26 matching lines...) Expand all
47 double expected = 0.0; 51 double expected = 0.0;
48 for (size_t j = 0; j <= i; ++j) 52 for (size_t j = 0; j <= i; ++j)
49 expected += kTestValues[j]; 53 expected += kTestValues[j];
50 expected /= i + 1; 54 expected /= i + 1;
51 55
52 EXPECT_EQ(expected, running_average.Average()); 56 EXPECT_EQ(expected, running_average.Average());
53 } 57 }
54 } 58 }
55 59
56 } // namespace remoting 60 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/running_average.h ('k') | remoting/base/scoped_sc_handle_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698