RegressionTests__MemoryTest.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 2197 8cea1f0db541
child 2473 fcc03fd1f4e4
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding

"{ 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 n1 n2|

    n1 := 10.
    n2 := 500.
    "/ allocates n1*n2*1000 (5mio) nodes with n1*n2*2000 (10mio) attributes...

    n2 := 50.
    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: / 19-12-2018 / 17:05:45 / Claus Gittinger"
    "Modified (format): / 28-03-2019 / 14:03:01 / Claus Gittinger"
! !

!MemoryTest class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !