init
	Test.init( ref args )
	Test.add_func( "/FunctionalTests/Genie/Objects/Events/DeprecatedSyntax/01", event1 )
	Test.add_func( "/FunctionalTests/Genie/Objects/Events/DeprecatedSyntax/02", event2 )
	Test.add_func( "/FunctionalTests/Genie/Objects/Events/DeprecatedSyntax/03", event3 )
	Test.add_func( "/FunctionalTests/Genie/Objects/Events/DeprecatedSyntax/04", event4 )
	Test.add_func( "/FunctionalTests/Genie/Objects/Events/DeprecatedSyntax/05", event5 )
	Test.add_func( "/FunctionalTests/Genie/Objects/Events/DeprecatedSyntax/06", event6 )
	Test.run()

// Event with single function attached
def event1()
	var test1 = new Test1()
	test1.test_event += test_function1
	test1.test_event( 6 )

class Test1:Object
	event test_event ( a:int )

def test_function1( result:int )
	assert( result == 6 )

// Event with single function attached and updating a context variable
def event2()
	var test2_1 = new Test2_1()
	var test2_2 = new Test2_2()
	test2_1.test_event += test2_2.listener
	test2_1.test_event( 1 )
	test2_1.test_event( 2 )
	test2_1.test_event( 3 )
	assert( test2_2.result == 6 )

class Test2_1:Object
	event test_event ( a:int )

class Test2_2:Object
	result:int = 0
	def listener( x:int )
		result += x

// Event with two functions attached and updating context variables
def event3()
	var test3_1 = new Test3_1()
	var test3_2 = new Test3_2()
	var test3_3 = new Test3_3()
	test3_1.test_event += test3_2.listener
	test3_1.test_event += test3_3.listener
	test3_1.test_event( 1 )
	test3_1.test_event( 2 )
	test3_1.test_event( 3 )
	assert( test3_2.result == 6 )
	assert( test3_3.result == 12 )

class Test3_1:Object
	event test_event ( a:int )

class Test3_2:Object
	result:int = 0
	def listener( x:int )
		result += x

class Test3_3:Object
	result:int = 0
	def listener( x:int )
		result += 2 * x

// Event with single anonymous function attached
def event4()
	var test4 = new Test4()
	test4.test_event += def( x )
		assert( x == 6 )
	test4.test_event( 6 )

class Test4:Object
	event test_event ( a:int )

// Event with single anonymous function attached and updating context variable
def event5()
	var test5 = new Test5()
	result:int = 0 
	test5.test_event += def( x )
		result += x
	test_process5( test5 )
	assert( result == 6 )

class Test5:Object
	event test_event ( a:int )

def test_process5( test_object5:Test5 )
	test_object5.test_event( 1 )
	test_object5.test_event( 2 )
	test_object5.test_event( 3 )

// Event with two anonymous functions attached and updating context variables
def event6()
	var test6_1 = new Test6_1()
	var test6_2 = new Test6_2()
	var test6_3 = new Test6_3()
	test6_1.test_event += def( x )
		test6_2.result += x
	test6_1.test_event += def( x )
		test6_3.result += x
	test_process6( test6_1 )
	assert( test6_2.result == "abc" )
	assert( test6_3.result == "abc" )

class Test6_1:Object
	event test_event ( a:string )

class Test6_2:Object
	result:string = ""

class Test6_3:Object
	result:string = ""

def test_process6( test_object6:Test6_1 )
	test_object6.test_event( "a" )
	test_object6.test_event( "b" )
	test_object6.test_event( "c" )
