Mark Sibly 7 éve
szülő
commit
b8e99d0443

+ 86 - 0
src/mx2cc/tests/gctest1.monkey2

@@ -0,0 +1,86 @@
+
+Global g:C
+
+Function Test2()
+	
+	g=Null
+End
+
+Class C
+	
+	Field x:Int=-1
+	
+	Method Test()
+
+		Test2()
+		
+		x=100
+		
+		For Local i:=0 Until 10
+			GCCollect()
+			Local t:=New C
+		Next
+		
+		Print x
+	
+	End
+End
+
+Struct S
+	
+	Field c:C
+	
+End
+
+Function Test( c:C )
+	
+	Test2()
+	
+	c.x=100
+	
+	For Local i:=0 Until 10
+		GCCollect()
+		Local t:=New C
+	Next
+	
+	Print c.x
+	
+End
+
+Function Test( s:S )
+	
+	Test2()
+	
+	s.c.x=100
+	
+	For Local i:=0 Until 10
+		GCCollect()
+		Local t:=New C
+	Next
+	
+	Print s.c.x
+	
+End
+
+Function Main()
+	
+	'should print 100 3 times...
+	
+	g=New C
+	
+	Test( g )
+	
+	g=New C
+	
+	g.Test()
+	
+	Local s:S
+	
+	g=New C
+	
+	s.c=g
+	
+	Test( s )
+	
+End
+	

+ 41 - 0
src/mx2cc/tests/gctest2.monkey2

@@ -0,0 +1,41 @@
+
+Class C
+	
+	Method New( str:String )
+	End
+	
+	Method ToString:String()
+		
+		Return "X"
+	End
+	
+End
+
+Class D Extends C
+	
+	
+	Method New( e:E )
+		
+		Super.New( e.c.ToString() )
+	End
+
+End
+
+Class E
+	
+	Field c:C
+End
+
+Function Main()
+	
+	Local c:=New C( "X" )
+	
+	Local e:=New E
+	
+	Local d:=New D( e )
+
+End
+
+
+	
+	

+ 21 - 0
src/mx2cc/tests/gctest3.monkey2

@@ -0,0 +1,21 @@
+
+Class C
+	
+	Method New( arr:Int[] )
+	End
+End
+
+Class D Extends C
+	
+	Method New( arr:Int[] )
+		
+		Super.New( arr )
+	End
+End
+
+Function Main()
+	
+	Local d:=New D( New Int[]( 1,2,3 ) )
+
+End
+