test.js

Summary
test.js
bbop.testA trivial testing framework for JS.
Functions
testContructor for the BBOP JS unit test system.
reportPrint a report about what happened during the tests.
is_same_atomTest whether two atoms are the same.
is_different_atomA negative version of is_same_atom.
is_definedTest whether a value is defined.
is_not_definedA negative version of is_defined.
is_trueTest whether a value is true.
is_falseA negative version of is_true.
is_x_greater_than_yTest whether one value is greate than another.
is_same_urlTest whether two links are functionally equivalent.
is_different_urlA negative version of is_same_url.
is_same_setTest whether two sets (as atomic arrays) are the same.
is_different_setA negative version of is_same_set.
is_same_hashTest whether two simple atomic hashes are the same.
is_different_hashA negative version of is_same_hash.
is_in_listTest whether an item is in a list (array).
is_not_in_listA negative version of is_in_list.
is_in_list_diyA DIY version of is_in_list.
is_not_in_list_diyA negative version of is_in_list_diy.
is_string_embeddedTest whether a target string (target_str) can be made by embedding a string (added_str) into a base string (base_str).
is_string_not_embeddedA negative version of is_string_embedded.
passAlways return test as true--useful when testing using control structures and the like.
failAlways return test as false--useful when testing using control structures and the like.

bbop.test

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.

Summary
Functions
testContructor for the BBOP JS unit test system.
reportPrint a report about what happened during the tests.
is_same_atomTest whether two atoms are the same.
is_different_atomA negative version of is_same_atom.
is_definedTest whether a value is defined.
is_not_definedA negative version of is_defined.
is_trueTest whether a value is true.
is_falseA negative version of is_true.
is_x_greater_than_yTest whether one value is greate than another.
is_same_urlTest whether two links are functionally equivalent.
is_different_urlA negative version of is_same_url.
is_same_setTest whether two sets (as atomic arrays) are the same.
is_different_setA negative version of is_same_set.
is_same_hashTest whether two simple atomic hashes are the same.
is_different_hashA negative version of is_same_hash.
is_in_listTest whether an item is in a list (array).
is_not_in_listA negative version of is_in_list.
is_in_list_diyA DIY version of is_in_list.
is_not_in_list_diyA negative version of is_in_list_diy.
is_string_embeddedTest whether a target string (target_str) can be made by embedding a string (added_str) into a base string (base_str).
is_string_not_embeddedA negative version of is_string_embedded.
passAlways return test as true--useful when testing using control structures and the like.
failAlways return test as false--useful when testing using control structures and the like.

Functions

test

bbop.test = function()

Contructor for the BBOP JS unit test system.

Arguments

n/a

Returns

BBOP test suite object

report

this.report = function()

Print a report about what happened during the tests.

Parameters

n/a

Returns

n/a; but prints the report as a side-effect

is_same_atom

Test whether two atoms are the same.

Parameters

questionthe atom to test
answerthe expected atom
msg[optional] informational message about test

Returns

n/a

is_different_atom

this.is_different_atom = function(question,
answer,
msg)

A negative version of is_same_atom.

Parameters

questionthe atom to test
answerthe unexpected atom
msg[optional] informational message about test

Returns

n/a

is_defined

this.is_defined = function(thing,
msg)

Test whether a value is defined.

Parameters

thingthe value to test for being defined
msg[optional] informational message about test

Returns

n/a

is_not_defined

this.is_not_defined = function(thing,
msg)

A negative version of is_defined.

Parameters

thingthe value to test for being undefined
msg[optional] informational message about test

Returns

n/a

is_true

this.is_true = function(bool,
msg)

Test whether a value is true.

Parameters

boolthe variable to test
msg[optional] informational message about test

Returns

n/a

is_false

this.is_false = function(bool,
msg)

A negative version of is_true.

Parameters

boolthe variable to test
msg[optional] informational message about test

Returns

n/a

is_x_greater_than_y

this.is_x_greater_than_y = function(x_thing,
y_thing,
msg)

Test whether one value is greate than another.  Uses the standard “>” operator.

Parameters

x_thingthe expected greater value
y_thingthe expected lesser value
msg[optional] informational message about test

Returns

n/a

is_same_url

this.is_same_url = function(link1,
link2,
msg)

Test whether two links are functionally equivalent.

Parameters

link1url
link2url
msg[optional] informational message about test

Returns

n/a

is_different_url

this.is_different_url = function(link1,
link2,
msg)

A negative version of is_same_url.

Parameters

link1url
link2url
msg[optional] informational message about test

Returns

n/a

is_same_set

this.is_same_set = function(set1,
set2,
msg)

Test whether two sets (as atomic arrays) are the same.

Parameters

set1set (as array)
set2set (as array)
msg[optional] informational message about test

Returns

n/a

is_different_set

this.is_different_set = function(set1,
set2,
msg)

A negative version of is_same_set.

Parameters

set1set (as array)
set2set (as array)
msg[optional] informational message about test

Returns

n/a

is_same_hash

this.is_same_hash = function(hash1,
hash2,
msg)

Test whether two simple atomic hashes are the same.

Parameters

hash1hash
hash2hash
msg[optional] informational message about test

Returns

n/a

is_different_hash

this.is_different_hash = function(hash1,
hash2,
msg)

A negative version of is_same_hash.

Parameters

hash1hash
hash2hash
msg[optional] informational message about test

Returns

n/a

is_in_list

this.is_in_list = function(item,
list,
msg)

Test whether an item is in a list (array).

Parameters

itemthe value to test
listthe array to test in
msg[optional] informational message about test

Returns

n/a

is_not_in_list

this.is_not_in_list = function(item,
list,
msg)

A negative version of is_in_list.

Parameters

itemthe value to test
listthe array to test in
msg[optional] informational message about test

Returns

n/a

is_in_list_diy

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.

Parameters

itemthe value to test
listthe array to test in
compthe comparison function; like: function(in_item, list_item){...}
msg[optional] informational message about test

Returns

n/a

is_not_in_list_diy

this.is_not_in_list_diy = function(item,
list,
comp,
msg)

A negative version of is_in_list_diy.

Parameters

itemthe value to test
listthe array to test in
compthe comparison function; like: function(in_item, list_item){...}
msg[optional] informational message about test

Returns

n/a

is_string_embedded

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.

Parameters

target_strthe value to test
base_strthe expected value
added_strthe expected value
msg[optional] informational message about test

Returns

n/a

is_string_not_embedded

this.is_string_not_embedded = function(target_str,
base_str,
added_str,
msg)

A negative version of is_string_embedded.

Parameters

target_strthe value to test
base_strthe expected value
added_strthe expected value
msg[optional] informational message about test

Returns

n/a

pass

this.pass = function(msg)

Always return test as true--useful when testing using control structures and the like.

Parameters

msg[optional] informational message about test

Returns

n/a

fail

this.fail = function(msg)

Always return test as false--useful when testing using control structures and the like.

Parameters

msg[optional] informational message about test

Returns

n/a

bbop.test = function()
Contructor for the BBOP JS unit test system.
this.report = function()
Print a report about what happened during the tests.
this.is_different_atom = function(question,
answer,
msg)
A negative version of is_same_atom.
Test whether two atoms are the same.
this.is_defined = function(thing,
msg)
Test whether a value is defined.
this.is_not_defined = function(thing,
msg)
A negative version of is_defined.
this.is_true = function(bool,
msg)
Test whether a value is true.
this.is_false = function(bool,
msg)
A negative version of is_true.
this.is_x_greater_than_y = function(x_thing,
y_thing,
msg)
Test whether one value is greate than another.
this.is_same_url = function(link1,
link2,
msg)
Test whether two links are functionally equivalent.
this.is_different_url = function(link1,
link2,
msg)
A negative version of is_same_url.
this.is_same_set = function(set1,
set2,
msg)
Test whether two sets (as atomic arrays) are the same.
this.is_different_set = function(set1,
set2,
msg)
A negative version of is_same_set.
this.is_same_hash = function(hash1,
hash2,
msg)
Test whether two simple atomic hashes are the same.
this.is_different_hash = function(hash1,
hash2,
msg)
A negative version of is_same_hash.
this.is_in_list = function(item,
list,
msg)
Test whether an item is in a list (array).
this.is_not_in_list = function(item,
list,
msg)
A negative version of is_in_list.
this.is_in_list_diy = function(item,
list,
comp,
msg)
A DIY version of is_in_list.
this.is_not_in_list_diy = function(item,
list,
comp,
msg)
A negative version of is_in_list_diy.
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).
this.is_string_not_embedded = function(target_str,
base_str,
added_str,
msg)
A negative version of is_string_embedded.
this.pass = function(msg)
Always return test as true--useful when testing using control structures and the like.
this.fail = function(msg)
Always return test as false--useful when testing using control structures and the like.
Close