blob: 4be402bb910e860dd3b9942e7aa2454fc15af6d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/**
* TestCase
*
* Embryonic unit test support class.
* Copyright (c) 2007 Henri Torgemane
*
* See LICENSE.txt for full license information.
*/
package com.hurlant.crypto.tests
{
public class TestCase
{
public var harness:ITestHarness;
public function TestCase(h:ITestHarness, title:String) {
harness = h;
harness.beginTestCase(title);
}
public function assert(msg:String, value:Boolean):void {
if (value) {
// TestHarness.print("+ ",msg);
return;
}
throw new Error("Test Failure:"+msg);
}
public function runTest(f:Function, title:String):void {
harness.beginTest(title);
try {
f();
} catch (e:Error) {
trace("EXCEPTION THROWN: "+e);
trace(e.getStackTrace());
harness.failTest(e.toString());
return;
}
harness.passTest();
}
}
}
|