Browse Source

Added == and != operators for strings as another way to call string_match from template functions.

David Piuva 2 years ago
parent
commit
f73f35cc49

+ 4 - 0
Source/DFPSR/api/stringAPI.h

@@ -311,6 +311,10 @@ Buffer string_saveToMemory(const ReadableString& content,
 bool string_match(const ReadableString& a, const ReadableString& b);
 bool string_match(const ReadableString& a, const ReadableString& b);
 // Post-condition: Returns true iff strings a and b are roughly equal using a case insensitive match.
 // Post-condition: Returns true iff strings a and b are roughly equal using a case insensitive match.
 bool string_caseInsensitiveMatch(const ReadableString& a, const ReadableString& b);
 bool string_caseInsensitiveMatch(const ReadableString& a, const ReadableString& b);
+// While string_match should be preferred over == for code readability and consistency with string_caseInsensitiveMatch,
+//   the equality operator might be called automatically from template methods when a template type is a string.
+inline bool operator==(const ReadableString& a, const ReadableString& b) { return string_match(a, b); }
+inline bool operator!=(const ReadableString& a, const ReadableString& b) { return !string_match(a, b); }
 
 
 // Post-condition: Returns text converted to upper case.
 // Post-condition: Returns text converted to upper case.
 String string_upperCase(const ReadableString &text);
 String string_upperCase(const ReadableString &text);

+ 0 - 2
Source/test/testTools.h

@@ -24,7 +24,6 @@ inline bool nearValue(const FVector4D& a, const FVector4D& b) {
 #define START_TEST(NAME) int main() { printText("Running test \"", #NAME, "\": ");
 #define START_TEST(NAME) int main() { printText("Running test \"", #NAME, "\": ");
 #define END_TEST printText(" (done)\n"); return PASSED; }
 #define END_TEST printText(" (done)\n"); return PASSED; }
 
 
-#define OP_EQUALS_STRING(A, B) (string_match(A, B))
 #define OP_EQUALS(A, B) ((A) == (B))
 #define OP_EQUALS(A, B) ((A) == (B))
 #define OP_NOT_EQUALS(A, B) ((A) != (B))
 #define OP_NOT_EQUALS(A, B) ((A) != (B))
 #define OP_LESSER(A, B) ((A) < (B))
 #define OP_LESSER(A, B) ((A) < (B))
@@ -56,7 +55,6 @@ inline bool nearValue(const FVector4D& a, const FVector4D& b) {
 		printText("\n\n"); \
 		printText("\n\n"); \
 		return FAILED; \
 		return FAILED; \
 	}
 	}
-#define ASSERT_MATCH(A, B) ASSERT_COMP(A, B, OP_EQUALS_STRING, "matches")
 #define ASSERT_EQUAL(A, B) ASSERT_COMP(A, B, OP_EQUALS, "==")
 #define ASSERT_EQUAL(A, B) ASSERT_COMP(A, B, OP_EQUALS, "==")
 #define ASSERT_NOT_EQUAL(A, B) ASSERT_COMP(A, B, OP_NOT_EQUALS, "!=")
 #define ASSERT_NOT_EQUAL(A, B) ASSERT_COMP(A, B, OP_NOT_EQUALS, "!=")
 #define ASSERT_LESSER(A, B) ASSERT_COMP(A, B, OP_LESSER, "<")
 #define ASSERT_LESSER(A, B) ASSERT_COMP(A, B, OP_LESSER, "<")

+ 80 - 80
Source/test/tests/FileTest.cpp

@@ -4,98 +4,98 @@
 
 
 START_TEST(File)
 START_TEST(File)
 	{ // Combining paths
 	{ // Combining paths
-		ASSERT_MATCH(file_combinePaths(U"", U"myProgram.exe", PathSyntax::Windows), U"myProgram.exe");
-		ASSERT_MATCH(file_combinePaths(U"C:", U"myProgram.exe", PathSyntax::Windows), U"C:\\myProgram.exe");
-		ASSERT_MATCH(file_combinePaths(U"C:\\windows", U"myProgram.exe", PathSyntax::Windows), U"C:\\windows\\myProgram.exe");
-		ASSERT_MATCH(file_combinePaths(U"C:\\windows\\", U"myProgram.exe", PathSyntax::Windows), U"C:\\windows\\myProgram.exe");
-		ASSERT_MATCH(file_combinePaths(U"", U"myProgram", PathSyntax::Posix), U"myProgram");
-		ASSERT_MATCH(file_combinePaths(U"/", U"myProgram", PathSyntax::Posix), U"/myProgram");
-		ASSERT_MATCH(file_combinePaths(U"/home", U"me", PathSyntax::Posix), U"/home/me");
-		ASSERT_MATCH(file_combinePaths(U"/home/", U"me", PathSyntax::Posix), U"/home/me");
+		ASSERT_EQUAL(file_combinePaths(U"", U"myProgram.exe", PathSyntax::Windows), U"myProgram.exe");
+		ASSERT_EQUAL(file_combinePaths(U"C:", U"myProgram.exe", PathSyntax::Windows), U"C:\\myProgram.exe");
+		ASSERT_EQUAL(file_combinePaths(U"C:\\windows", U"myProgram.exe", PathSyntax::Windows), U"C:\\windows\\myProgram.exe");
+		ASSERT_EQUAL(file_combinePaths(U"C:\\windows\\", U"myProgram.exe", PathSyntax::Windows), U"C:\\windows\\myProgram.exe");
+		ASSERT_EQUAL(file_combinePaths(U"", U"myProgram", PathSyntax::Posix), U"myProgram");
+		ASSERT_EQUAL(file_combinePaths(U"/", U"myProgram", PathSyntax::Posix), U"/myProgram");
+		ASSERT_EQUAL(file_combinePaths(U"/home", U"me", PathSyntax::Posix), U"/home/me");
+		ASSERT_EQUAL(file_combinePaths(U"/home/", U"me", PathSyntax::Posix), U"/home/me");
 	}
 	}
 	{ // Optimizing paths
 	{ // Optimizing paths
 		// Preserving leading separators
 		// Preserving leading separators
-		ASSERT_MATCH(file_optimizePath(U"myProgram", PathSyntax::Windows), U"myProgram"); // Relative path
-		ASSERT_MATCH(file_optimizePath(U"\\myProgram", PathSyntax::Windows), U"\\myProgram"); // Implicit drive
-		ASSERT_MATCH(file_optimizePath(U"\\\\myProgram", PathSyntax::Windows), U"\\\\myProgram");
-		ASSERT_MATCH(file_optimizePath(U"\\\\\\myProgram", PathSyntax::Windows), U"\\\\\\myProgram");
-		ASSERT_MATCH(file_optimizePath(U"myProgram", PathSyntax::Posix), U"myProgram"); // Relative path
-		ASSERT_MATCH(file_optimizePath(U"/home", PathSyntax::Posix), U"/home"); // Root path
-		ASSERT_MATCH(file_optimizePath(U"//network", PathSyntax::Posix), U"//network"); // Special path
-		ASSERT_MATCH(file_optimizePath(U"///myProgram", PathSyntax::Posix), U"///myProgram");
+		ASSERT_EQUAL(file_optimizePath(U"myProgram", PathSyntax::Windows), U"myProgram"); // Relative path
+		ASSERT_EQUAL(file_optimizePath(U"\\myProgram", PathSyntax::Windows), U"\\myProgram"); // Implicit drive
+		ASSERT_EQUAL(file_optimizePath(U"\\\\myProgram", PathSyntax::Windows), U"\\\\myProgram");
+		ASSERT_EQUAL(file_optimizePath(U"\\\\\\myProgram", PathSyntax::Windows), U"\\\\\\myProgram");
+		ASSERT_EQUAL(file_optimizePath(U"myProgram", PathSyntax::Posix), U"myProgram"); // Relative path
+		ASSERT_EQUAL(file_optimizePath(U"/home", PathSyntax::Posix), U"/home"); // Root path
+		ASSERT_EQUAL(file_optimizePath(U"//network", PathSyntax::Posix), U"//network"); // Special path
+		ASSERT_EQUAL(file_optimizePath(U"///myProgram", PathSyntax::Posix), U"///myProgram");
 		// Preserving drive letters
 		// Preserving drive letters
-		ASSERT_MATCH(file_optimizePath(U"C:\\myProgram", PathSyntax::Windows), U"C:\\myProgram");
+		ASSERT_EQUAL(file_optimizePath(U"C:\\myProgram", PathSyntax::Windows), U"C:\\myProgram");
 		// Reducing redundancy
 		// Reducing redundancy
-		ASSERT_MATCH(file_optimizePath(U"/home/user", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user//", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user///", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/.", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/./", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/.//", PathSyntax::Posix), U"/home/user");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/..", PathSyntax::Posix), U"/home");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/../", PathSyntax::Posix), U"/home");
-		ASSERT_MATCH(file_optimizePath(U"/home/user/..//", PathSyntax::Posix), U"/home");
-		ASSERT_MATCH(file_optimizePath(U"/cars/oldCars/veteranCars/../././../newCars/", PathSyntax::Posix), U"/cars/newCars");
-		ASSERT_MATCH(file_optimizePath(U"C:\\cars\\oldCars\\veteranCars\\..\\..\\newCars\\", PathSyntax::Windows), U"C:\\cars\\newCars");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user//", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user///", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/.", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/./", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/.//", PathSyntax::Posix), U"/home/user");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/..", PathSyntax::Posix), U"/home");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/../", PathSyntax::Posix), U"/home");
+		ASSERT_EQUAL(file_optimizePath(U"/home/user/..//", PathSyntax::Posix), U"/home");
+		ASSERT_EQUAL(file_optimizePath(U"/cars/oldCars/veteranCars/../././../newCars/", PathSyntax::Posix), U"/cars/newCars");
+		ASSERT_EQUAL(file_optimizePath(U"C:\\cars\\oldCars\\veteranCars\\..\\..\\newCars\\", PathSyntax::Windows), U"C:\\cars\\newCars");
 		// Error handling
 		// Error handling
-		ASSERT_MATCH(file_optimizePath(U"C:\\..", PathSyntax::Windows), U"?"); // Can't go outside of C: drive
-		ASSERT_MATCH(file_optimizePath(U"\\..", PathSyntax::Windows), U"?"); // Can't go outside of current drive root
-		ASSERT_MATCH(file_optimizePath(U"..", PathSyntax::Windows), U".."); // Can go outside of the relative path
-		ASSERT_MATCH(file_optimizePath(U"/..", PathSyntax::Posix), U"?"); // Can't go outside of system root
-		ASSERT_MATCH(file_optimizePath(U"..", PathSyntax::Posix), U".."); // Can go outside of the relative path
+		ASSERT_EQUAL(file_optimizePath(U"C:\\..", PathSyntax::Windows), U"?"); // Can't go outside of C: drive
+		ASSERT_EQUAL(file_optimizePath(U"\\..", PathSyntax::Windows), U"?"); // Can't go outside of current drive root
+		ASSERT_EQUAL(file_optimizePath(U"..", PathSyntax::Windows), U".."); // Can go outside of the relative path
+		ASSERT_EQUAL(file_optimizePath(U"/..", PathSyntax::Posix), U"?"); // Can't go outside of system root
+		ASSERT_EQUAL(file_optimizePath(U"..", PathSyntax::Posix), U".."); // Can go outside of the relative path
 	}
 	}
 	{ // Absolute canonical paths
 	{ // Absolute canonical paths
-		ASSERT_MATCH(file_getTheoreticalAbsolutePath(U"mediaFolder\\myFile.txt", U"C:\\folder\\anotherFolder", PathSyntax::Windows), U"C:\\folder\\anotherFolder\\mediaFolder\\myFile.txt");
-		ASSERT_MATCH(file_getTheoreticalAbsolutePath(U"mediaFolder\\myFile.txt", U"C:\\folder\\anotherFolder\\", PathSyntax::Windows), U"C:\\folder\\anotherFolder\\mediaFolder\\myFile.txt");
-		ASSERT_MATCH(file_getTheoreticalAbsolutePath(U"myFile.txt", U"C:\\folder", PathSyntax::Windows), U"C:\\folder\\myFile.txt");
-		ASSERT_MATCH(file_getTheoreticalAbsolutePath(U"\\myFile.txt", U"C:\\folder", PathSyntax::Windows), U"C:\\myFile.txt"); // To the root of the current drive C:
-		ASSERT_MATCH(file_getTheoreticalAbsolutePath(U"", U"C:\\folder", PathSyntax::Windows), U"C:\\folder");
-		ASSERT_MATCH(file_getTheoreticalAbsolutePath(U"mediaFolder\\..\\myFile.txt", U"C:\\folder\\anotherFolder", PathSyntax::Windows), U"C:\\folder\\anotherFolder\\myFile.txt");
+		ASSERT_EQUAL(file_getTheoreticalAbsolutePath(U"mediaFolder\\myFile.txt", U"C:\\folder\\anotherFolder", PathSyntax::Windows), U"C:\\folder\\anotherFolder\\mediaFolder\\myFile.txt");
+		ASSERT_EQUAL(file_getTheoreticalAbsolutePath(U"mediaFolder\\myFile.txt", U"C:\\folder\\anotherFolder\\", PathSyntax::Windows), U"C:\\folder\\anotherFolder\\mediaFolder\\myFile.txt");
+		ASSERT_EQUAL(file_getTheoreticalAbsolutePath(U"myFile.txt", U"C:\\folder", PathSyntax::Windows), U"C:\\folder\\myFile.txt");
+		ASSERT_EQUAL(file_getTheoreticalAbsolutePath(U"\\myFile.txt", U"C:\\folder", PathSyntax::Windows), U"C:\\myFile.txt"); // To the root of the current drive C:
+		ASSERT_EQUAL(file_getTheoreticalAbsolutePath(U"", U"C:\\folder", PathSyntax::Windows), U"C:\\folder");
+		ASSERT_EQUAL(file_getTheoreticalAbsolutePath(U"mediaFolder\\..\\myFile.txt", U"C:\\folder\\anotherFolder", PathSyntax::Windows), U"C:\\folder\\anotherFolder\\myFile.txt");
 	}
 	}
 	{ // Parent folders
 	{ // Parent folders
-		ASSERT_MATCH(file_getRelativeParentFolder(U"mediaFolder\\..\\myFile.txt", PathSyntax::Windows), U"");
-		ASSERT_MATCH(file_getTheoreticalAbsoluteParentFolder(U"mediaFolder\\..\\myFile.txt", U"C:\\folder\\anotherFolder", PathSyntax::Windows), U"C:\\folder\\anotherFolder");
+		ASSERT_EQUAL(file_getRelativeParentFolder(U"mediaFolder\\..\\myFile.txt", PathSyntax::Windows), U"");
+		ASSERT_EQUAL(file_getTheoreticalAbsoluteParentFolder(U"mediaFolder\\..\\myFile.txt", U"C:\\folder\\anotherFolder", PathSyntax::Windows), U"C:\\folder\\anotherFolder");
 	}
 	}
 	{ // Path removal
 	{ // Path removal
-		ASSERT_MATCH(file_getPathlessName(U"C:\\..\\folder\\file.txt"), U"file.txt");
-		ASSERT_MATCH(file_getPathlessName(U"C:\\..\\folder\\"), U"");
-		ASSERT_MATCH(file_getPathlessName(U"C:\\..\\folder"), U"folder");
-		ASSERT_MATCH(file_getPathlessName(U"C:\\..\\"), U"");
-		ASSERT_MATCH(file_getPathlessName(U"C:\\.."), U"..");
-		ASSERT_MATCH(file_getPathlessName(U"C:\\"), U"");
-		ASSERT_MATCH(file_getPathlessName(U"C:"), U"C:");
-		ASSERT_MATCH(file_getPathlessName(U"/folder/file.h"), U"file.h");
-		ASSERT_MATCH(file_getPathlessName(U"/folder/"), U"");
-		ASSERT_MATCH(file_getPathlessName(U"/folder"), U"folder");
-		ASSERT_MATCH(file_getPathlessName(U"/"), U"");
+		ASSERT_EQUAL(file_getPathlessName(U"C:\\..\\folder\\file.txt"), U"file.txt");
+		ASSERT_EQUAL(file_getPathlessName(U"C:\\..\\folder\\"), U"");
+		ASSERT_EQUAL(file_getPathlessName(U"C:\\..\\folder"), U"folder");
+		ASSERT_EQUAL(file_getPathlessName(U"C:\\..\\"), U"");
+		ASSERT_EQUAL(file_getPathlessName(U"C:\\.."), U"..");
+		ASSERT_EQUAL(file_getPathlessName(U"C:\\"), U"");
+		ASSERT_EQUAL(file_getPathlessName(U"C:"), U"C:");
+		ASSERT_EQUAL(file_getPathlessName(U"/folder/file.h"), U"file.h");
+		ASSERT_EQUAL(file_getPathlessName(U"/folder/"), U"");
+		ASSERT_EQUAL(file_getPathlessName(U"/folder"), U"folder");
+		ASSERT_EQUAL(file_getPathlessName(U"/"), U"");
 	}
 	}
 	{ // Extension removal
 	{ // Extension removal
-		ASSERT_MATCH(file_getExtensionless(U"C:\\..\\folder\\file.txt"), U"C:\\..\\folder\\file");
-		ASSERT_MATCH(file_getExtensionless(U"C:\\folder\\file.h"), U"C:\\folder\\file");
-		ASSERT_MATCH(file_getExtensionless(U"C:\\file."), U"C:\\file");
-		ASSERT_MATCH(file_getExtensionless(U"\\file."), U"\\file");
-		ASSERT_MATCH(file_getExtensionless(U"file"), U"file");
-		ASSERT_MATCH(file_getExtensionless(U""), U"");
-		ASSERT_MATCH(file_getExtensionless(U"/folder/./file.txt"), U"/folder/./file");
-		ASSERT_MATCH(file_getExtensionless(U"/folder/file.h"), U"/folder/file");
-		ASSERT_MATCH(file_getExtensionless(U"/folder/../file.h"), U"/folder/../file");
-		ASSERT_MATCH(file_getExtensionless(U"/file."), U"/file");
-		ASSERT_MATCH(file_getExtensionless(U"file"), U"file");
-		ASSERT_MATCH(file_getExtension(U"C:\\..\\folder\\file.txt"), U"txt");
-		ASSERT_MATCH(file_getExtension(U"C:\\..\\folder\\file.foo.txt"), U"txt");
-		ASSERT_MATCH(file_getExtension(U"C:\\..\\folder\\file.foo_bar.txt"), U"txt");
-		ASSERT_MATCH(file_getExtension(U"C:\\..\\folder\\file.foo.bar_txt"), U"bar_txt");
-		ASSERT_MATCH(file_getExtension(U"C:\\folder\\file.h"), U"h");
-		ASSERT_MATCH(file_getExtension(U"C:\\file."), U"");
-		ASSERT_MATCH(file_getExtension(U"\\file."), U"");
-		ASSERT_MATCH(file_getExtension(U"file"), U"");
-		ASSERT_MATCH(file_getExtension(U""), U"");
-		ASSERT_MATCH(file_getExtension(U"/folder/./file.txt"), U"txt");
-		ASSERT_MATCH(file_getExtension(U"/folder/file.h"), U"h");
-		ASSERT_MATCH(file_getExtension(U"/folder/../file.h"), U"h");
-		ASSERT_MATCH(file_getExtension(U"/file."), U"");
-		ASSERT_MATCH(file_getExtension(U"file"), U"");
+		ASSERT_EQUAL(file_getExtensionless(U"C:\\..\\folder\\file.txt"), U"C:\\..\\folder\\file");
+		ASSERT_EQUAL(file_getExtensionless(U"C:\\folder\\file.h"), U"C:\\folder\\file");
+		ASSERT_EQUAL(file_getExtensionless(U"C:\\file."), U"C:\\file");
+		ASSERT_EQUAL(file_getExtensionless(U"\\file."), U"\\file");
+		ASSERT_EQUAL(file_getExtensionless(U"file"), U"file");
+		ASSERT_EQUAL(file_getExtensionless(U""), U"");
+		ASSERT_EQUAL(file_getExtensionless(U"/folder/./file.txt"), U"/folder/./file");
+		ASSERT_EQUAL(file_getExtensionless(U"/folder/file.h"), U"/folder/file");
+		ASSERT_EQUAL(file_getExtensionless(U"/folder/../file.h"), U"/folder/../file");
+		ASSERT_EQUAL(file_getExtensionless(U"/file."), U"/file");
+		ASSERT_EQUAL(file_getExtensionless(U"file"), U"file");
+		ASSERT_EQUAL(file_getExtension(U"C:\\..\\folder\\file.txt"), U"txt");
+		ASSERT_EQUAL(file_getExtension(U"C:\\..\\folder\\file.foo.txt"), U"txt");
+		ASSERT_EQUAL(file_getExtension(U"C:\\..\\folder\\file.foo_bar.txt"), U"txt");
+		ASSERT_EQUAL(file_getExtension(U"C:\\..\\folder\\file.foo.bar_txt"), U"bar_txt");
+		ASSERT_EQUAL(file_getExtension(U"C:\\folder\\file.h"), U"h");
+		ASSERT_EQUAL(file_getExtension(U"C:\\file."), U"");
+		ASSERT_EQUAL(file_getExtension(U"\\file."), U"");
+		ASSERT_EQUAL(file_getExtension(U"file"), U"");
+		ASSERT_EQUAL(file_getExtension(U""), U"");
+		ASSERT_EQUAL(file_getExtension(U"/folder/./file.txt"), U"txt");
+		ASSERT_EQUAL(file_getExtension(U"/folder/file.h"), U"h");
+		ASSERT_EQUAL(file_getExtension(U"/folder/../file.h"), U"h");
+		ASSERT_EQUAL(file_getExtension(U"/file."), U"");
+		ASSERT_EQUAL(file_getExtension(U"file"), U"");
 		ASSERT_EQUAL(file_hasExtension(U"/folder/./file.txt"), true);
 		ASSERT_EQUAL(file_hasExtension(U"/folder/./file.txt"), true);
 		ASSERT_EQUAL(file_hasExtension(U"/../folder/file.h"), true);
 		ASSERT_EQUAL(file_hasExtension(U"/../folder/file.h"), true);
 		ASSERT_EQUAL(file_hasExtension(U"/folder/file."), true); // Not a named extension, but ending with a dot is not a pure extensionless path either.
 		ASSERT_EQUAL(file_hasExtension(U"/folder/file."), true); // Not a named extension, but ending with a dot is not a pure extensionless path either.
@@ -145,10 +145,10 @@ START_TEST(File)
 		// Create a file in the FooBarParent/FooBarChildA folder.
 		// Create a file in the FooBarParent/FooBarChildA folder.
 		ASSERT_EQUAL(string_save(filePathC, U"Testing", CharacterEncoding::Raw_Latin1), true);
 		ASSERT_EQUAL(string_save(filePathC, U"Testing", CharacterEncoding::Raw_Latin1), true);
 		ASSERT_EQUAL(file_getEntryType(filePathC), EntryType::File);
 		ASSERT_EQUAL(file_getEntryType(filePathC), EntryType::File);
-		ASSERT_MATCH(string_load(filePathC, false), U"Testing");
+		ASSERT_EQUAL(string_load(filePathC, false), U"Testing");
 		ASSERT_EQUAL(file_getFileSize(filePathC), 7);
 		ASSERT_EQUAL(file_getFileSize(filePathC), 7);
 		ASSERT_EQUAL(string_save(filePathC, U"Test", CharacterEncoding::Raw_Latin1), true);
 		ASSERT_EQUAL(string_save(filePathC, U"Test", CharacterEncoding::Raw_Latin1), true);
-		ASSERT_MATCH(string_load(filePathC, false), U"Test");
+		ASSERT_EQUAL(string_load(filePathC, false), U"Test");
 		ASSERT_EQUAL(file_getFileSize(filePathC), 4);
 		ASSERT_EQUAL(file_getFileSize(filePathC), 4);
 		ASSERT_EQUAL(file_removeEmptyFolder(childPathA), false); // Trying to remove FooBarParent/FooBarChildA now should fail.
 		ASSERT_EQUAL(file_removeEmptyFolder(childPathA), false); // Trying to remove FooBarParent/FooBarChildA now should fail.
 		// Remove the file.
 		// Remove the file.

+ 1 - 1
Source/test/tests/FlexTest.cpp

@@ -11,6 +11,6 @@ START_TEST(Flex)
 	FlexValue a;
 	FlexValue a;
 	a.assignValue(U"67%+34", U"");
 	a.assignValue(U"67%+34", U"");
 	ASSERT_EQUAL(a, FlexValue(67, 34));
 	ASSERT_EQUAL(a, FlexValue(67, 34));
-	ASSERT_MATCH(FlexValue(67, 34).toString(), U"67%+34");
+	ASSERT_EQUAL(FlexValue(67, 34).toString(), U"67%+34");
 END_TEST
 END_TEST
 
 

+ 20 - 20
Source/test/tests/ListTest.cpp

@@ -25,38 +25,38 @@ START_TEST(List)
 		myStrings.push(U"a");
 		myStrings.push(U"a");
 		myStrings.push(U"list");
 		myStrings.push(U"list");
 		ASSERT_EQUAL(myStrings.length(), 4);
 		ASSERT_EQUAL(myStrings.length(), 4);
-		ASSERT_MATCH(myStrings[0], U"is");
-		ASSERT_MATCH(myStrings[1], U"this");
-		ASSERT_MATCH(myStrings[2], U"a");
-		ASSERT_MATCH(myStrings[3], U"list");
-		ASSERT_MATCH(myStrings.first(), U"is");
-		ASSERT_MATCH(myStrings.last(), U"list");
+		ASSERT_EQUAL(myStrings[0], U"is");
+		ASSERT_EQUAL(myStrings[1], U"this");
+		ASSERT_EQUAL(myStrings[2], U"a");
+		ASSERT_EQUAL(myStrings[3], U"list");
+		ASSERT_EQUAL(myStrings.first(), U"is");
+		ASSERT_EQUAL(myStrings.last(), U"list");
 		myStrings.swap(0, 1);
 		myStrings.swap(0, 1);
 		ASSERT_EQUAL(myStrings.length(), 4);
 		ASSERT_EQUAL(myStrings.length(), 4);
-		ASSERT_MATCH(myStrings[0], U"this");
-		ASSERT_MATCH(myStrings[1], U"is");
-		ASSERT_MATCH(myStrings[2], U"a");
-		ASSERT_MATCH(myStrings[3], U"list");
+		ASSERT_EQUAL(myStrings[0], U"this");
+		ASSERT_EQUAL(myStrings[1], U"is");
+		ASSERT_EQUAL(myStrings[2], U"a");
+		ASSERT_EQUAL(myStrings[3], U"list");
 		List<String> myOtherStrings = myStrings;
 		List<String> myOtherStrings = myStrings;
 		myStrings.remove(1);
 		myStrings.remove(1);
 		ASSERT_EQUAL(myStrings.length(), 3);
 		ASSERT_EQUAL(myStrings.length(), 3);
-		ASSERT_MATCH(myStrings[0], U"this");
-		ASSERT_MATCH(myStrings[1], U"a");
-		ASSERT_MATCH(myStrings[2], U"list");
+		ASSERT_EQUAL(myStrings[0], U"this");
+		ASSERT_EQUAL(myStrings[1], U"a");
+		ASSERT_EQUAL(myStrings[2], U"list");
 		myStrings.remove(0);
 		myStrings.remove(0);
 		ASSERT_EQUAL(myStrings.length(), 2);
 		ASSERT_EQUAL(myStrings.length(), 2);
-		ASSERT_MATCH(myStrings[0], U"a");
-		ASSERT_MATCH(myStrings[1], U"list");
+		ASSERT_EQUAL(myStrings[0], U"a");
+		ASSERT_EQUAL(myStrings[1], U"list");
 		myStrings.pop();
 		myStrings.pop();
 		ASSERT_EQUAL(myStrings.length(), 1);
 		ASSERT_EQUAL(myStrings.length(), 1);
-		ASSERT_MATCH(myStrings[0], U"a");
+		ASSERT_EQUAL(myStrings[0], U"a");
 		myStrings.clear();
 		myStrings.clear();
 		ASSERT_EQUAL(myStrings.length(), 0);
 		ASSERT_EQUAL(myStrings.length(), 0);
 		ASSERT_EQUAL(myOtherStrings.length(), 4);
 		ASSERT_EQUAL(myOtherStrings.length(), 4);
-		ASSERT_MATCH(myOtherStrings[0], U"this");
-		ASSERT_MATCH(myOtherStrings[1], U"is");
-		ASSERT_MATCH(myOtherStrings[2], U"a");
-		ASSERT_MATCH(myOtherStrings[3], U"list");
+		ASSERT_EQUAL(myOtherStrings[0], U"this");
+		ASSERT_EQUAL(myOtherStrings[1], U"is");
+		ASSERT_EQUAL(myOtherStrings[2], U"a");
+		ASSERT_EQUAL(myOtherStrings[3], U"list");
 		myOtherStrings.clear();
 		myOtherStrings.clear();
 		ASSERT_EQUAL(myOtherStrings.length(), 0);
 		ASSERT_EQUAL(myOtherStrings.length(), 0);
 	}
 	}

+ 20 - 20
Source/test/tests/PersistentTest.cpp

@@ -131,20 +131,20 @@ START_TEST(Persistent)
 	// MyClass to text
 	// MyClass to text
 	MyClass myObject(1, U"two");
 	MyClass myObject(1, U"two");
 	String myText = myObject.toString();
 	String myText = myObject.toString();
-	ASSERT_MATCH(myText, exampleOne);
+	ASSERT_EQUAL(myText, exampleOne);
 
 
 	// MyClass from text
 	// MyClass from text
 	std::shared_ptr<Persistent> myObjectCopy = createPersistentClassFromText(myText, U"");
 	std::shared_ptr<Persistent> myObjectCopy = createPersistentClassFromText(myText, U"");
-	ASSERT_MATCH(myObjectCopy->toString(), myText);
+	ASSERT_EQUAL(myObjectCopy->toString(), myText);
 
 
 	// MySubClass to text
 	// MySubClass to text
 	MySubClass mySubObject(1, U"two", 3, 4);
 	MySubClass mySubObject(1, U"two", 3, 4);
 	String MySubText = mySubObject.toString();
 	String MySubText = mySubObject.toString();
-	ASSERT_MATCH(MySubText, exampleTwo);
+	ASSERT_EQUAL(MySubText, exampleTwo);
 
 
 	// MySubClass from text
 	// MySubClass from text
 	std::shared_ptr<Persistent> mySubObjectCopy = createPersistentClassFromText(MySubText, U"");
 	std::shared_ptr<Persistent> mySubObjectCopy = createPersistentClassFromText(MySubText, U"");
-	ASSERT_MATCH(mySubObjectCopy->toString(), MySubText);
+	ASSERT_EQUAL(mySubObjectCopy->toString(), MySubText);
 
 
 	// Tree structure to text
 	// Tree structure to text
 	MyCollection tree(1, U"first");
 	MyCollection tree(1, U"first");
@@ -153,42 +153,42 @@ START_TEST(Persistent)
 	tree.addChild(second);
 	tree.addChild(second);
 	tree.addChild(std::make_shared<MySubClass>(34, U"foo", 56, 78));
 	tree.addChild(std::make_shared<MySubClass>(34, U"foo", 56, 78));
 	second->addChild(std::make_shared<MyClass>(3, U"third"));
 	second->addChild(std::make_shared<MyClass>(3, U"third"));
-	ASSERT_MATCH(tree.toString(), exampleThree);
+	ASSERT_EQUAL(tree.toString(), exampleThree);
 
 
 	// Tree structure from text
 	// Tree structure from text
 	std::shared_ptr<Persistent> treeCopy = createPersistentClassFromText(exampleThree, U"");
 	std::shared_ptr<Persistent> treeCopy = createPersistentClassFromText(exampleThree, U"");
-	ASSERT_MATCH(treeCopy->toString(), exampleThree);
+	ASSERT_EQUAL(treeCopy->toString(), exampleThree);
 
 
 	// Persistent string lists
 	// Persistent string lists
 	PersistentStringList myList = PersistentStringList();
 	PersistentStringList myList = PersistentStringList();
 	ASSERT_EQUAL(myList.value.length(), 0);
 	ASSERT_EQUAL(myList.value.length(), 0);
-	ASSERT_MATCH(myList.toString(), U"");
+	ASSERT_EQUAL(myList.toString(), U"");
 
 
 	myList = PersistentStringList(U"\"\"", U"");
 	myList = PersistentStringList(U"\"\"", U"");
 	ASSERT_EQUAL(myList.value.length(), 1);
 	ASSERT_EQUAL(myList.value.length(), 1);
-	ASSERT_MATCH(myList.value[0], U"");
-	ASSERT_MATCH(myList.toString(), U"\"\"");
+	ASSERT_EQUAL(myList.value[0], U"");
+	ASSERT_EQUAL(myList.toString(), U"\"\"");
 
 
 	myList = PersistentStringList(U"\"A\", \"B\"", U"");
 	myList = PersistentStringList(U"\"A\", \"B\"", U"");
 	ASSERT_EQUAL(myList.value.length(), 2);
 	ASSERT_EQUAL(myList.value.length(), 2);
-	ASSERT_MATCH(myList.value[0], U"A");
-	ASSERT_MATCH(myList.value[1], U"B");
-	ASSERT_MATCH(myList.toString(), U"\"A\", \"B\"");
+	ASSERT_EQUAL(myList.value[0], U"A");
+	ASSERT_EQUAL(myList.value[1], U"B");
+	ASSERT_EQUAL(myList.toString(), U"\"A\", \"B\"");
 
 
 	myList.assignValue(U"\"Only element\"", U"");
 	myList.assignValue(U"\"Only element\"", U"");
 	ASSERT_EQUAL(myList.value.length(), 1);
 	ASSERT_EQUAL(myList.value.length(), 1);
-	ASSERT_MATCH(myList.value[0], U"Only element");
-	ASSERT_MATCH(myList.toString(), U"\"Only element\"");
+	ASSERT_EQUAL(myList.value[0], U"Only element");
+	ASSERT_EQUAL(myList.toString(), U"\"Only element\"");
 
 
 	myList = PersistentStringList(U"", U"");
 	myList = PersistentStringList(U"", U"");
 	ASSERT_EQUAL(myList.value.length(), 0);
 	ASSERT_EQUAL(myList.value.length(), 0);
-	ASSERT_MATCH(myList.toString(), U"");
+	ASSERT_EQUAL(myList.toString(), U"");
 
 
 	myList.assignValue(U"\"Zero 0\", \"One 1\", \"Two 2\", \"Three 3\"", U"");
 	myList.assignValue(U"\"Zero 0\", \"One 1\", \"Two 2\", \"Three 3\"", U"");
 	ASSERT_EQUAL(myList.value.length(), 4);
 	ASSERT_EQUAL(myList.value.length(), 4);
-	ASSERT_MATCH(myList.value[0], U"Zero 0");
-	ASSERT_MATCH(myList.value[1], U"One 1");
-	ASSERT_MATCH(myList.value[2], U"Two 2");
-	ASSERT_MATCH(myList.value[3], U"Three 3");
-	ASSERT_MATCH(myList.toString(), U"\"Zero 0\", \"One 1\", \"Two 2\", \"Three 3\"");
+	ASSERT_EQUAL(myList.value[0], U"Zero 0");
+	ASSERT_EQUAL(myList.value[1], U"One 1");
+	ASSERT_EQUAL(myList.value[2], U"Two 2");
+	ASSERT_EQUAL(myList.value[3], U"Three 3");
+	ASSERT_EQUAL(myList.toString(), U"\"Zero 0\", \"One 1\", \"Two 2\", \"Three 3\"");
 END_TEST
 END_TEST

+ 74 - 74
Source/test/tests/StringTest.cpp

@@ -55,43 +55,43 @@ START_TEST(String)
 	}
 	}
 	{ // Concatenation
 	{ // Concatenation
 		dsr::String ab = dsr::string_combine(U"a", U"b");
 		dsr::String ab = dsr::string_combine(U"a", U"b");
-		ASSERT_MATCH(ab, U"ab");
+		ASSERT_EQUAL(ab, U"ab");
 		dsr::String cd = dsr::string_combine(U"c", U"d");
 		dsr::String cd = dsr::string_combine(U"c", U"d");
-		ASSERT_MATCH(cd, U"cd");
+		ASSERT_EQUAL(cd, U"cd");
 		cd = dsr::string_combine(U"c", U"d");
 		cd = dsr::string_combine(U"c", U"d");
-		ASSERT_MATCH(cd, U"cd");
+		ASSERT_EQUAL(cd, U"cd");
 		auto abcd = ab + cd;
 		auto abcd = ab + cd;
-		ASSERT_MATCH(abcd, U"abcd");
-		ASSERT_MATCH(dsr::string_combine(U"a", U"b", U"c", "d"), U"abcd");
+		ASSERT_EQUAL(abcd, U"abcd");
+		ASSERT_EQUAL(dsr::string_combine(U"a", U"b", U"c", "d"), U"abcd");
 	}
 	}
 	{ // Sub-strings
 	{ // Sub-strings
 		dsr::ReadableString abcd = U"abcd";
 		dsr::ReadableString abcd = U"abcd";
 		dsr::String efgh = U"efgh";
 		dsr::String efgh = U"efgh";
-		ASSERT_MATCH(dsr::string_inclusiveRange(abcd, 0, 3), U"abcd");
-		ASSERT_MATCH(dsr::string_exclusiveRange(abcd, 1, 2), U"b");
-		ASSERT_MATCH(dsr::string_inclusiveRange(efgh, 2, 3), U"gh");
-		ASSERT_MATCH(dsr::string_exclusiveRange(efgh, 3, 4), U"h");
-		ASSERT_MATCH(dsr::string_combine(string_from(abcd, 2), string_before(efgh, 2)), U"cdef");
-		ASSERT_MATCH(dsr::string_exclusiveRange(abcd, 0, 0), U""); // No size returns nothing
-		ASSERT_MATCH(dsr::string_exclusiveRange(abcd, -670214452, 2), U"ab"); // Reading out of bound is clamped
-		ASSERT_MATCH(dsr::string_exclusiveRange(abcd, 2, 985034841), U"cd"); // Reading out of bound is clamped
-		ASSERT_MATCH(dsr::string_exclusiveRange(abcd, 4, 764), U""); // Completely ous of bound returns nothing
-		ASSERT_MATCH(dsr::string_exclusiveRange(abcd, -631, 0), U""); // Completely ous of bound returns nothing
+		ASSERT_EQUAL(dsr::string_inclusiveRange(abcd, 0, 3), U"abcd");
+		ASSERT_EQUAL(dsr::string_exclusiveRange(abcd, 1, 2), U"b");
+		ASSERT_EQUAL(dsr::string_inclusiveRange(efgh, 2, 3), U"gh");
+		ASSERT_EQUAL(dsr::string_exclusiveRange(efgh, 3, 4), U"h");
+		ASSERT_EQUAL(dsr::string_combine(string_from(abcd, 2), string_before(efgh, 2)), U"cdef");
+		ASSERT_EQUAL(dsr::string_exclusiveRange(abcd, 0, 0), U""); // No size returns nothing
+		ASSERT_EQUAL(dsr::string_exclusiveRange(abcd, -670214452, 2), U"ab"); // Reading out of bound is clamped
+		ASSERT_EQUAL(dsr::string_exclusiveRange(abcd, 2, 985034841), U"cd"); // Reading out of bound is clamped
+		ASSERT_EQUAL(dsr::string_exclusiveRange(abcd, 4, 764), U""); // Completely ous of bound returns nothing
+		ASSERT_EQUAL(dsr::string_exclusiveRange(abcd, -631, 0), U""); // Completely ous of bound returns nothing
 	}
 	}
 	{ // Processing
 	{ // Processing
 		dsr::String buffer = U"Garbage";
 		dsr::String buffer = U"Garbage";
-		ASSERT_MATCH(buffer, U"Garbage");
+		ASSERT_EQUAL(buffer, U"Garbage");
 		buffer = foo(U"Ball", U"åäöÅÄÖ");
 		buffer = foo(U"Ball", U"åäöÅÄÖ");
-		ASSERT_MATCH(buffer, U"Foo(Ball,åäöÅÄÖ)");
+		ASSERT_EQUAL(buffer, U"Foo(Ball,åäöÅÄÖ)");
 		fooInPlace(buffer, U"Å", U"ф");
 		fooInPlace(buffer, U"Å", U"ф");
-		ASSERT_MATCH(buffer, U"Foo(Å,ф)");
+		ASSERT_EQUAL(buffer, U"Foo(Å,ф)");
 	}
 	}
 	{ // Numbers
 	{ // Numbers
 		uint32_t x = 0;
 		uint32_t x = 0;
 		int32_t y = -123456;
 		int32_t y = -123456;
 		int64_t z = 100200300400500600ULL;
 		int64_t z = 100200300400500600ULL;
 		dsr::String values = dsr::string_combine(U"x = ", x, U", y = ", y, U", z = ", z);
 		dsr::String values = dsr::string_combine(U"x = ", x, U", y = ", y, U", z = ", z);
-		ASSERT_MATCH(values, U"x = 0, y = -123456, z = 100200300400500600");
+		ASSERT_EQUAL(values, U"x = 0, y = -123456, z = 100200300400500600");
 	}
 	}
 	{ // Identifying numbers
 	{ // Identifying numbers
 		ASSERT_EQUAL(dsr::character_isDigit(U'0' - 1), false);
 		ASSERT_EQUAL(dsr::character_isDigit(U'0' - 1), false);
@@ -181,30 +181,30 @@ START_TEST(String)
 		ASSERT_EQUAL(dsr::string_isDouble(U"T0.0q"), false);
 		ASSERT_EQUAL(dsr::string_isDouble(U"T0.0q"), false);
 	}
 	}
 	// Upper case
 	// Upper case
-	ASSERT_MATCH(dsr::string_upperCase(U"a"), U"A");
-	ASSERT_MATCH(dsr::string_upperCase(U"aB"), U"AB");
-	ASSERT_MATCH(dsr::string_upperCase(U"abc"), U"ABC");
-	ASSERT_MATCH(dsr::string_upperCase(U"abc1"), U"ABC1");
-	ASSERT_MATCH(dsr::string_upperCase(U"Abc12"), U"ABC12");
-	ASSERT_MATCH(dsr::string_upperCase(U"ABC123"), U"ABC123");
+	ASSERT_EQUAL(dsr::string_upperCase(U"a"), U"A");
+	ASSERT_EQUAL(dsr::string_upperCase(U"aB"), U"AB");
+	ASSERT_EQUAL(dsr::string_upperCase(U"abc"), U"ABC");
+	ASSERT_EQUAL(dsr::string_upperCase(U"abc1"), U"ABC1");
+	ASSERT_EQUAL(dsr::string_upperCase(U"Abc12"), U"ABC12");
+	ASSERT_EQUAL(dsr::string_upperCase(U"ABC123"), U"ABC123");
 	// Lower case
 	// Lower case
-	ASSERT_MATCH(dsr::string_lowerCase(U"a"), U"a");
-	ASSERT_MATCH(dsr::string_lowerCase(U"aB"), U"ab");
-	ASSERT_MATCH(dsr::string_lowerCase(U"abc"), U"abc");
-	ASSERT_MATCH(dsr::string_lowerCase(U"abc1"), U"abc1");
-	ASSERT_MATCH(dsr::string_lowerCase(U"Abc12"), U"abc12");
-	ASSERT_MATCH(dsr::string_lowerCase(U"ABC123"), U"abc123");
+	ASSERT_EQUAL(dsr::string_lowerCase(U"a"), U"a");
+	ASSERT_EQUAL(dsr::string_lowerCase(U"aB"), U"ab");
+	ASSERT_EQUAL(dsr::string_lowerCase(U"abc"), U"abc");
+	ASSERT_EQUAL(dsr::string_lowerCase(U"abc1"), U"abc1");
+	ASSERT_EQUAL(dsr::string_lowerCase(U"Abc12"), U"abc12");
+	ASSERT_EQUAL(dsr::string_lowerCase(U"ABC123"), U"abc123");
 	// White space removal by pointing to a section of the original input
 	// White space removal by pointing to a section of the original input
-	ASSERT_MATCH(dsr::string_removeOuterWhiteSpace(U" "), U"");
-	ASSERT_MATCH(dsr::string_removeOuterWhiteSpace(U"  abc  "), U"abc");
-	ASSERT_MATCH(dsr::string_removeOuterWhiteSpace(U"  two words  "), U"two words");
-	ASSERT_MATCH(dsr::string_removeOuterWhiteSpace(U"  \" something quoted \"  "), U"\" something quoted \"");
+	ASSERT_EQUAL(dsr::string_removeOuterWhiteSpace(U" "), U"");
+	ASSERT_EQUAL(dsr::string_removeOuterWhiteSpace(U"  abc  "), U"abc");
+	ASSERT_EQUAL(dsr::string_removeOuterWhiteSpace(U"  two words  "), U"two words");
+	ASSERT_EQUAL(dsr::string_removeOuterWhiteSpace(U"  \" something quoted \"  "), U"\" something quoted \"");
 	// Quote mangling
 	// Quote mangling
-	ASSERT_MATCH(dsr::string_mangleQuote(U""), U"\"\"");
-	ASSERT_MATCH(dsr::string_mangleQuote(U"1"), U"\"1\"");
-	ASSERT_MATCH(dsr::string_mangleQuote(U"12"), U"\"12\"");
-	ASSERT_MATCH(dsr::string_mangleQuote(U"123"), U"\"123\"");
-	ASSERT_MATCH(dsr::string_mangleQuote(U"abc"), U"\"abc\"");
+	ASSERT_EQUAL(dsr::string_mangleQuote(U""), U"\"\"");
+	ASSERT_EQUAL(dsr::string_mangleQuote(U"1"), U"\"1\"");
+	ASSERT_EQUAL(dsr::string_mangleQuote(U"12"), U"\"12\"");
+	ASSERT_EQUAL(dsr::string_mangleQuote(U"123"), U"\"123\"");
+	ASSERT_EQUAL(dsr::string_mangleQuote(U"abc"), U"\"abc\"");
 	// Not enough quote signs
 	// Not enough quote signs
 	ASSERT_CRASH(dsr::string_unmangleQuote(U""));
 	ASSERT_CRASH(dsr::string_unmangleQuote(U""));
 	ASSERT_CRASH(dsr::string_unmangleQuote(U" "));
 	ASSERT_CRASH(dsr::string_unmangleQuote(U" "));
@@ -212,14 +212,14 @@ START_TEST(String)
 	// Too many quote signs
 	// Too many quote signs
 	ASSERT_CRASH(dsr::string_unmangleQuote(U"ab\"cd\"ef\"gh"));
 	ASSERT_CRASH(dsr::string_unmangleQuote(U"ab\"cd\"ef\"gh"));
 	// Basic quote
 	// Basic quote
-	ASSERT_MATCH(dsr::string_unmangleQuote(U"\"ab\""), U"ab");
+	ASSERT_EQUAL(dsr::string_unmangleQuote(U"\"ab\""), U"ab");
 	// Surrounded quote
 	// Surrounded quote
-	ASSERT_MATCH(dsr::string_unmangleQuote(U"\"ab\"cd"), U"ab");
-	ASSERT_MATCH(dsr::string_unmangleQuote(U"ab\"cd\""), U"cd");
-	ASSERT_MATCH(dsr::string_unmangleQuote(U"ab\"cd\"ef"), U"cd");
+	ASSERT_EQUAL(dsr::string_unmangleQuote(U"\"ab\"cd"), U"ab");
+	ASSERT_EQUAL(dsr::string_unmangleQuote(U"ab\"cd\""), U"cd");
+	ASSERT_EQUAL(dsr::string_unmangleQuote(U"ab\"cd\"ef"), U"cd");
 	// Mangled quote inside of quote
 	// Mangled quote inside of quote
-	ASSERT_MATCH(dsr::string_unmangleQuote(U"ab\"c\\\"d\"ef"), U"c\"d");
-	ASSERT_MATCH(dsr::string_unmangleQuote(dsr::string_mangleQuote(U"c\"d")), U"c\"d");
+	ASSERT_EQUAL(dsr::string_unmangleQuote(U"ab\"c\\\"d\"ef"), U"c\"d");
+	ASSERT_EQUAL(dsr::string_unmangleQuote(dsr::string_mangleQuote(U"c\"d")), U"c\"d");
 	// Mangle things
 	// Mangle things
 	dsr::String randomText;
 	dsr::String randomText;
 	string_reserve(randomText, 100);
 	string_reserve(randomText, 100);
@@ -230,18 +230,18 @@ START_TEST(String)
 		}
 		}
 		// Add a new random character
 		// Add a new random character
 		string_appendChar(randomText, (i * 21 + 136) % 256);
 		string_appendChar(randomText, (i * 21 + 136) % 256);
-		ASSERT_MATCH(dsr::string_unmangleQuote(dsr::string_mangleQuote(randomText)), randomText);
+		ASSERT_EQUAL(dsr::string_unmangleQuote(dsr::string_mangleQuote(randomText)), randomText);
 	}
 	}
 	// Number serialization
 	// Number serialization
-	ASSERT_MATCH(dsr::string_combine(0, U" ", 1), U"0 1");
-	ASSERT_MATCH(dsr::string_combine(14, U"x", 135), U"14x135");
-	ASSERT_MATCH(dsr::string_combine(-135), U"-135");
-	ASSERT_MATCH(dsr::string_combine(-14), U"-14");
-	ASSERT_MATCH(dsr::string_combine(-1), U"-1");
-	ASSERT_MATCH(dsr::string_combine(0u), U"0");
-	ASSERT_MATCH(dsr::string_combine(1u), U"1");
-	ASSERT_MATCH(dsr::string_combine(14u), U"14");
-	ASSERT_MATCH(dsr::string_combine(135u), U"135");
+	ASSERT_EQUAL(dsr::string_combine(0, U" ", 1), U"0 1");
+	ASSERT_EQUAL(dsr::string_combine(14, U"x", 135), U"14x135");
+	ASSERT_EQUAL(dsr::string_combine(-135), U"-135");
+	ASSERT_EQUAL(dsr::string_combine(-14), U"-14");
+	ASSERT_EQUAL(dsr::string_combine(-1), U"-1");
+	ASSERT_EQUAL(dsr::string_combine(0u), U"0");
+	ASSERT_EQUAL(dsr::string_combine(1u), U"1");
+	ASSERT_EQUAL(dsr::string_combine(14u), U"14");
+	ASSERT_EQUAL(dsr::string_combine(135u), U"135");
 	// Number parsing
 	// Number parsing
 	ASSERT_EQUAL(string_toInteger(U"0"), 0);
 	ASSERT_EQUAL(string_toInteger(U"0"), 0);
 	ASSERT_EQUAL(string_toInteger(U"-0"), 0);
 	ASSERT_EQUAL(string_toInteger(U"-0"), 0);
@@ -276,29 +276,29 @@ START_TEST(String)
 		List<String> result;
 		List<String> result;
 		result = string_split(source, U'.', false);
 		result = string_split(source, U'.', false);
 		ASSERT_EQUAL(result.length(), 4);
 		ASSERT_EQUAL(result.length(), 4);
-		ASSERT_MATCH(result[0], U" a ");
-		ASSERT_MATCH(result[1], U" b ");
-		ASSERT_MATCH(result[2], U" c ");
-		ASSERT_MATCH(result[3], U" d ");
+		ASSERT_EQUAL(result[0], U" a ");
+		ASSERT_EQUAL(result[1], U" b ");
+		ASSERT_EQUAL(result[2], U" c ");
+		ASSERT_EQUAL(result[3], U" d ");
 		ASSERT_EQUAL(string_getBufferUseCount(source), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(source), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(source2), 1);
 		ASSERT_EQUAL(string_getBufferUseCount(source2), 1);
 		result = string_split(source2, U'.', true);
 		result = string_split(source2, U'.', true);
 		ASSERT_EQUAL(result.length(), 3);
 		ASSERT_EQUAL(result.length(), 3);
-		ASSERT_MATCH(result[0], U"a");
-		ASSERT_MATCH(result[1], U"b");
-		ASSERT_MATCH(result[2], U"c");
+		ASSERT_EQUAL(result[0], U"a");
+		ASSERT_EQUAL(result[1], U"b");
+		ASSERT_EQUAL(result[2], U"c");
 		ASSERT_EQUAL(string_getBufferUseCount(source), 1);
 		ASSERT_EQUAL(string_getBufferUseCount(source), 1);
 		ASSERT_EQUAL(string_getBufferUseCount(source2), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(source2), 4);
 	}
 	}
 	{ // Using buffer remembered in ReadableString to reuse memory for splitting
 	{ // Using buffer remembered in ReadableString to reuse memory for splitting
 		String original = U" a . b . c . d ";
 		String original = U" a . b . c . d ";
 		ReadableString borrowsTheBuffer = string_after(original, 3);
 		ReadableString borrowsTheBuffer = string_after(original, 3);
-		ASSERT_MATCH(borrowsTheBuffer, U" b . c . d ");
+		ASSERT_EQUAL(borrowsTheBuffer, U" b . c . d ");
 		List<String> result = string_split(borrowsTheBuffer, U'.', true);
 		List<String> result = string_split(borrowsTheBuffer, U'.', true);
 		ASSERT_EQUAL(result.length(), 3);
 		ASSERT_EQUAL(result.length(), 3);
-		ASSERT_MATCH(result[0], U"b");
-		ASSERT_MATCH(result[1], U"c");
-		ASSERT_MATCH(result[2], U"d");
+		ASSERT_EQUAL(result[0], U"b");
+		ASSERT_EQUAL(result[1], U"c");
+		ASSERT_EQUAL(result[2], U"d");
 		ASSERT_EQUAL(string_getBufferUseCount(original), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(original), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(borrowsTheBuffer), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(borrowsTheBuffer), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(result[0]), 5);
 		ASSERT_EQUAL(string_getBufferUseCount(result[0]), 5);
@@ -307,18 +307,18 @@ START_TEST(String)
 	}
 	}
 	{ // Automatically allocating a shared buffer for many elements
 	{ // Automatically allocating a shared buffer for many elements
 		List<String> result = string_split(U" a . b . c . d ", U'.', true);
 		List<String> result = string_split(U" a . b . c . d ", U'.', true);
-		ASSERT_MATCH(result[0], U"a");
-		ASSERT_MATCH(result[1], U"b");
-		ASSERT_MATCH(result[2], U"c");
-		ASSERT_MATCH(result[3], U"d");
+		ASSERT_EQUAL(result[0], U"a");
+		ASSERT_EQUAL(result[1], U"b");
+		ASSERT_EQUAL(result[2], U"c");
+		ASSERT_EQUAL(result[3], U"d");
 		ASSERT_EQUAL(string_getBufferUseCount(result[0]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[0]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[1]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[1]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[2]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[2]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[3]), 4);
 		ASSERT_EQUAL(string_getBufferUseCount(result[3]), 4);
 		result = string_split(U" a . b . c ", U'.', false);
 		result = string_split(U" a . b . c ", U'.', false);
-		ASSERT_MATCH(result[0], U" a ");
-		ASSERT_MATCH(result[1], U" b ");
-		ASSERT_MATCH(result[2], U" c ");
+		ASSERT_EQUAL(result[0], U" a ");
+		ASSERT_EQUAL(result[1], U" b ");
+		ASSERT_EQUAL(result[2], U" c ");
 		ASSERT_EQUAL(string_getBufferUseCount(result[0]), 3);
 		ASSERT_EQUAL(string_getBufferUseCount(result[0]), 3);
 		ASSERT_EQUAL(string_getBufferUseCount(result[1]), 3);
 		ASSERT_EQUAL(string_getBufferUseCount(result[1]), 3);
 		ASSERT_EQUAL(string_getBufferUseCount(result[2]), 3);
 		ASSERT_EQUAL(string_getBufferUseCount(result[2]), 3);

+ 12 - 12
Source/test/tests/TextEncodingTest.cpp

@@ -122,7 +122,7 @@ START_TEST(TextEncoding)
 				Buffer encoded = string_saveToMemory(originalLatin1, CharacterEncoding::Raw_Latin1, lineEncoding);
 				Buffer encoded = string_saveToMemory(originalLatin1, CharacterEncoding::Raw_Latin1, lineEncoding);
 				String decodedLatin1 = string_loadFromMemory(encoded);
 				String decodedLatin1 = string_loadFromMemory(encoded);
 				//compareCharacterCodes(originalLatin1, decodedLatin1);
 				//compareCharacterCodes(originalLatin1, decodedLatin1);
-				ASSERT_MATCH(originalLatin1, decodedLatin1);
+				ASSERT_EQUAL(originalLatin1, decodedLatin1);
 			}
 			}
 			{ // UTF-8 up to U+10FFFF excluding \r and \0
 			{ // UTF-8 up to U+10FFFF excluding \r and \0
 				String originalUTF8;
 				String originalUTF8;
@@ -134,7 +134,7 @@ START_TEST(TextEncoding)
 				}
 				}
 				Buffer encoded = string_saveToMemory(originalUTF8, CharacterEncoding::BOM_UTF8, lineEncoding);
 				Buffer encoded = string_saveToMemory(originalUTF8, CharacterEncoding::BOM_UTF8, lineEncoding);
 				String decodedUTF8 = string_loadFromMemory(encoded);
 				String decodedUTF8 = string_loadFromMemory(encoded);
-				ASSERT_MATCH(originalUTF8, decodedUTF8);
+				ASSERT_EQUAL(originalUTF8, decodedUTF8);
 			}
 			}
 			// Selected cases for UTF-16
 			// Selected cases for UTF-16
 			for (int e = 0; e <= 1; e++) {
 			for (int e = 0; e <= 1; e++) {
@@ -187,7 +187,7 @@ START_TEST(TextEncoding)
 				String decoded = string_loadFromMemory(encoded);
 				String decoded = string_loadFromMemory(encoded);
 				//printBuffer(encoded);
 				//printBuffer(encoded);
 				//compareCharacterCodes(originalUTF16, decoded);
 				//compareCharacterCodes(originalUTF16, decoded);
-				ASSERT_MATCH(originalUTF16, decoded);
+				ASSERT_EQUAL(originalUTF16, decoded);
 			}
 			}
 			// All UTF-16 characters excluding \r and \0
 			// All UTF-16 characters excluding \r and \0
 			for (int e = 0; e <= 1; e++) {
 			for (int e = 0; e <= 1; e++) {
@@ -205,26 +205,26 @@ START_TEST(TextEncoding)
 				}
 				}
 				Buffer encoded = string_saveToMemory(original, characterEncoding, lineEncoding);
 				Buffer encoded = string_saveToMemory(original, characterEncoding, lineEncoding);
 				String decoded = string_loadFromMemory(encoded);
 				String decoded = string_loadFromMemory(encoded);
-				ASSERT_MATCH(original, decoded);
+				ASSERT_EQUAL(original, decoded);
 			}
 			}
 		}
 		}
 	}
 	}
 	{ // Loading strings of different encodings
 	{ // Loading strings of different encodings
 		String fileLatin1 = string_load(folderPath + U"Latin1.txt", true);
 		String fileLatin1 = string_load(folderPath + U"Latin1.txt", true);
 		//compareCharacterCodes(fileLatin1, expected_latin1);
 		//compareCharacterCodes(fileLatin1, expected_latin1);
-		ASSERT_MATCH(fileLatin1, expected_latin1);
+		ASSERT_EQUAL(fileLatin1, expected_latin1);
 
 
 		String fileUTF8 = string_load(folderPath + U"BomUtf8.txt", true);
 		String fileUTF8 = string_load(folderPath + U"BomUtf8.txt", true);
 		//compareCharacterCodes(fileUTF8, expected_utf8);
 		//compareCharacterCodes(fileUTF8, expected_utf8);
-		ASSERT_MATCH(fileUTF8, expected_utf8);
+		ASSERT_EQUAL(fileUTF8, expected_utf8);
 
 
 		String fileUTF16LE = string_load(folderPath + U"BomUtf16Le.txt", true);
 		String fileUTF16LE = string_load(folderPath + U"BomUtf16Le.txt", true);
 		//compareCharacterCodes(fileUTF16LE, expected_utf16le);
 		//compareCharacterCodes(fileUTF16LE, expected_utf16le);
-		ASSERT_MATCH(fileUTF16LE, expected_utf16le);
+		ASSERT_EQUAL(fileUTF16LE, expected_utf16le);
 
 
 		String fileUTF16BE = string_load(folderPath + U"BomUtf16Be.txt", true);
 		String fileUTF16BE = string_load(folderPath + U"BomUtf16Be.txt", true);
 		//compareCharacterCodes(fileUTF16BE, expected_utf16be);
 		//compareCharacterCodes(fileUTF16BE, expected_utf16be);
-		ASSERT_MATCH(fileUTF16BE, expected_utf16be);
+		ASSERT_EQUAL(fileUTF16BE, expected_utf16be);
 	}
 	}
 	{ // Saving and loading text to files using every combination of character and line encoding
 	{ // Saving and loading text to files using every combination of character and line encoding
 		String originalContent = U"Hello my friend\n你好我的朋友\n𐐷𤭢\n";
 		String originalContent = U"Hello my friend\n你好我的朋友\n𐐷𤭢\n";
@@ -237,17 +237,17 @@ START_TEST(TextEncoding)
 			string_save(tempPath, originalContent, CharacterEncoding::Raw_Latin1, lineEncoding);
 			string_save(tempPath, originalContent, CharacterEncoding::Raw_Latin1, lineEncoding);
 			String latin1Loaded = string_load(tempPath, true);
 			String latin1Loaded = string_load(tempPath, true);
 			//compareCharacterCodes(latin1Loaded, latin1Expected);
 			//compareCharacterCodes(latin1Loaded, latin1Expected);
-			ASSERT_MATCH(latin1Loaded, latin1Expected);
+			ASSERT_EQUAL(latin1Loaded, latin1Expected);
 
 
 			// UFT-8 should store up to 21 bits correctly
 			// UFT-8 should store up to 21 bits correctly
 			string_save(tempPath, unicodeContent, CharacterEncoding::BOM_UTF8, lineEncoding);
 			string_save(tempPath, unicodeContent, CharacterEncoding::BOM_UTF8, lineEncoding);
-			ASSERT_MATCH(string_load(tempPath, true), unicodeContent);
+			ASSERT_EQUAL(string_load(tempPath, true), unicodeContent);
 
 
 			// UFT-16 should store up to 20 bits correctly
 			// UFT-16 should store up to 20 bits correctly
 			string_save(tempPath, unicodeContent, CharacterEncoding::BOM_UTF16BE, lineEncoding);
 			string_save(tempPath, unicodeContent, CharacterEncoding::BOM_UTF16BE, lineEncoding);
-			ASSERT_MATCH(string_load(tempPath, true), unicodeContent);
+			ASSERT_EQUAL(string_load(tempPath, true), unicodeContent);
 			string_save(tempPath, unicodeContent, CharacterEncoding::BOM_UTF16LE, lineEncoding);
 			string_save(tempPath, unicodeContent, CharacterEncoding::BOM_UTF16LE, lineEncoding);
-			ASSERT_MATCH(string_load(tempPath, true), unicodeContent);
+			ASSERT_EQUAL(string_load(tempPath, true), unicodeContent);
 			string_save(tempPath, U"This file is used when testing text encoding.");
 			string_save(tempPath, U"This file is used when testing text encoding.");
 		}
 		}
 	}
 	}