annotate bindings/as3/ext/asunit/textui/TestTime.as @ 765:337e72088f76

Fix for some sample bugs a + b ? c : d does not do what I think it does. That bug mostly masked a thorough logic error in building the table of counts of possible sequences; there was too much cumulativeness. There apparently remain problems
author mas01cr
date Thu, 02 Jun 2011 16:31:35 +0000
parents 3a0b9700b3d2
children
rev   line source
mas01mj@732 1 package asunit.textui
mas01mj@732 2 {
mas01mj@732 3 import asunit.framework.AsynchronousTestCase;
mas01mj@732 4 import asunit.framework.Test;
mas01mj@732 5
mas01mj@732 6 public class TestTime extends Object
mas01mj@732 7 {
mas01mj@732 8 public static function create(test:Test, duration:int):TestTime
mas01mj@732 9 {
mas01mj@732 10 var asyncTest:AsynchronousTestCase = test as AsynchronousTestCase;
mas01mj@732 11 if (asyncTest && asyncTest.remoteDurationIsValid())
mas01mj@732 12 {
mas01mj@732 13 return new AsyncTestTime(asyncTest, duration, PrivateConstructorEnforcer);
mas01mj@732 14 }
mas01mj@732 15 else
mas01mj@732 16 {
mas01mj@732 17 return new TestTime(test, duration, PrivateConstructorEnforcer);
mas01mj@732 18 }
mas01mj@732 19 }
mas01mj@732 20
mas01mj@732 21 private var _name:String;
mas01mj@732 22 private var _duration:int;
mas01mj@732 23 public function get duration():int
mas01mj@732 24 {
mas01mj@732 25 return _duration;
mas01mj@732 26 }
mas01mj@732 27
mas01mj@732 28 public function TestTime(test:Test, duration:int, lock:Class)
mas01mj@732 29 {
mas01mj@732 30 super();
mas01mj@732 31 if (lock != PrivateConstructorEnforcer)
mas01mj@732 32 {
mas01mj@732 33 throw new Error("TestTime: private constructor");
mas01mj@732 34 }
mas01mj@732 35
mas01mj@732 36 _name = test.getName();
mas01mj@732 37 _duration = duration;
mas01mj@732 38 }
mas01mj@732 39
mas01mj@732 40 public function toString():String
mas01mj@732 41 {
mas01mj@732 42 return "" + _duration + 'ms : ' + _name;
mas01mj@732 43 }
mas01mj@732 44
mas01mj@732 45 }
mas01mj@732 46 }
mas01mj@732 47 import asunit.framework.Test;
mas01mj@732 48 import asunit.framework.AsynchronousTestCase;
mas01mj@732 49 import asunit.textui.TestTime;
mas01mj@732 50
mas01mj@732 51
mas01mj@732 52 class AsyncTestTime extends TestTime
mas01mj@732 53 {
mas01mj@732 54 private var _remoteDuration:int;
mas01mj@732 55
mas01mj@732 56 public function AsyncTestTime(test:AsynchronousTestCase, duration:int, lock:Class)
mas01mj@732 57 {
mas01mj@732 58 super(test, duration, lock);
mas01mj@732 59 _remoteDuration = test.remoteDuration;
mas01mj@732 60 }
mas01mj@732 61
mas01mj@732 62 override public function toString():String
mas01mj@732 63 {
mas01mj@732 64 return super.toString() + ' (remote: ' + _remoteDuration + 'ms)';
mas01mj@732 65 }
mas01mj@732 66 }
mas01mj@732 67
mas01mj@732 68 class PrivateConstructorEnforcer {}