testly.bi | |
License | Copyright © 2006-2008 Luis Lavena, Multimedia systems |
ext. Testly | |
Types | |
test_func_t | Function prototype for testcases. |
Enumerations | |
Hook | Used with addSuiteHook to run a procedure on certain events. |
Functions | |
customAssertion | Used by the helper macros below. |
addSuite | Add a test Suite. |
addSuiteHook | Assign a function to run at certain points in the suite. |
addTest | Adds a testcase to the testsuite. |
runTests | Runs the testcases for all registered Suites. |
Macros | |
testly_assert_true | |
testly_assert_true_error | |
testly_assert_false | |
testly_assert_false_error | |
testly_assert_equal | |
testly_assert_equal_error | |
testly_assert_not_equal | |
testly_assert_not_equal_error | |
testly_assert_string_equal | |
testly_assert_string_equal_error | |
testly_assert_string_not_equal | |
testly_assert_string_not_equal_error | |
testly_assert_pass | |
testly_assert_fail | |
testly_assert_error |
Copyright © 2006-2008 Luis Lavena, Multimedia systems
Copyright © 2009, FreeBASIC Extended Library Development Group
Distributed under the FreeBASIC Extended Library Group license. See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License
Types | |
test_func_t | Function prototype for testcases. |
Enumerations | |
Hook | Used with addSuiteHook to run a procedure on certain events. |
Functions | |
customAssertion | Used by the helper macros below. |
addSuite | Add a test Suite. |
addSuiteHook | Assign a function to run at certain points in the suite. |
addTest | Adds a testcase to the testsuite. |
runTests | Runs the testcases for all registered Suites. |
Macros | |
testly_assert_true | |
testly_assert_true_error | |
testly_assert_false | |
testly_assert_false_error | |
testly_assert_equal | |
testly_assert_equal_error | |
testly_assert_not_equal | |
testly_assert_not_equal_error | |
testly_assert_string_equal | |
testly_assert_string_equal_error | |
testly_assert_string_not_equal | |
testly_assert_string_not_equal_error | |
testly_assert_pass | |
testly_assert_fail | |
testly_assert_error |
declare function customAssertion( byval as ext.bool, byref as string, byval as uinteger, byref as string, byval as ext.bool = false ) as ext.bool
Used by the helper macros below. Generally not needed to call directly.
test | boolean value indicating whether assertion was sucessful. |
file | string containing the file the testcase is in. |
line | uinteger containing the line number of the assertion. |
msg | string containing the message to be passed to the user if assertion fails. |
error | boolean value indicating true if there is an error and the suite should stop. defaults to false. |
boolean value indicating false if there is a fatal error. Usually ignored.
declare function addSuiteHook( byval as Hook, byref as sub() ) as ext.bool
Assign a function to run at certain points in the suite.
hooktype | see Hook |
proc | function to run at specified time. |
True if procedure is added.
Function prototype for testcases.
type test_func_t as sub()
Used by the helper macros below.
declare function customAssertion( byval as ext.bool, byref as string, byval as uinteger, byref as string, byval as ext.bool = false ) as ext.bool
Add a test Suite.
declare function addSuite( byref as string ) as ext.bool
Assign a function to run at certain points in the suite.
declare function addSuiteHook( byval as Hook, byref as sub() ) as ext.bool
Adds a testcase to the testsuite.
declare function addTest( byref as string, byref as test_func_t ) as ext.bool
Runs the testcases for all registered Suites.
declare function runTests() as ext.bool
#define testly_assert_true( __value__ ) ext.Testly.customAssertion((__value__) = (true), __FILE__, __LINE__, ("{" #__value__ "} is not true."))
#define testly_assert_true_error( __value__ ) if (ext.Testly.customAssertion((__value__) = (true), __FILE__, __LINE__, ("{" #__value__ "} is not true."), true) = false) then exit sub
#define testly_assert_false( __value__ ) ext.Testly.customAssertion((__value__) = (false), __FILE__, __LINE__, ("{" #__value__ "} is not false."))
#define testly_assert_false_error( __value__ ) if (ext.Testly.customAssertion((__value__) = (false), __FILE__, __LINE__, ("{" #__value__ "} is not false."), true) = false) then exit sub
#define testly_assert_equal( __expected__, __actual__ ) ext.Testly.customAssertion((__actual__) = (__expected__), __FILE__, __LINE__, ("expected {" #__expected__ "} but was {" #__actual__ "}"))
#define testly_assert_equal_error( __expected__, __actual__ ) if (ext.Testly.customAssertion((__actual__) = (__expected__), __FILE__, __LINE__, ("expected {" #__expected__ "} but was {" #__actual__ "}"), true) = false) then exit sub
#define testly_assert_not_equal( __expected__, __actual__ ) ext.Testly.customAssertion((__actual__) <> (__expected__), __FILE__, __LINE__, ("{" #__actual__ "} expected to be != to {" #__expected__ "}"))
#define testly_assert_not_equal_error( __expected__, __actual__ ) if (ext.Testly.customAssertion((__actual__) <> (__expected__), __FILE__, __LINE__, ("{" #__actual__ "} expected to be != to {" #__expected__ "}"), true) = false) then exit sub
#define testly_assert_string_equal( __expected__, __actual__ ) ext.Testly.customAssertion((str(__actual__) = str(__expected__)), __FILE__, __LINE__, ("expected {" #__expected__ "} but was {" #__actual__ "}"))
#define testly_assert_string_equal_error( __expected__, __actual__ ) if (ext.Testly.customAssertion((str(__actual__) = str(__expected__)), __FILE__, __LINE__, ("expected {" #__expected__ "} but was {" #__actual__ "}"), true) = false) then exit sub
#define testly_assert_string_not_equal( __expected__, __actual__ ) ext.Testly.customAssertion((str(__actual__) <> str(__expected__)), __FILE__, __LINE__, ("{" #__actual__ "} expected to be != to {" #__expected__ "}"))
#define testly_assert_string_not_equal_error( __expected__, __actual__ ) if (ext.Testly.customAssertion((str(__actual__) <> str(__expected__)), __FILE__, __LINE__, ("{" #__actual__ "} expected to be != to {" #__expected__ "}"), true) = false) then exit sub
#define testly_assert_pass( __message__ ) ext.Testly.customAssertion((true), __FILE__, __LINE__, __message__)
#define testly_assert_fail( __message__ ) ext.Testly.customAssertion((false), __FILE__, __LINE__, __message__)
#define testly_assert_error( __message__ ) if (ext.Testly.customAssertion((false), __FILE__, __LINE__, __message__, true) = false) then exit sub