xUnit Tests
component labels="disk,os" extends="testbox.system.BaseSpec" {
/*********************************** LIFE CYCLE Methods ***********************************/
function beforeTests(){
application.salvador = 1;
}
function afterTests(){
structClear( application );
}
function setup(){
request.foo = 1;
}
function teardown(){
structDelete( request, "foo" );
}
/*********************************** Test Methods ***********************************/
function testFloatingPointNumberAddition() output="false"{
var sum = 196.4 + 196.4 + 180.8 + 196.4 + 196.4 + 180.8 + 609.6;
// sum.toString() outputs: 1756.8000000000002
// debug( sum );
// $assert.isEqual( sum, 1756.8 );
}
function testIncludes(){
$assert.includes( "hello", "HE" );
$assert.includes( [ "Monday", "Tuesday" ], "monday" );
}
function testIncludesWithCase(){
$assert.includesWithCase( "hello", "he" );
$assert.includesWithCase( [ "Monday", "Tuesday" ], "Monday" );
}
function testnotIncludesWithCase(){
$assert.notincludesWithCase( "hello", "aa" );
$assert.notincludesWithCase( [ "Monday", "Tuesday" ], "monday" );
}
function testNotIncludes(){
$assert.notIncludes( "hello", "what" );
$assert.notIncludes( [ "Monday", "Tuesday" ], "Friday" );
}
function testIsEmpty(){
$assert.isEmpty( [] );
$assert.isEmpty( {} );
$assert.isEmpty( "" );
$assert.isEmpty( queryNew( "" ) );
}
function testIsNotEmpty(){
$assert.isNotEmpty( [ 1, 2 ] );
$assert.isNotEmpty( { name : "luis" } );
$assert.isNotEmpty( "HelloLuis" );
$assert.isNotEmpty(
querySim(
"id, name
1 | luis"
)
);
}
function testSkipped() skip{
$assert.fail( "This Test should fail" );
}Last updated
Was this helpful?