Assert

Undocumented in source.

Members

Static functions

approximately
void approximately(T actual, U expected, V delta, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
beNull
void beNull(T actual, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
between
void between(T actual, U begin, U end, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
notApproximately
void notApproximately(T actual, U expected, V delta, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
notBetween
void notBetween(T actual, U begin, U end, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
notNull
void notNull(T actual, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
notWithin
void notWithin(T actual, U begin, U end, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
void opDispatch(T actual, U expected, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
within
void within(T actual, U begin, U end, string reason, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

Assert should work for base types

Assert.equal(1, 1, "they are the same value");
Assert.notEqual(1, 2, "they are not the same value");

Assert.greaterThan(1, 0);
Assert.notGreaterThan(0, 1);

Assert.lessThan(0, 1);
Assert.notLessThan(1, 0);

Assert.above(1, 0);
Assert.notAbove(0, 1);

Assert.below(0, 1);
Assert.notBelow(1, 0);

Assert.between(1, 0, 2);
Assert.notBetween(3, 0, 2);

Assert.within(1, 0, 2);
Assert.notWithin(3, 0, 2);

Assert.approximately(1.5f, 1, 0.6f);
Assert.notApproximately(1.5f, 1, 0.2f);

Assert should work for objects

Object o = null;
Assert.beNull(o, "it's a null");
Assert.notNull(new Object, "it's not a null");

Assert should work for strings

Assert.equal("abcd", "abcd");
Assert.notEqual("abcd", "abwcd");

Assert.contain("abcd", "bc");
Assert.notContain("abcd", 'e');

Assert.startWith("abcd", "ab");
Assert.notStartWith("abcd", "bc");

Assert.startWith("abcd", 'a');
Assert.notStartWith("abcd", 'b');

Assert.endWith("abcd", "cd");
Assert.notEndWith("abcd", "bc");

Assert.endWith("abcd", 'd');
Assert.notEndWith("abcd", 'c');

Assert should work for ranges

Assert.equal([1, 2, 3], [1, 2, 3]);
Assert.notEqual([1, 2, 3], [1, 1, 3]);

Assert.contain([1, 2, 3], 3);
Assert.notContain([1, 2, 3], [5, 6]);

Assert.containOnly([1, 2, 3], [3, 2, 1]);
Assert.notContainOnly([1, 2, 3], [3, 1]);

Meta