MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / TEST_F

Function TEST_F

src/utilities/bcl/test/BCLFileReference_GTest.cpp:14–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace openstudio;
13
14TEST_F(BCLFixture, BCLFileReference) {
15
16 openstudio::path testDir = openstudio::filesystem::system_complete(getApplicationBuildDirectory() / toPath("Testing"));
17 openstudio::path relativePath = toPath("BCLFileReference.txt");
18 openstudio::path absolutePath = testDir / relativePath;
19 if (exists(absolutePath)) {
20 remove(absolutePath);
21 }
22 ASSERT_FALSE(exists(absolutePath));
23
24 BCLFileReference ref(testDir, relativePath, true);
25 EXPECT_FALSE(ref.checkForUpdate());
26
27 EXPECT_EQ("BCLFileReference.txt", ref.fileName());
28 EXPECT_EQ("txt", ref.fileType());
29
30 openstudio::filesystem::ofstream file(absolutePath);
31 ASSERT_TRUE(file.is_open());
32 file << "Hi";
33 file.close();
34
35 EXPECT_TRUE(ref.checkForUpdate());
36
37 EXPECT_FALSE(ref.checkForUpdate());
38
39 file.open(absolutePath);
40 ASSERT_TRUE(file.is_open());
41 file << "Bye";
42 file.close();
43
44 EXPECT_TRUE(ref.checkForUpdate());
45
46 EXPECT_FALSE(ref.checkForUpdate());
47
48 ASSERT_TRUE(exists(absolutePath));
49 remove(absolutePath);
50 ASSERT_FALSE(exists(absolutePath));
51
52 EXPECT_TRUE(ref.checkForUpdate());
53
54 EXPECT_FALSE(ref.checkForUpdate());
55}

Callers

nothing calls this directly

Calls 6

checkForUpdateMethod · 0.80
toPathFunction · 0.50
fileNameMethod · 0.45
fileTypeMethod · 0.45
closeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected