| 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 <sys/stat.h> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <sys/stat.h> | |
| 11 | 11 |
| 12 #include "gtest/gtest.h" |
| 12 #include "nacl_io/mount.h" | 13 #include "nacl_io/mount.h" |
| 13 #include "nacl_io/mount_dev.h" | 14 #include "nacl_io/mount_dev.h" |
| 14 #include "nacl_io/mount_mem.h" | 15 #include "nacl_io/mount_mem.h" |
| 15 #include "nacl_io/osdirent.h" | 16 #include "nacl_io/osdirent.h" |
| 16 | 17 #include "nacl_io/osunistd.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 EXPECT_EQ(0, Init(1, map, NULL)); | 25 EXPECT_EQ(0, Init(1, map, NULL)); |
| 26 } | 26 } |
| 27 | 27 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 double expected_count = kTotalSamples / 256.; | 262 double expected_count = kTotalSamples / 256.; |
| 263 double chi_squared = 0; | 263 double chi_squared = 0; |
| 264 for (int i = 0; i < 256; ++i) { | 264 for (int i = 0; i < 256; ++i) { |
| 265 double difference = byte_count[i] - expected_count; | 265 double difference = byte_count[i] - expected_count; |
| 266 chi_squared += difference * difference / expected_count; | 266 chi_squared += difference * difference / expected_count; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Approximate chi-squared value for p-value 0.05, 255 degrees-of-freedom. | 269 // Approximate chi-squared value for p-value 0.05, 255 degrees-of-freedom. |
| 270 EXPECT_LE(chi_squared, 293.24); | 270 EXPECT_LE(chi_squared, 293.24); |
| 271 } | 271 } |
| OLD | NEW |