| 
				
			 | 
			
			 | 
			@@ -61,6 +61,86 @@ bool result; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			// Tests ///////////////////////////////////////////////////////////////////////
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			////////////////////////////////////////////////////////////////////////////////
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			bool testFilePathIsAbsolute() {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  char const dirSep = CodeDweller::FilePath::DirectorySeparator;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::string testPath;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  // Test absolute paths.
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath = dirSep;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += "filename";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute(testPath)) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += dirSep;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += "pathcomponent";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute(testPath)) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += dirSep;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute(testPath)) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#ifdef _WIN32
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("x:sll")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("x:\\sll")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("x:\\sll\\")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("x:\\sll\lll")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("\\sll")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("\\sll\\")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (!CodeDweller::FilePath::isAbsolute("\\sll\lll")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#endif
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  // Test relative paths.
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (CodeDweller::FilePath::isAbsolute("")) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath = "Hello";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (CodeDweller::FilePath::isAbsolute(testPath)) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath = "Hello";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += dirSep;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (CodeDweller::FilePath::isAbsolute(testPath)) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath = "Hello";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += dirSep;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  testPath += "file";
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (CodeDweller::FilePath::isAbsolute(testPath)) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("isAbsolute() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  return true;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			bool testFilePathJoin() {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  char const dirSep = CodeDweller::FilePath::DirectorySeparator;
 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			 | 
			@@ -116,6 +196,30 @@ bool testFilePathJoin() { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    RETURN_FALSE("join() failure");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  try {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    (void) CodeDweller::FilePath::join({"rel", "/abs"});
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    NO_EXCEPTION_TERM("join()");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return false;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  } catch (std::exception &e) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  try {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    (void) CodeDweller::FilePath::join({"rel", "/abs", "otherrel"});
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    NO_EXCEPTION_TERM("join()");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return false;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  } catch (std::exception &e) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  return true;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			long createTestFile(std::string fileName) {
 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			 | 
			@@ -407,6 +511,7 @@ int main() | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::cout << "CodeDweller::Filesystem unit tests" << std::endl << std::endl;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFilePathIsAbsolute);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFilePathJoin);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFileReferenceFile);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  RUN_TEST(testFileReferenceNoFile);
 |