RegressionTests__MemoryTest.st
changeset 216 8db71b19b8a0
child 1159 7f386090c1c4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RegressionTests__MemoryTest.st	Tue Oct 14 17:51:27 2003 +0200
@@ -0,0 +1,85 @@
+"{ Package: 'exept:regression' }"
+
+"{ NameSpace: RegressionTests }"
+
+TestCase subclass:#MemoryTest
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'tests-Regression'
+!
+
+!MemoryTest class methodsFor:'documentation'!
+
+documentation
+"
+    documentation to be added.
+
+    [author:]
+        Michael Beyl (mb@bart)
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+!
+
+history
+    "Created: / 14.10.2003 / 17:53:03 / mb"
+! !
+
+!MemoryTest methodsFor:'initialize / release'!
+
+setUp
+    "common setup - invoked before testing."
+
+    super setUp
+!
+
+tearDown
+    "common cleanup - invoked after testing."
+
+    super tearDown
+! !
+
+!MemoryTest methodsFor:'tests'!
+
+test1
+
+    |x y z|
+    1 to: 100 do: [:rep|
+    x := XML::Element tag:'x'.
+    ObjectMemory garbageCollect.
+
+    x attributes: (Array with: (XML::Attribute name: 'a' value: '1')
+      with: (XML::Attribute name: 'a' value: '1')).
+    1 to: 500 do: [:i |
+      x addNode: (y := XML::Element tag: 'y').
+     y attributes: (Array with: (XML::Attribute name: 'a' value: '1')
+      with: (XML::Attribute name: 'a' value: '1')).
+      1 to: 1000 do: [:j |
+        y addNode: (z := XML::Element tag: 'y').
+     z attributes: (Array with: (XML::Attribute name: 'a' value: '1')
+      with: (XML::Attribute name: 'a' value: '1')).]].
+    ObjectMemory garbageCollect.
+    x nodesDo: [:el |
+     (el isKindOf: XML::Element)
+       ifTrue: [(el attributeNamed:'a')
+        value: ((el valueOfAttribute:'a' ifAbsent:[]) asNumber * 10 / 3 ) asString]
+    ].
+    ]
+
+    "
+     self run:#test1
+     self new test1
+    "
+! !
+
+!MemoryTest class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+! !