~eda-qa/dhlib/main

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
43
44
45
46
47
48
49
/* <license>
 * This file is part of the dis-Emi-A HaXe Library. Copyright (c) edA-qa mort-ora-y
 * For full copyright and license information please refer to doc/license.txt.
 * </license> 
 */
import flash.utils.Dictionary;
import flash.display.Sprite;

class DictionaryTest  extends haxe.unit.TestCase
{
	var dict : Dictionary;
	var item : Sprite;
	
	public function testMain()
	{
		setup();
		add();
		list();
	}
	
	override function setup()
	{
		dict = new Dictionary( true );
		item = new flash.display.Sprite();
	}
	
	function add()
	{
		untyped dict[item] = true;
		untyped dict[new Sprite()] = true;
		untyped dict[new Sprite()] = true;
	}
	
	function getkeys() : Iterable<Dynamic>
	{
		return untyped __keys__(dict);
	}
	
	function getiter() : Iterator<Dynamic>
	{
		return getkeys().iterator();
	}
	
	function list()
	{		
		for( i in getiter() )
			assertTrue( Std.is( i, flash.display.Sprite ) );
	}
}