~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
/* <license>
 * This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
 * For full copyright and license information please refer to doc/license.txt.
 * </license> 
 */

class DynamicFloatMultiply  extends haxe.unit.TestCase
{
	public function testList()
	{
		var list : Array<Dynamic> = [ 0.5 ];
		assertEquals( 0.5, list[0] );
		assertEquals( 50.0, list[0] * 100.0 );	//this fails, thus a simplified test case
	}
	
	public function testMultiply()
	{
		var dyn : Dynamic = { direct: 0.5, list: [ {value: 0.5} ], dyn: { value: 0.5 } };
		
		//these both work
		assertEquals( 0.5, dyn.direct );
		assertEquals( 50.0, dyn.direct * 100 );
		
		//these also work
		assertEquals( 0.5, dyn.dyn.value );
		assertEquals( 50.0, dyn.dyn.value * 100 );
		
		assertEquals( 0.5, dyn.list[0].value ); //this works
		assertEquals( 50.0, dyn.list[0].value * 100 );	//this fails, result is "0" not "50"
	}
}