| 
				
			 | 
			
			 | 
			@@ -61,6 +61,63 @@ bool result; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			// Tests ///////////////////////////////////////////////////////////////////////
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			////////////////////////////////////////////////////////////////////////////////
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			bool testFileOpsMoveFile() {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::string fromName = "from.txt";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::string toName = "to.txt";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::string const expectedContent = "fileContentForMoveTest";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::string content;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  // Test nominal case.
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::ofstream out(fromName.c_str());
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out << expectedContent;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out.close();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  CodeDweller::FileOps::moveFile(fromName, toName);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::ifstream in(toName.c_str());
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  in >> content;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  in.close();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (expectedContent != content) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("FileOps::moveFile() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  // Test moving to a file that exists.
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out.open(fromName.c_str());
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out << expectedContent;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out.close();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out.open(toName.c_str());
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out << "not" + expectedContent;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  out.close();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  CodeDweller::FileOps::moveFile(fromName, toName);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  in.open(toName.c_str());
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  in >> content;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  in.close();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (expectedContent != content) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("FileOps::moveFile() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  // Test moving file that doesn't exist.
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  try {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    (void) CodeDweller::FileOps::moveFile("doesNotExist", "alsoDoesNotExist");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    NO_EXCEPTION_TERM("FileOps::moveFile()");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return false;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  } catch (std::exception &e) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  return true;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			bool testFilePathIsAbsolute() {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  char const dirSep = CodeDweller::FilePath::DirectorySeparator;
 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			 | 
			@@ -517,6 +574,7 @@ int main() | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::cout << "CodeDweller::Filesystem unit tests" << std::endl << std::endl;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFileOpsMoveFile);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFilePathIsAbsolute);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFilePathJoin);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFileReferenceFile);
 |