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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
     1
"{ Encoding: utf8 }"
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
     2
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
     3
"{ Package: 'stx:goodies/regression' }"
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     4
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     5
"{ NameSpace: RegressionTests }"
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     6
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     7
TestCase subclass:#MemoryTest
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     8
	instanceVariableNames:''
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     9
	classVariableNames:''
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    10
	poolDictionaries:''
1159
7f386090c1c4 category changes
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    11
	category:'tests-Regression-RuntimeSystem'
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    12
!
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    13
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    14
!MemoryTest class methodsFor:'documentation'!
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    15
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    16
documentation
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    17
"
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    18
    documentation to be added.
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    19
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    20
    [author:]
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
    21
	Michael Beyl (mb@bart)
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    22
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    23
    [instance variables:]
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    24
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    25
    [class variables:]
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    26
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    27
    [see also:]
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    28
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    29
"
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    30
!
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    31
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    32
history
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    33
    "Created: / 14.10.2003 / 17:53:03 / mb"
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    34
! !
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    35
1663
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    36
!MemoryTest methodsFor:'initialize / release'!
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    37
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    38
setUp
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    39
    "common setup - invoked before testing."
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    40
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    41
    (Smalltalk classNamed:'stx_goodies_xml_vw') isNil ifTrue:[
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    42
        (Smalltalk loadPackage:'stx:goodies/xml/vw') ifFalse:[
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    43
            self error:'stx:goodies/xml/vw cannot be loaded'.
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    44
        ].
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    45
    ].
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    46
    (Smalltalk classNamed:'stx_goodies_xml_vw') load.
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    47
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    48
    "Created: / 31-07-2017 / 15:12:57 / mawalch"
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    49
! !
17100e1e5ddb #BUGFIX by mawalch
mawalch
parents: 1447
diff changeset
    50
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    51
!MemoryTest methodsFor:'tests'!
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    52
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    53
test1
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
    54
    "cg: whoever wrote this test:
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    55
         please add some comment on what is actually tested"
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    56
    
2071
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    57
    |x y z n1 n2|
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    58
2071
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    59
    n1 := 10.
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    60
    n2 := 500.
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    61
    "/ allocates n1*n2*1000 (5mio) nodes with n1*n2*2000 (10mio) attributes...
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    62
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    63
    n2 := 50.
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    64
    1 to:10 do:[:rep | 
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    65
        x := XML::Element tag:'x'.
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    66
        ObjectMemory garbageCollect.
2197
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    67
        x attributes:(Array 
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    68
                        with:(XML::Attribute name:'a' value:'1')
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    69
                        with:(XML::Attribute name:'a' value:'1')).
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    70
        1 to:500 do:[:i | 
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    71
            x addNode:(y := XML::Element tag:'y').
2197
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    72
            y attributes:(Array 
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    73
                            with:(XML::Attribute name:'a' value:'1')
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    74
                            with:(XML::Attribute name:'a' value:'1')).
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    75
            1 to:1000 do:[:j | 
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    76
                y addNode:(z := XML::Element tag:'y').
2197
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    77
                z attributes:(Array 
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    78
                                with:(XML::Attribute name:'a' value:'1')
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    79
                                with:(XML::Attribute name:'a' value:'1')).
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    80
            ]
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    81
        ].
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    82
        ObjectMemory garbageCollect.
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    83
        x 
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    84
            nodesDo:[:el | 
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    85
                (el isKindOf:XML::Element) ifTrue:[
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    86
                    (el attributeNamed:'a') 
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    87
                        value:((el valueOfAttribute:'a' ifAbsent:[]) asNumber * (10/3)) asString
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    88
                ]
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    89
            ].
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    90
    ]
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    91
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    92
    "
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    93
     self run:#test1
1984
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    94
     self new test1"
e4e870c69bf6 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    95
2071
a9413374d9ff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
    96
    "Modified: / 19-12-2018 / 17:05:45 / Claus Gittinger"
2197
8cea1f0db541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
    97
    "Modified (format): / 28-03-2019 / 14:03:01 / Claus Gittinger"
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    98
! !
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    99
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   100
!MemoryTest class methodsFor:'documentation'!
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   101
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   102
version
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   103
    ^ '$Header$'
2072
c5dcfd2a1d07 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   104
!
c5dcfd2a1d07 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   105
c5dcfd2a1d07 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   106
version_CVS
c5dcfd2a1d07 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2071
diff changeset
   107
    ^ '$Header$'
216
8db71b19b8a0 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   108
! !
1159
7f386090c1c4 category changes
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   109