165 constructor(
string type);
167 constructor(
string type,
string subType);
212 constructor(
auto value) ;
225 constructor(
hash value) ;
252 constructor(
string exceptionType,
string subType) ;
268 string m_exceptionDetail;
276 constructor(
string exceptionType,
string exceptionDetail) ;
293 string m_exceptionRegexp;
297 constructor(
string exceptionType,
string exceptionRegexp) ;
310 constructor(
string exceptionType,
string exceptionSubstring) ;
342 constructor(
string name, code code, *softlist<auto> args);
349 static list<string> getStackList(
list stack,
bool ok =
False);
351 static string getPos(
hash ex);
370 int getAssertionCount();
373 int getAssertionOkCount();
376 int getAssertionSkipCount();
395 const PLAINQUIET = 0;
400 "plainquiet" : PLAINQUIET,
405 const RESULT_TYPE_DESCRIPTION = (
406 TEST_SUCCESS : (
"desc":
"Success",
"junittag" :
NOTHING),
407 TEST_FAILURE : (
"desc":
"FAILURE",
"junittag" :
"failure"),
408 TEST_ERROR : (
"desc":
"ERROR",
"junittag" :
"error"),
409 TEST_SKIPPED : (
"desc":
"Skipped",
"junittag" :
"skipped"),
449 "verbose" :
"v,verbose:i+",
451 "format" :
"format=s",
454 const TEST_SUCCESS = 0;
455 const TEST_FAILURE = 1;
456 const TEST_ERROR = 2;
457 const TEST_SKIPPED = 3;
463 printOption(
string left,
string right,
int offset =
OffsetColumn);
481 processOptions(reference<list<string>> p_argv);
491 constructor(
string name,
string version, *reference<list<string>> p_argv,
hash opts =
Opts);
496 callPrinterFunction(
string type, *softlist<auto> args);
502 printHeader() { callPrinterFunction(
"header"); } printSummary() { callPrinterFunction(
"summary"); } printTestReport(
hash testcase) { callPrinterFunction(
"testreport", testcase); }
503 printPlaintextHeader();
505 printPlaintextSummary();
507 printPlaintextOneTest(
hash testcase);
524 addTestResult(TestCase tc,
int success, *
string error, *
string pos, *
string detail);
564 QUC_GE:
"Greater Than Or Equal To",
566 QUC_LE:
"Less Than Or Equal To",
567 QUC_RE:
"Regular Expression Match",
568 QUC_NRE:
"Negative Regular Expression Match",
576 constructor(
string name,
string version, *reference<list<string>> p_argv, *
hash opts) ;
592 *
string getEnv(
string key, *
string def);
605 addTestCase(
string name, code call, *softlist<auto> args);
619 string escapeSpecialChars(
string str);
621 bool diffInSpecialCharsOnly(
string a,
string b);
626 string shorten(
auto value);
628 compare(
auto v1,
auto v2, reference<list<string>> out,
string path, *
bool soft_comparisons);
630 compareHashes(
hash h1,
hash h2, reference<list<string>> out,
string path =
"", *
bool soft_comparisons);
632 compareLists(list<auto> l1, list<auto> l2, reference<list<string>> out,
string path =
"", *
bool soft_comparisons);
687 assertRegex(
string regex_pattern,
string actual, *
string name);
699 assertNRegex(
string regex_pattern,
string actual, *
string name);
746 assertEq(
auto expected,
auto actual, *
string name);
758 assertNeq(
auto expected,
auto actual, *
string name);
808 assertGt(
auto expected,
auto actual, *
string name);
832 assertGe(
auto expected,
auto actual, *
string name);
856 assertLt(
auto expected,
auto actual, *
string name);
880 assertLe(
auto expected,
auto actual, *
string name);
919 assertThrows(
string expectedErr, *
string expectedDesc, code theCode, *softlist<auto> args, *
string name);
932 assertThrows(
string expectedErr, code theCode, *softlist<auto> args, *
string name);
978 auto testAssertion(
string name, code condition, *softlist<auto> args,
int expectedResultValue);
989 auto testAssertion(
string name, code condition, *softlist<auto> args,
float expectedResultValue);
1000 auto testAssertion(
string name, code condition, *softlist<auto> args,
number expectedResultValue);
1011 auto testAssertion(
string name, code condition, *softlist<auto> args,
bool expectedResultValue);
1022 auto testAssertion(
string name, code condition, *softlist<auto> args,
string expectedResultValue);
1033 auto testAssertion(
string name, code condition, *softlist<auto> args,
date expectedResultValue);
1044 auto testAssertion(
string name, code condition, *softlist<auto> args,
binary expectedResultValue);
1055 auto testAssertion(
string name, code condition, *softlist<auto> args,
hash expectedResultValue);
1066 auto testAssertion(
string name, code condition, *softlist<auto> args,
list expectedResultValue);
1096 bool equals(
auto a,
auto b);
1144 *
string m_testedFile;
1148 static bool instantiated =
False;
1152 constructor(
string name,
string version, *reference<list<string>> p_argv, *
hash opts) ;
1163 Program createInjectedProgram();
1165 abstract performInjections(Program p);
1166 abstract performModuleInjections();
1168 injectIntoModule(
string module);
1177 class QUnit::DependencyInjectedTestRunner :
public QUnit::Test {
1180 setScriptPath(*
string testedFile) {} injectIntoModule(
string module) {}
1181 constructor(
string name,
string version, *reference<list<string>> p_argv, *
hash opts) ;
assertFalse(auto actual, *string name)
Tests a boolean value.
assertNeqSoft(auto expected, auto actual, *string name)
Tests a value for inequality to an expected value with soft comparisons (types may differ) ...
assertionOk(*string name)
process an ok assertion
auto testAssertionValue(*string name, auto actual, auto expected)
Tests a value for equality to an expected value.
Class representing Exception of a particular type with a particular detail message.
Definition: QUnit.qm.dox.h:264
Class representing any non-boolean value.
Definition: QUnit.qm.dox.h:209
string toString()
returns a string describing the exception type
const QUC_GT
greater than comparitor
Definition: QUnit.qm.dox.h:547
string m_name
the name of the test case
Definition: QUnit.qm.dox.h:322
addTestResult(TestCase tc, int success, *string error, *string pos, *string detail)
adds a test result
A class representing a test with injected dependencies.
Definition: QUnit.qm.dox.h:1140
Class representing a partial match of a hash value. Common keys have to be identical.
Definition: QUnit.qm.dox.h:222
tearDown()
Prototype function for cleaning up test environemnt. It will be called after each test has executed...
Definition: QUnit.qm.dox.h:589
const OffsetColumn
the default column offset for printing options used in printOption() and usageIntern() ...
Definition: QUnit.qm.dox.h:413
constructor(string name, string version, *reference< list< string >> p_argv, hash opts=Opts)
creates the object from the arguments
string toString()
returns a string describing the exception type
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:307
assertSkip(*string name)
Skips assertion on purpose.
An abstract class representing test result interface.
Definition: QUnit.qm.dox.h:156
fail(*string msg)
Fails the test unconditionally.
assertLe(auto expected, auto actual, *string name)
Tests that a value is less than or equal to an expected value with hard comparisons (types may not di...
Class representing Exception of a particular type.
Definition: QUnit.qm.dox.h:234
int num_asserts_skip
total number of skipped assertions in script
Definition: QUnit.qm.dox.h:441
auto testAssertion(string name, code condition, *softlist< auto > args, int expectedResultValue)
Tests for a single assertion for a call returning an integer value and returns the value generated...
assertEq(auto expected, auto actual, *string name)
Tests a value for equality to an expected value with hard comparisons (types and values must be ident...
number number(softnumber n)
int num_asserts
number of assertions in current test case
Definition: QUnit.qm.dox.h:331
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...
assertLt(auto expected, auto actual, *string name)
Tests that a value is less than an expected value with hard comparisons (types may not differ) ...
Class representing boolean True.
Definition: QUnit.qm.dox.h:173
assertEqSoft(auto expected, auto actual, *string name)
Tests a value for equality to an expected value with soft comparisons (types may differ) ...
constructor(string name, code code, *softlist< auto > args)
creates the TestCase object from the given arguments
int num_asserts
total number of assertions in script
Definition: QUnit.qm.dox.h:435
Class containing the configuration for a test case.
Definition: QUnit.qm.dox.h:317
string m_exceptionType
corresponds to the "err" key of ExceptionInfo (the first value of a throw statement) ...
Definition: QUnit.qm.dox.h:239
const QUC_RE
regex comparitor
Definition: QUnit.qm.dox.h:555
assertGe(auto expected, auto actual, *string name)
Tests that a value is greater than or equal to an expected value with hard comparisons (types may not...
assertNothing(auto actual, *string name)
Tests for no vlaue.
setUp()
A prototype function.
Definition: QUnit.qm.dox.h:1160
assertNeq(auto expected, auto actual, *string name)
Tests a value for inequality to an expected value with hard comparisons (types and values must be ide...
assertLtSoft(auto expected, auto actual, *string name)
Tests that a value is less than an expected value with soft comparisons (types may differ) ...
the main namespace for all public definitions in the QUnit module
Definition: QUnit.qm.dox.h:153
constructor(string name, string version, *reference< list< string >> p_argv, *hash opts)
creates the object and sets the name of the test
assertLeSoft(auto expected, auto actual, *string name)
Tests that a value is less than or equal to than an expected value with soft comparisons (types may d...
hash m_options
the result of parsing command-line options with Qore::GetOpt::parse2()
Definition: QUnit.qm.dox.h:427
string printUnexpectedData(auto exp, auto act, *bool neg, *bool soft_comparisons, *string comparitor)
Helper function for printing out human-readable comparison of two values.
Base class for collecting test results and reporting.
Definition: QUnit.qm.dox.h:391
int num_asserts_ok
number of successful assertions in current test case
Definition: QUnit.qm.dox.h:334
constructor(string exceptionType, string exceptionDetail)
creates the object from the exception arguments
bool equals(QUnit::AbstractTestResult r)
Equality operator.
assertGt(auto expected, auto actual, *string name)
Tests that a value is greater than an expected value with hard comparisons (types may not differ) ...
constructor(string exceptionType)
creates the object from the exception arguments
addTestCase(string name, code call, *softlist< auto > args)
adds a test case to run
testSkip(string reason)
Skips a given test, eg. because it may be missing some dependencies.
hash m_printMethods
A map of print methods, categorised into three types: header, summary, testreport.
Definition: QUnit.qm.dox.h:416
globalTearDown()
global tear down; will be called once after all tests are run
Definition: QUnit.qm.dox.h:583
assertRegex(string regex_pattern, string actual, *string name)
Tests that a test value passes a regular expression match.
const QUC_GE
greater than or equals comparitor
Definition: QUnit.qm.dox.h:549
bool equals(QUnit::AbstractTestResult r)
Equality operator.
string m_name
test case name
Definition: QUnit.qm.dox.h:430
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.
assertNumberEq(number expected, number actual, number epsilon=DEFAULT_EPSILON, *string name)
Tests a number value for equality to an expected value with an allowed error.
const QUC_LT
greater than comparitor
Definition: QUnit.qm.dox.h:551
int errors()
returns the number of errors encountered during test execution
string getName()
returns the test case name
string m_version
test case version
Definition: QUnit.qm.dox.h:432
const DEFAULT_EPSILON
default epsilon for number/float comparison
Definition: QUnit.qm.dox.h:572
assertFloatEq(float expected, float actual, float epsilon=DEFAULT_EPSILON, *string name)
Tests a float value for equality to an expected value with an allowed error.
string toString()
returns a string describing the exception type
bool notEquals(auto a, auto b)
Compare two values for inequality.
Class representing Exception of a particular type and matching regexp for detail. ...
Definition: QUnit.qm.dox.h:289
assertThrows(string expectedErr, *string expectedDesc, code theCode, *softlist< auto > args, *string name)
Tests that a piece of code throws an exception with given description.
int num_asserts_ok
total number of successful assertions in script
Definition: QUnit.qm.dox.h:438
const QUC_LE
greater than or equals comparitor
Definition: QUnit.qm.dox.h:553
checkException(QUnit::Test test, hash e)
handles exceptions raised while running the TestCase
const QUC_Map
comparitor info
Definition: QUnit.qm.dox.h:560
static string getAssertionName(*string name)
returns the assertion name for display purposes
bool equals(auto a, auto b)
Compare two values for equality.
globalSetUp()
global setup; will be called once before tests are run
Definition: QUnit.qm.dox.h:580
assertGtSoft(auto expected, auto actual, *string name)
Tests that a value is greater than an expected value with soft comparisons (types may differ) ...
int num_asserts_skip
number of skipped assertions in current test case
Definition: QUnit.qm.dox.h:337
bool regexpMatches(string s, string regexp)
Compare a string for match against a regexp.
bool equals(QUnit::AbstractTestResult r)
Equality operator.
setUp()
Prototype function for setting up test environment. It will be called for each test individually...
Definition: QUnit.qm.dox.h:586
assertTrue(auto actual, *string name)
Tests a boolean value.
run(QUnit::Test test)
runs the TestCase
code m_code
the body of the test case
Definition: QUnit.qm.dox.h:325
bool equals(QUnit::AbstractTestResult r)
Equality operator.
Class representing test function failure, both unspecific and with detail.
Definition: QUnit.qm.dox.h:186
testNullAssertion(string name, code condition, *softlist< auto > args)
Tests for a single assertion for a call returning no value (for example, to ensure that the call does...
int skipped()
returns the number of tests skipped
const QUC_NEQ
inequality comparitor
Definition: QUnit.qm.dox.h:545
assertGeSoft(auto expected, auto actual, *string name)
Tests that a value is greater than or equal to than an expected value with soft comparisons (types ma...
bool equals(QUnit::AbstractTestResult r)
Equality operator.
*string getEnv(string key, *string def)
facade for the system environment variables
const QUC_NRE
negative regex comparitor
Definition: QUnit.qm.dox.h:557
const Opts
default options for Qore::GetOpt::constructor()
Definition: QUnit.qm.dox.h:447
list< TestCase > testCases()
list of test cases
rename(string n_name)
renames the test case
*list< auto > m_args
arguments to the above callable object
Definition: QUnit.qm.dox.h:328
int testCount()
returns the total number of test results
string toString()
returns a string describing the exception type
assertNRegex(string regex_pattern, string actual, *string name)
Tests that a test value does not pass a regular expression match.
Base class representing a simple test, implements an implicit main() function and all utility functio...
Definition: QUnit.qm.dox.h:529