60 constructor(
string type);
62 constructor(
string type,
string subType);
66 abstract public string toString();
80 public string toString();
105 public string toString();
113 constructor(any value) ;
120 public string toString();
128 constructor(
hash value) ;
134 public string toString();
155 private constructor(
string exceptionType,
string subType) ;
172 string m_exceptionDetail;
180 constructor(
string exceptionType,
string exceptionDetail) ;
199 string m_exceptionRegexp;
203 constructor(
string exceptionType,
string exceptionRegexp) ;
218 constructor(
string exceptionType,
string exceptionSubstring) ;
251 constructor(
string name, code code, *softlist args);
258 static *
string getStackPos(
list stack);
260 static string getPos(
hash ex);
279 int getAssertionCount();
282 int getAssertionOkCount();
285 int getAssertionSkipCount();
304 const PLAINQUIET = 0;
309 "plainquiet" : PLAINQUIET,
314 const RESULT_TYPE_DESCRIPTION = (
315 TEST_SUCCESS : (
"desc":
"Success",
"junittag" :
NOTHING),
316 TEST_FAILURE : (
"desc":
"FAILURE",
"junittag" :
"failure"),
317 TEST_ERROR : (
"desc":
"ERROR",
"junittag" :
"error"),
318 TEST_SKIPPED : (
"desc":
"Skipped",
"junittag" :
"skipped"),
358 "verbose" :
"v,verbose:i+",
360 "format" :
"format=s",
363 const TEST_SUCCESS = 0;
364 const TEST_FAILURE = 1;
365 const TEST_ERROR = 2;
366 const TEST_SKIPPED = 3;
370 private printOption(
string left,
string right,
int offset =
OffsetColumn);
379 private processOptions(reference p_argv);
391 private callPrinterFunction(
string type, *softlist args);
394 private printHeader() { callPrinterFunction(
"header"); }
395 private printSummary() { callPrinterFunction(
"summary"); }
396 private printTestReport(
hash testcase) { callPrinterFunction(
"testreport", testcase); }
398 private printPlaintextHeader();
401 private printPlaintextSummary();
404 private printPlaintextOneTest(
hash testcase);
407 private printJunitSummary();
423 addTestResult(TestCase tc,
int success, *
string error, *
string pos, *
string detail);
441 constructor(
string name,
string version, *reference p_argv, *
hash opts) ;
457 *
string getEnv(
string key, *
string def);
470 addTestCase(
string name, code call, *softlist args);
488 private string shorten(any value);
491 private compare(any v1, any v2, reference out,
string path, *
bool soft_comparisons);
494 private compareHashes(
hash h1,
hash h2, reference out,
string path =
"", *
bool soft_comparisons);
497 private compareLists(
list l1,
list l2, reference out,
string path =
"", *
bool soft_comparisons);
529 public assertEqSoft(any expected, any actual, *
string name);
542 public assertEq(any expected, any actual, *
string name);
556 public assertFloatEq(
float expected,
float actual,
float epsilon = 0.0000000001, *
string name);
608 public assertThrows(
string expectedErr, *
string expectedDesc, code theCode, *softlist args, *
string name);
621 public assertThrows(
string expectedErr, code theCode, *softlist args, *
string name);
648 public fail(*
string msg);
671 public any
testAssertion(
string name, code condition, *softlist args,
int expectedResultValue);
683 public any
testAssertion(
string name, code condition, *softlist args,
float expectedResultValue);
695 public any
testAssertion(
string name, code condition, *softlist args,
number expectedResultValue);
707 public any
testAssertion(
string name, code condition, *softlist args,
bool expectedResultValue);
719 public any
testAssertion(
string name, code condition, *softlist args,
string expectedResultValue);
731 public any
testAssertion(
string name, code condition, *softlist args,
date expectedResultValue);
743 public any
testAssertion(
string name, code condition, *softlist args,
binary expectedResultValue);
755 public any
testAssertion(
string name, code condition, *softlist args,
hash expectedResultValue);
767 public any
testAssertion(
string name, code condition, *softlist args,
list expectedResultValue);
801 bool equals(any a, any b);
849 *
string m_testedFile;
853 static bool instantiated =
False;
857 constructor(
string name,
string version, *reference p_argv, *
hash opts) ;
868 private Program createInjectedProgram();
871 abstract performInjections(Program p);
872 abstract performModuleInjections();
874 private injectIntoModule(
string module);
884 class QUnit::DependencyInjectedTestRunner :
public QUnit::Test {
887 public setScriptPath(*
string testedFile) {}
888 private injectIntoModule(
string module) {}
890 constructor(
string name,
string version, *reference p_argv, *
hash opts) ;
public string toString()
returns a string describing the exception type
Class representing Exception of a particular type with a particular detail message.
Definition: QUnit.qm.dox.h:168
public assertEqSoft(any expected, any actual, *string name)
Tests a value for equality to an expected value with soft comparisons (types may differ) ...
Class representing any non-boolean value.
Definition: QUnit.qm.dox.h:110
string m_name
the name of the test case
Definition: QUnit.qm.dox.h:231
addTestResult(TestCase tc, int success, *string error, *string pos, *string detail)
adds a test result
public bool equals(QUnit::AbstractTestResult r)
Equality operator.
A class representing a test with injected dependencies.
Definition: QUnit.qm.dox.h:845
Class representing a partial match of a hash value. Common keys have to be identical.
Definition: QUnit.qm.dox.h:125
tearDown()
Prototype function for cleaning up test environemnt. It will be called after each test has executed...
Definition: QUnit.qm.dox.h:454
const OffsetColumn
the default column offset for printing options used in printOption() and usageIntern() ...
Definition: QUnit.qm.dox.h:322
public assertTrue(any actual, *string name)
Tests a boolean value.
public testNullAssertion(string name, code condition, *softlist args)
Tests for a single assertion for a call returning no value (for example, to ensure that the call does...
public bool equals(QUnit::AbstractTestResult r)
Equality operator.
TestCase getTestCase(string meth)
returns the current test case
Class representing Exception of a particular type and substring for detail.
Definition: QUnit.qm.dox.h:215
public bool equals(QUnit::AbstractTestResult r)
Equality operator.
constructor(string name, string version, *reference p_argv, hash opts=Opts)
creates the object from the arguments
An abstract class representing test result interface.
Definition: QUnit.qm.dox.h:51
Class representing Exception of a particular type.
Definition: QUnit.qm.dox.h:139
int num_asserts_skip
total number of skipped assertions in script
Definition: QUnit.qm.dox.h:350
public bool equals(QUnit::AbstractTestResult r)
Equality operator.
number number(softnumber n)
public assertSkip(*string name)
Skips assertion on purpose.
int num_asserts
number of assertions in current test case
Definition: QUnit.qm.dox.h:240
constructor()
Instantiate an unspecific failure, no detail.
setScriptPath(*string testedFile)
A helper function. It must be called once for a new instance with get_script_path() as argument...
Class representing boolean True.
Definition: QUnit.qm.dox.h:70
public string toString()
returns a string describing the exception type
bool equals(any a, any b)
Compare two values for equality.
int num_asserts
total number of assertions in script
Definition: QUnit.qm.dox.h:344
public any testAssertionValue(*string name, any actual, any expected)
Tests a value for equality to an expected value.
Class containing the configuration for a test case.
Definition: QUnit.qm.dox.h:226
string m_exceptionType
corresponds to the "err" key of an exception hash (the first value of a throw statement) ...
Definition: QUnit.qm.dox.h:144
setUp()
A prototype function.
Definition: QUnit.qm.dox.h:865
the main namespace for all public definitions in the QUnit module
Definition: QUnit.qm.dox.h:48
public any testAssertion(string name, code condition, *softlist args, int expectedResultValue)
Tests for a single assertion for a call returning an integer value and returns the value generated...
public string toString()
returns a string describing the exception type
hash m_options
the result of parsing command-line options with Qore::GetOpt::parse2()
Definition: QUnit.qm.dox.h:336
Base class for collecting test results and reporting.
Definition: QUnit.qm.dox.h:300
int num_asserts_ok
number of successful assertions in current test case
Definition: QUnit.qm.dox.h:243
constructor(string exceptionType, string exceptionDetail)
creates the object from the exception arguments
constructor(string exceptionType)
creates the object from the exception arguments
private string printUnexpectedData(any exp, any act, *bool neg, *bool soft_comparisons)
Helper function for printing out human-readable comparison of two values.
public assertEq(any expected, any actual, *string name)
Tests a value for equality to an expected value with hard comparisons (types and values must be ident...
constructor(string name, string version, *reference p_argv, *hash opts)
creates the object and sets the name of the test
hash m_printMethods
A map of print methods, categorised into three types: header, summary, testreport.
Definition: QUnit.qm.dox.h:325
globalTearDown()
global tear down; will be called once after all tests are run
Definition: QUnit.qm.dox.h:448
public assertNumberEq(number expected, number actual, number epsilon=0.0000000001, *string name)
Tests a number value for equality to an expected value with an allowed error.
string m_name
test case name
Definition: QUnit.qm.dox.h:339
public string toString()
returns a string describing the exception type
int main()
Run the whole suite, report results.
bool equalsIterated(AbstractIterator a, AbstractIterator b)
Compare two iterables, item by item, for equality of each index.
addTestCase(string name, code call, *softlist args)
adds a test case to run
int errors()
returns the number of errors encountered during test execution
public assertFalse(any actual, *string name)
Tests a boolean value.
string getName()
returns the test case name
string m_version
test case version
Definition: QUnit.qm.dox.h:341
public bool equals(QUnit::AbstractTestResult r)
Equality operator.
Class representing Exception of a particular type and matching regexp for detail. ...
Definition: QUnit.qm.dox.h:195
int num_asserts_ok
total number of successful assertions in script
Definition: QUnit.qm.dox.h:347
checkException(QUnit::Test test, hash e)
handles exceptions raised while running the TestCase
static string getAssertionName(*string name)
returns the assertion name for display purposes
public fail(*string msg)
Fails the test unconditionally.
globalSetUp()
global setup; will be called once before tests are run
Definition: QUnit.qm.dox.h:445
int num_asserts_skip
number of skipped assertions in current test case
Definition: QUnit.qm.dox.h:246
bool regexpMatches(string s, string regexp)
Compare a string for match against a regexp.
bool notEquals(any a, any b)
Compare two values for inequality.
setUp()
Prototype function for setting up test environment. It will be called for each test individually...
Definition: QUnit.qm.dox.h:451
list testCases
list of test cases
Definition: QUnit.qm.dox.h:433
*list m_args
arguments to the above callable object
Definition: QUnit.qm.dox.h:237
run(QUnit::Test test)
runs the TestCase
constructor(string name, code code, *softlist args)
creates the TestCase object from the given arguments
public bool equals(QUnit::AbstractTestResult r)
Equality operator.
code m_code
the body of the test case
Definition: QUnit.qm.dox.h:234
public assertFloatEq(float expected, float actual, float epsilon=0.0000000001, *string name)
Tests a float value for equality to an expected value with an allowed error.
Class representing test function failure, both unspecific and with detail.
Definition: QUnit.qm.dox.h:85
int skipped()
returns the number of tests skipped
*string getEnv(string key, *string def)
facade for the system environment variables
const Opts
default options for Qore::GetOpt::constructor()
Definition: QUnit.qm.dox.h:356
rename(string n_name)
renames the test case
public testSkip(string reason)
Skips a given test, eg. because it may be missing some dependencies.
int testCount()
returns the total number of test results
public assertThrows(string expectedErr, *string expectedDesc, code theCode, *softlist args, *string name)
Tests that a piece of code throws an exception with given description.
Base class representing a simple test, implements an implicit main() function and all utility functio...
Definition: QUnit.qm.dox.h:428