1 #include "../file-io.hpp" 2 3 #include <stdio.h> 4 #include <sys/file.h> 5 #include <unistd.h> 6 7 #include <fstream> 8 #include <iostream> 9 #include <string> 10 11 #include <gtest/gtest.h> 12 13 TEST(TestFileIO, TestFileReadWrite) 14 { 15 std::string testFile = "./tmp_test_file"; 16 17 std::string testStatus, testStatusUpdated; 18 19 testStatus.push_back(2); 20 testStatus.append("image downloading in progress"); 21 22 testStatusUpdated.push_back(0); 23 testStatusUpdated.append("finished netboot"); 24 25 fileWrite(testFile, testStatus); 26 27 EXPECT_TRUE(testStatus == fileRead(testFile)); 28 29 fileWrite(testFile, testStatusUpdated); 30 31 EXPECT_TRUE(testStatusUpdated == fileRead(testFile)); 32 33 remove(testFile.c_str()); 34 } 35