RegressionTests__MemoryTest.st
author Stefan Vogel <sv@exept.de>
Mon, 30 Jul 2018 09:32:41 +0200
changeset 1995 bb6692faf0a6
parent 1984 e4e870c69bf6
child 2071 a9413374d9ff
permissions -rw-r--r--
#DOCUMENTATION by stefan class: RegressionTests::Helper class comment/format in: #isStcCompiledMethod:in: #isStcCompiledMethod:inClass:

"{ Encoding: utf8 }"

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#MemoryTest
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression-RuntimeSystem'
!

!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."

    (Smalltalk classNamed:'stx_goodies_xml_vw') isNil ifTrue:[
        (Smalltalk loadPackage:'stx:goodies/xml/vw') ifFalse:[
            self error:'stx:goodies/xml/vw cannot be loaded'.
        ].
    ].
    (Smalltalk classNamed:'stx_goodies_xml_vw') load.

    "Created: / 31-07-2017 / 15:12:57 / mawalch"
! !

!MemoryTest methodsFor:'tests'!

test1
    "cg: whoever wrote this test:
         please add some comment on what is actually tested"
    
    |x y z|

    1 to:10 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"

    "Modified: / 03-07-2018 / 11:20:36 / Claus Gittinger"
! !

!MemoryTest class methodsFor:'documentation'!

version
    ^ '$Header$'
! !