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

Side by Side Diff: native_client_sdk/src/tests/nacl_io_test/filesystem_test.cc

Issue 269593011: [NaCl SDK] Modifying size_t and int to off_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Place __STDC_FORMAT_MACROS inside conditional block Created 6 years, 7 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
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 <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 } // namespace 34 } // namespace
35 35
36 TEST(FilesystemTest, Sanity) { 36 TEST(FilesystemTest, Sanity) {
37 MemFsForTesting fs; 37 MemFsForTesting fs;
38 38
39 ScopedNode file; 39 ScopedNode file;
40 ScopedNode root; 40 ScopedNode root;
41 ScopedNode result_node; 41 ScopedNode result_node;
42 42
43 size_t result_size = 0; 43 off_t result_size = 0;
44 int result_bytes = 0; 44 int result_bytes = 0;
45 char buf1[1024]; 45 char buf1[1024];
46 46
47 // A memory filesystem starts with one directory node: the root. 47 // A memory filesystem starts with one directory node: the root.
48 EXPECT_EQ(1, fs.num_nodes()); 48 EXPECT_EQ(1, fs.num_nodes());
49 49
50 // Fail to open non existent file 50 // Fail to open non existent file
51 EXPECT_EQ(ENOENT, fs.Access(Path("/foo"), R_OK | W_OK)); 51 EXPECT_EQ(ENOENT, fs.Access(Path("/foo"), R_OK | W_OK));
52 EXPECT_EQ(ENOENT, fs.Open(Path("/foo"), O_RDWR, &result_node)); 52 EXPECT_EQ(ENOENT, fs.Open(Path("/foo"), O_RDWR, &result_node));
53 EXPECT_EQ(NULL, result_node.get()); 53 EXPECT_EQ(NULL, result_node.get());
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 double expected_count = kTotalSamples / 256.; 380 double expected_count = kTotalSamples / 256.;
381 double chi_squared = 0; 381 double chi_squared = 0;
382 for (int i = 0; i < 256; ++i) { 382 for (int i = 0; i < 256; ++i) {
383 double difference = byte_count[i] - expected_count; 383 double difference = byte_count[i] - expected_count;
384 chi_squared += difference * difference / expected_count; 384 chi_squared += difference * difference / expected_count;
385 } 385 }
386 386
387 // Approximate chi-squared value for p-value 0.05, 255 degrees-of-freedom. 387 // Approximate chi-squared value for p-value 0.05, 255 degrees-of-freedom.
388 EXPECT_LE(chi_squared, 293.24); 388 EXPECT_LE(chi_squared, 293.24);
389 } 389 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/osinttypes.h ('k') | native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698