test.js | |
bbop.test | A trivial testing framework for JS. |
Functions | |
test | Contructor for the BBOP JS unit test system. |
report | Print a report about what happened during the tests. |
is_same_atom | Test whether two atoms are the same. |
is_different_atom | A negative version of is_same_atom. |
is_defined | Test whether a value is defined. |
is_not_defined | A negative version of is_defined. |
is_true | Test whether a value is true. |
is_false | A negative version of is_true. |
is_x_greater_than_y | Test whether one value is greate than another. |
is_same_url | Test whether two links are functionally equivalent. |
is_different_url | A negative version of is_same_url. |
is_same_set | Test whether two sets (as atomic arrays) are the same. |
is_different_set | A negative version of is_same_set. |
is_same_hash | Test whether two simple atomic hashes are the same. |
is_different_hash | A negative version of is_same_hash. |
is_in_list | Test whether an item is in a list (array). |
is_not_in_list | A negative version of is_in_list. |
is_in_list_diy | A DIY version of is_in_list. |
is_not_in_list_diy | A negative version of is_in_list_diy. |
is_string_embedded | Test whether a target string (target_str) can be made by embedding a string (added_str) into a base string (base_str). |
is_string_not_embedded | A negative version of is_string_embedded. |
pass | Always return test as true--useful when testing using control structures and the like. |
fail | Always return test as false--useful when testing using control structures and the like. |
A trivial testing framework for JS. See test.tests.js for usage.
Note: this cannot depend on core.js (it tests that), so some stuff may be duped. On the other hand, we can test ourselves--see test.js.tests.
Functions | |
test | Contructor for the BBOP JS unit test system. |
report | Print a report about what happened during the tests. |
is_same_atom | Test whether two atoms are the same. |
is_different_atom | A negative version of is_same_atom. |
is_defined | Test whether a value is defined. |
is_not_defined | A negative version of is_defined. |
is_true | Test whether a value is true. |
is_false | A negative version of is_true. |
is_x_greater_than_y | Test whether one value is greate than another. |
is_same_url | Test whether two links are functionally equivalent. |
is_different_url | A negative version of is_same_url. |
is_same_set | Test whether two sets (as atomic arrays) are the same. |
is_different_set | A negative version of is_same_set. |
is_same_hash | Test whether two simple atomic hashes are the same. |
is_different_hash | A negative version of is_same_hash. |
is_in_list | Test whether an item is in a list (array). |
is_not_in_list | A negative version of is_in_list. |
is_in_list_diy | A DIY version of is_in_list. |
is_not_in_list_diy | A negative version of is_in_list_diy. |
is_string_embedded | Test whether a target string (target_str) can be made by embedding a string (added_str) into a base string (base_str). |
is_string_not_embedded | A negative version of is_string_embedded. |
pass | Always return test as true--useful when testing using control structures and the like. |
fail | Always return test as false--useful when testing using control structures and the like. |
this.is_different_atom = function( question, answer, msg )
A negative version of is_same_atom.
question | the atom to test |
answer | the unexpected atom |
msg | [optional] informational message about test |
n/a
this.is_not_defined = function( thing, msg )
A negative version of is_defined.
thing | the value to test for being undefined |
msg | [optional] informational message about test |
n/a
this.is_false = function( bool, msg )
A negative version of is_true.
bool | the variable to test |
msg | [optional] informational message about test |
n/a
this.is_different_url = function( link1, link2, msg )
A negative version of is_same_url.
link1 | url |
link2 | url |
msg | [optional] informational message about test |
n/a
this.is_different_set = function( set1, set2, msg )
A negative version of is_same_set.
set1 | set (as array) |
set2 | set (as array) |
msg | [optional] informational message about test |
n/a
this.is_different_hash = function( hash1, hash2, msg )
A negative version of is_same_hash.
hash1 | hash |
hash2 | hash |
msg | [optional] informational message about test |
n/a
this.is_not_in_list = function( item, list, msg )
A negative version of is_in_list.
item | the value to test |
list | the array to test in |
msg | [optional] informational message about test |
n/a
this.is_in_list_diy = function( item, list, comp, msg )
A DIY version of is_in_list. In this case, you can pass your own comparison function to check the item against the list.
item | the value to test |
list | the array to test in |
comp | the comparison function; like: function(in_item, list_item){...} |
msg | [optional] informational message about test |
n/a
this.is_not_in_list_diy = function( item, list, comp, msg )
A negative version of is_in_list_diy.
item | the value to test |
list | the array to test in |
comp | the comparison function; like: function(in_item, list_item){...} |
msg | [optional] informational message about test |
n/a
this.is_string_embedded = function( target_str, base_str, added_str, msg )
Test whether a target string (target_str) can be made by embedding a string (added_str) into a base string (base_str).
Useful in certain cases when checking URLs.
target_str | the value to test |
base_str | the expected value |
added_str | the expected value |
msg | [optional] informational message about test |
n/a
this.is_string_not_embedded = function( target_str, base_str, added_str, msg )
A negative version of is_string_embedded.
target_str | the value to test |
base_str | the expected value |
added_str | the expected value |
msg | [optional] informational message about test |
n/a
Contructor for the BBOP JS unit test system.
bbop.test = function()
Print a report about what happened during the tests.
this.report = function()
A negative version of is_same_atom.
this.is_different_atom = function( question, answer, msg )
Test whether a value is defined.
this.is_defined = function( thing, msg )
A negative version of is_defined.
this.is_not_defined = function( thing, msg )
Test whether a value is true.
this.is_true = function( bool, msg )
A negative version of is_true.
this.is_false = function( bool, msg )
Test whether one value is greate than another.
this.is_x_greater_than_y = function( x_thing, y_thing, msg )
Test whether two links are functionally equivalent.
this.is_same_url = function( link1, link2, msg )
A negative version of is_same_url.
this.is_different_url = function( link1, link2, msg )
Test whether two sets (as atomic arrays) are the same.
this.is_same_set = function( set1, set2, msg )
A negative version of is_same_set.
this.is_different_set = function( set1, set2, msg )
Test whether two simple atomic hashes are the same.
this.is_same_hash = function( hash1, hash2, msg )
A negative version of is_same_hash.
this.is_different_hash = function( hash1, hash2, msg )
Test whether an item is in a list (array).
this.is_in_list = function( item, list, msg )
A negative version of is_in_list.
this.is_not_in_list = function( item, list, msg )
A DIY version of is_in_list.
this.is_in_list_diy = function( item, list, comp, msg )
A negative version of is_in_list_diy.
this.is_not_in_list_diy = function( item, list, comp, msg )
Test whether a target string (target_str) can be made by embedding a string (added_str) into a base string (base_str).
this.is_string_embedded = function( target_str, base_str, added_str, msg )
A negative version of is_string_embedded.
this.is_string_not_embedded = function( target_str, base_str, added_str, msg )
Always return test as true--useful when testing using control structures and the like.
this.pass = function( msg )
Always return test as false--useful when testing using control structures and the like.
this.fail = function( msg )