Skip to content

Commit

Permalink
Search sample data in more folders for perftest
Browse files Browse the repository at this point in the history
  • Loading branch information
miloyip committed Apr 16, 2015
1 parent 22021d6 commit 556d154
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/perftest/perftest.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,20 @@ class PerfTest : public ::testing::Test {
PerfTest() : filename_(), json_(), length_(), whitespace_(), whitespace_length_() {}

virtual void SetUp() {
FILE *fp = fopen(filename_ = "data/sample.json", "rb");
if (!fp)
fp = fopen(filename_ = "../../bin/data/sample.json", "rb");

const char *paths[] = {
"data/sample.json",
"bin/data/sample.json",
"../bin/data/sample.json",
"../../bin/data/sample.json",
"../../../bin/data/sample.json"
};
FILE *fp = 0;
for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
fp = fopen(paths[i], "rb");
if (fp)
break;
}
ASSERT_TRUE(fp != 0);

fseek(fp, 0, SEEK_END);
Expand Down

0 comments on commit 556d154

Please sign in to comment.