<commit_before>package asunit.framework {
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.errors.IllegalOperationError;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.describeType;
	import flash.utils.getDefinitionByName;
	import flash.utils.setTimeout;
	import flash.utils.Timer;

	import asunit.errors.AssertionFailedError;
	import asunit.util.ArrayIterator;
	import asunit.util.Iterator;

	/**
	 * A test case defines the fixture to run multiple tests. To define a test case<br>
	 * 1) implement a subclass of TestCase<br>
	 * 2) define instance variables that store the state of the fixture<br>
	 * 3) initialize the fixture state by overriding <code>setUp</code><br>
	 * 4) clean-up after a test by overriding <code>tearDown</code>.<br>
	 * Each test runs in its own fixture so there
	 * can be no side effects among test runs.
	 * Here is an example:
	 * <listing>
	 * public class MathTest extends TestCase {
	 *      private var value1:Number;
	 *      private var value2:Number;
	 *
	 *      public function MathTest(methodName:String=null) {
	 *         super(methodName);
	 *      }
	 *
	 *      override protected function setUp():void {
	 *         super.setUp();
	 *         value1 = 2;
	 *         value2 = 3;
	 *      }
	 * }
	 * </listing>
	 *
	 * For each test implement a method which interacts
	 * with the fixture. Verify the expected results with assertions specified
	 * by calling <code>assertTrue</code> with a boolean, or <code>assertEquals</code>
	 * with two primitive values that should match.
	 * <listing>
	 *    public function testAdd():void {
	 *        var result:Number = value1 + value2;
	 *        assertEquals(5, result);
	 *    }
	 * </listing>
	 *
	 *  There are three common types of test cases:
	 *
	 *  <ol>
	 *  <li>Simple unit test</li>
	 *  <li>Visual integration test</li>
	 *  <li>Asynchronous test</li>
	 *  </ol>
	 *
	 *  @includeExample MathUtilTest.as
	 *  @includeExample ComponentTestIntroduction.as
	 *  @includeExample ComponentUnderTest.as
	 *  @includeExample ComponentTestExample.as
	 *  @includeExample AsynchronousTestMethodExample.as
	 */
	public class TestCase extends Assert implements Test {
		protected static const PRE_SET_UP:int        = 0;
		protected static const SET_UP:int             = 1;
		protected static const RUN_METHOD:int         = 2;
		protected static const TEAR_DOWN:int        = 3;
		protected static const DEFAULT_TIMEOUT:int     = 1000;

		protected var context:DisplayObjectContainer;
		protected var fName:String;
		protected var isComplete:Boolean;
		protected var result:TestListener;
		protected var testMethods:Array;
		protected var timer:Timer;

		private var asyncQueue:Array;
		private var currentMethod:String;
		private var currentState:int;
		private var layoutManager:Object;
		private var methodIterator:Iterator;
		private var runSingle:Boolean;

		/**
		 * Constructs a test case with the given name.
		 *
		 * Be sure to implement the constructor in your own TestCase base classes.
		 *
		 * Using the optional <code>testMethod</code> constructor parameter is how we
		 * create and run a single test case and test method.
		 */
		public function TestCase(testMethod:String = null) {
			var description:XML = describeType(this);
			var className:Object = description.@name;
			var methods:XMLList = description..method.(@name.match("^test"));
			if(testMethod != null) {
				testMethods = testMethod.split(", ").join(",").split(",");
				if(testMethods.length == 1) {
					runSingle = true;
				}
			} else {
				setTestMethods(methods);
			}
			setName(className.toString());
			resolveLayoutManager();
			asyncQueue = [];
			timer = new Timer(1, 1);
			timer.addEventListener(TimerEvent.TIMER, onTick);
		}
		
		// Not subscribing runBare() directly because that would require the Test interface to change.
		protected function onTick(e:TimerEvent):void {
			runBare();
		}

		private function resolveLayoutManager():void {<commit_msg>By changing one character, AsUnit's self-test suite runs 33% faster (Timer delay from 1 to 0).<commit_after>package asunit.framework {
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.errors.IllegalOperationError;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.describeType;
	import flash.utils.getDefinitionByName;
	import flash.utils.setTimeout;
	import flash.utils.Timer;

	import asunit.errors.AssertionFailedError;
	import asunit.util.ArrayIterator;
	import asunit.util.Iterator;

	/**
	 * A test case defines the fixture to run multiple tests. To define a test case<br>
	 * 1) implement a subclass of TestCase<br>
	 * 2) define instance variables that store the state of the fixture<br>
	 * 3) initialize the fixture state by overriding <code>setUp</code><br>
	 * 4) clean-up after a test by overriding <code>tearDown</code>.<br>
	 * Each test runs in its own fixture so there
	 * can be no side effects among test runs.
	 * Here is an example:
	 * <listing>
	 * public class MathTest extends TestCase {
	 *      private var value1:Number;
	 *      private var value2:Number;
	 *
	 *      public function MathTest(methodName:String=null) {
	 *         super(methodName);
	 *      }
	 *
	 *      override protected function setUp():void {
	 *         super.setUp();
	 *         value1 = 2;
	 *         value2 = 3;
	 *      }
	 * }
	 * </listing>
	 *
	 * For each test implement a method which interacts
	 * with the fixture. Verify the expected results with assertions specified
	 * by calling <code>assertTrue</code> with a boolean, or <code>assertEquals</code>
	 * with two primitive values that should match.
	 * <listing>
	 *    public function testAdd():void {
	 *        var result:Number = value1 + value2;
	 *        assertEquals(5, result);
	 *    }
	 * </listing>
	 *
	 *  There are three common types of test cases:
	 *
	 *  <ol>
	 *  <li>Simple unit test</li>
	 *  <li>Visual integration test</li>
	 *  <li>Asynchronous test</li>
	 *  </ol>
	 *
	 *  @includeExample MathUtilTest.as
	 *  @includeExample ComponentTestIntroduction.as
	 *  @includeExample ComponentUnderTest.as
	 *  @includeExample ComponentTestExample.as
	 *  @includeExample AsynchronousTestMethodExample.as
	 */
	public class TestCase extends Assert implements Test {
		protected static const PRE_SET_UP:int        = 0;
		protected static const SET_UP:int             = 1;
		protected static const RUN_METHOD:int         = 2;
		protected static const TEAR_DOWN:int        = 3;
		protected static const DEFAULT_TIMEOUT:int     = 1000;

		protected var context:DisplayObjectContainer;
		protected var fName:String;
		protected var isComplete:Boolean;
		protected var result:TestListener;
		protected var testMethods:Array;
		protected var timer:Timer;

		private var asyncQueue:Array;
		private var currentMethod:String;
		private var currentState:int;
		private var layoutManager:Object;
		private var methodIterator:Iterator;
		private var runSingle:Boolean;

		/**
		 * Constructs a test case with the given name.
		 *
		 * Be sure to implement the constructor in your own TestCase base classes.
		 *
		 * Using the optional <code>testMethod</code> constructor parameter is how we
		 * create and run a single test case and test method.
		 */
		public function TestCase(testMethod:String = null) {
			var description:XML = describeType(this);
			var className:Object = description.@name;
			var methods:XMLList = description..method.(@name.match("^test"));
			if(testMethod != null) {
				testMethods = testMethod.split(", ").join(",").split(",");
				if(testMethods.length == 1) {
					runSingle = true;
				}
			} else {
				setTestMethods(methods);
			}
			setName(className.toString());
			resolveLayoutManager();
			asyncQueue = [];
			timer = new Timer(0, 1);
			timer.addEventListener(TimerEvent.TIMER, onTick);
		}
		
		// Not subscribing runBare() directly because that would require the Test interface to change.
		protected function onTick(e:TimerEvent):void {
			runBare();
		}

		private function resolveLayoutManager():void {
{'fraction_non_alphanumeric': 0.09703603492805313, 'fraction_numerical': 0.006395277333661296, 'mean_word_length': 3.4583333333333335, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5432735', 'n_tokens_mistral': 2571, 'n_tokens_neox': 2243, 'n_words': 721}