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

Side by Side Diff: native_client_sdk/src/libraries/nacl_mounts_test/mount_test.cc

Issue 12166002: Cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 5
6 #include <errno.h> 6 #include <errno.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <string.h> 8 #include <string.h>
9 #include <string> 9 #include <string>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
11 11
12 #include "nacl_mounts/mount.h" 12 #include "nacl_mounts/mount.h"
13 #include "nacl_mounts/mount_dev.h" 13 #include "nacl_mounts/mount_dev.h"
14 #include "nacl_mounts/mount_mem.h" 14 #include "nacl_mounts/mount_mem.h"
15 #include "nacl_mounts/osdirent.h" 15 #include "nacl_mounts/osdirent.h"
16 16
17 #include "gtest/gtest.h" 17 #include "gtest/gtest.h"
18 18
19 namespace { 19 namespace {
20 20
21 class MountMemMock : public MountMem { 21 class MountMemMock : public MountMem {
22 public: 22 public:
23 MountMemMock() { 23 MountMemMock() {
24 StringMap_t map; 24 StringMap_t map;
25 Init(1, map, NULL); 25 Init(1, map, NULL);
26 }; 26 };
27
28 int num_nodes() {
29 return (int) inode_pool_.size();
30 }
27 }; 31 };
28 32
29 class MountDevMock : public MountDev { 33 class MountDevMock : public MountDev {
30 public: 34 public:
31 MountDevMock() { 35 MountDevMock() {
32 StringMap_t map; 36 StringMap_t map;
33 Init(1, map, NULL); 37 Init(1, map, NULL);
34 } 38 }
39 int num_nodes() {
40 return (int) inode_pool_.size();
41 }
35 }; 42 };
36 43
37 } // namespace 44 } // namespace
38 45
39 46
40 #define NULL_NODE ((MountNode *) NULL) 47 #define NULL_NODE ((MountNode *) NULL)
41 48
42 TEST(MountTest, Sanity) { 49 TEST(MountTest, Sanity) {
43 MountMemMock* mnt = new MountMemMock(); 50 MountMemMock* mnt = new MountMemMock();
44 MountNode* file; 51 MountNode* file;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 double expected_count = kTotalSamples / 256.; 218 double expected_count = kTotalSamples / 256.;
212 double chi_squared = 0; 219 double chi_squared = 0;
213 for (int i = 0; i < 256; ++i) { 220 for (int i = 0; i < 256; ++i) {
214 double difference = byte_count[i] - expected_count; 221 double difference = byte_count[i] - expected_count;
215 chi_squared += difference * difference / expected_count; 222 chi_squared += difference * difference / expected_count;
216 } 223 }
217 224
218 // Approximate chi-squared value for p-value 0.05, 255 degrees-of-freedom. 225 // Approximate chi-squared value for p-value 0.05, 255 degrees-of-freedom.
219 EXPECT_LE(chi_squared, 293.24); 226 EXPECT_LE(chi_squared, 293.24);
220 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698