Changed folder name.

Changed folder name.
This commit is contained in:
Jaysyn904
2022-10-07 21:08:37 -04:00
parent 1c33c2843e
commit 8d97886c3f
7060 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#include "nwnx_regex"
#include "nwnx_tests"
#include "x3_inc_string"
void main()
{
WriteTimestampedLogEntry("NWNX_Regex unit test begin..");
string str = "This string has a <cDDD>color</c> code.";
int regex_search = NWNX_Regex_Search(str,"<c.+?(?=>)>");
NWNX_Tests_Report("NWNX_Regex", "RegexSearch", regex_search == 1);
str = "This string has \na new line.";
regex_search = NWNX_Regex_Search(str,"\\n");
NWNX_Tests_Report("NWNX_Regex", "RegexSearch", regex_search == 1);
str = "This string does not have any non-ASCII characters.";
regex_search = NWNX_Regex_Search(str,"[^\\x01-\\x7E]");
NWNX_Tests_Report("NWNX_Regex", "RegexSearch", regex_search == 0);
string sRedString = StringToRGBString("stripped colors.", STRING_COLOR_RED);
str = "This is a <cfff>test</c> of "+sRedString;
string strip_colors = NWNX_Regex_Replace(str,"<c.+?(?=>)>|</c>");
NWNX_Tests_Report("NWNX_Regex", "RegexReplace", strip_colors == "This is a test of stripped colors.");
str = "This is a “test” of stripping to just ascii printable and new lines.";
string strip_non_ascii = NWNX_Regex_Replace(str,"[^\\n\\r\\x20-\\x7E]");
NWNX_Tests_Report("NWNX_Regex", "RegexReplace", strip_non_ascii == "This is a test of stripping to just ascii printable and new lines.");
WriteTimestampedLogEntry("NWNX_Regex unit test end.");
}