#include "../common/mime.h"
#include "../common/svrblist.h"
#include "../common/textprocessing.h"
+
TEST(CommonFunctions, GetUserDir){
// Run the unit tests depending on the operating system being used.
TEST(CommonFunctions, CaptureString){
+ // Test the capture string function.
+
+ wxString CaptureStringData = "Example";
+ CaptureString(&CaptureStringData, false);
+ ASSERT_EQ("Example", CaptureStringData.ToStdString());
+
+ CaptureStringData = "Here we go\\, an \"example\" of escaping string.";
+ CaptureString(&CaptureStringData, false);
+ ASSERT_EQ("Here we go, an \"example\" of escaping string.", CaptureStringData.ToStdString());
+
+ CaptureStringData = "Lets put some \\nnew \\nlines \\nin \\nhere.";
+ CaptureString(&CaptureStringData, false);
+ ASSERT_EQ("Lets put some \nnew \nlines \nin \nhere.", CaptureStringData.ToStdString());
+
+ CaptureStringData = "A:\\\\path\\\\example\\\\lets\\\\have\\\\some\\\\fun";
+ CaptureString(&CaptureStringData, false);
+ ASSERT_EQ("A:\\path\\example\\lets\\have\\some\\fun", CaptureStringData.ToStdString());
+
}
TEST(CommonFunctions, ResetUnusedString){
+ // Tests for resetting an unused string.
+
+ wxString ResetUnusedStringData = "Random string with a \\\\\\\\serverpath\\\\location";
+ ResetUnusedString(&ResetUnusedStringData);
+ ASSERT_EQ("Random string with a \\\\serverpath\\location", ResetUnusedStringData.ToStdString());
+
+ ResetUnusedStringData = "Some text \\nwith new \\nlines!";
+ ResetUnusedString(&ResetUnusedStringData);
+ ASSERT_EQ("Some text \nwith new \nlines!", ResetUnusedStringData.ToStdString());
+
+ ResetUnusedStringData = "Some text \\nwith new \\nlines!";
+ ResetUnusedString(&ResetUnusedStringData);
+ ASSERT_EQ("Some text \nwith new \nlines!", ResetUnusedStringData.ToStdString());
+
+ ResetUnusedStringData = "And now the list of characters: \\\\ \\n \\; \\,";
+ ResetUnusedString(&ResetUnusedStringData);
+ ASSERT_EQ("And now the list of characters: \\ \n ; ,", ResetUnusedStringData.ToStdString());
+
}
TEST(CommonFunctions, ConvertToHTML){