badString2

Undocumented in source.
version(unittest)
string badString2;

Examples

Tests the detection of illegal characters in messages

assert(Message.hasIllegalCharacters(badString1) == true);
assert(Message.hasIllegalCharacters(badString2) == true);

Tests if a message containing bad characters, once stripped, is then valid.

Essentially, tests the stripper.

assert(Message.hasIllegalCharacters(Message.stripIllegalCharacters(badString1)) == false);
assert(Message.hasIllegalCharacters(Message.stripIllegalCharacters(badString2)) == false);

Tests the ability, at the Message-level, to detect illegal characters and automatically strip them when in ChecksMode.EASY

Message message = new Message(badString1, "fine", "fine");

try
{
    string encoded = message.encode(ChecksMode.EASY);
    assert(Message.hasIllegalCharacters(encoded) == false);
}
catch(BirchwoodException e)
{
    assert(false);
}

Tests the ability, at the Message-level, to detect illegal characters and throw an exception when in ChecksMode.HARDCORE

Message message = new Message(badString1, "fine", "fine");

try
{
    message.encode(ChecksMode.HARDCORE);
    assert(false);
}
catch(BirchwoodException e)
{
    assert(e.getType() == ErrorType.ILLEGAL_CHARACTERS);
}

Meta