| OLD | NEW |
| 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_io/mount.h" |
| 13 #include "nacl_mounts/mount_dev.h" | 13 #include "nacl_io/mount_dev.h" |
| 14 #include "nacl_mounts/mount_mem.h" | 14 #include "nacl_io/mount_mem.h" |
| 15 #include "nacl_mounts/osdirent.h" | 15 #include "nacl_io/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); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 double expected_count = kTotalSamples / 256.; | 218 double expected_count = kTotalSamples / 256.; |
| 219 double chi_squared = 0; | 219 double chi_squared = 0; |
| 220 for (int i = 0; i < 256; ++i) { | 220 for (int i = 0; i < 256; ++i) { |
| 221 double difference = byte_count[i] - expected_count; | 221 double difference = byte_count[i] - expected_count; |
| 222 chi_squared += difference * difference / expected_count; | 222 chi_squared += difference * difference / expected_count; |
| 223 } | 223 } |
| 224 | 224 |
| 225 // 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. |
| 226 EXPECT_LE(chi_squared, 293.24); | 226 EXPECT_LE(chi_squared, 293.24); |
| 227 } | 227 } |
| OLD | NEW |