-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
127 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package | ||
{ | ||
import com.humboldtjs.events.HJSEvent; | ||
import com.humboldtjs.hjsunit.UITestRunner; | ||
import com.humboldtjs.system.Application; | ||
|
||
import tests.SampleTestSuite; | ||
|
||
[Application] | ||
public class HumboldtJSTest extends Application | ||
{ | ||
public function HumboldtJSTest() | ||
{ | ||
super(); | ||
} | ||
|
||
override protected function initialize():void | ||
{ | ||
super.initialize(); | ||
|
||
var theTestRunner:UITestRunner = new UITestRunner(); | ||
|
||
addChild(theTestRunner.getUI()); | ||
theTestRunner.addEventListener(HJSEvent.COMPLETE, onComplete); | ||
theTestRunner.run(new SampleTestSuite()); | ||
} | ||
|
||
protected function onComplete(aEvent:HJSEvent):void | ||
{ | ||
aEvent.getCurrentTarget().removeEventListener(HJSEvent.COMPLETE, onComplete); | ||
// done | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package tests | ||
{ | ||
import com.humboldtjs.hjsunit.Test; | ||
import com.humboldtjs.hjsunit.TestCase; | ||
|
||
import dom.window; | ||
|
||
public class SampleTestCase extends TestCase | ||
{ | ||
public function SampleTestCase() | ||
{ | ||
super(); | ||
|
||
setName("Sample tests"); | ||
addTestMethod(new Test("Test integer math", testIntegerMath, true)); | ||
addTestMethod(new Test("Test floating point math", testFloatMath)); | ||
} | ||
|
||
override protected function setup():void | ||
{ | ||
// setup anything needed to run the test | ||
// if this should happen asynchronous call setSetupAsync(true) | ||
// in the constructor, and call _assert.done() when the setup | ||
// is complete | ||
|
||
_assert.message("Setting up tests"); | ||
} | ||
|
||
public function testIntegerMath():void | ||
{ | ||
var i:int = 5; | ||
_assert.equals(5, i); | ||
i += 4; | ||
_assert.equals(9, i); | ||
|
||
window.setTimeout(testIntegerMathComplete, 1000); | ||
} | ||
|
||
public function testIntegerMathComplete():void | ||
{ | ||
_assert.done(); | ||
} | ||
|
||
public function testFloatMath():void | ||
{ | ||
var i:Number = 5; | ||
_assert.equals(5, i); | ||
i += 4.5; | ||
_assert.equals(9.5, i); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package tests | ||
{ | ||
import com.humboldtjs.hjsunit.TestSuite; | ||
|
||
|
||
public class SampleTestSuite extends TestSuite | ||
{ | ||
public function SampleTestSuite() | ||
{ | ||
super(); | ||
|
||
setName("A sample test-suite"); | ||
addTest(new SampleTestCase()); | ||
} | ||
} | ||
} |