testing: Add stock AssertStrEq (#1185)

* Add AssertStrEq to testing include

* Remove unnecessary last param
This commit is contained in:
nosoop 2020-07-08 19:18:39 -07:00 committed by GitHub
parent 287628bfee
commit 69ae224938
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,3 +79,17 @@ stock void AssertTrue(const char[] text, bool value)
ThrowError("test %d (%s in %s) failed", TestNumber, text, TestContext);
}
}
stock void AssertStrEq(const char[] text, const char[] value, const char[] expected)
{
TestNumber++;
if (StrEqual(value, expected))
{
PrintToServer("[%d] %s: '%s' == '%s' OK", TestNumber, TestContext, text, expected);
}
else
{
PrintToServer("[%d] %s FAIL: %s should be '%s', got '%s'", TestNumber, TestContext, text, expected, value);
ThrowError("test %d (%s in %s) failed", TestNumber, text, TestContext);
}
}