1447
|
1 |
"{ Package: 'stx:goodies/regression' }"
|
216
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
TestCase subclass:#MemoryTest
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
1159
|
9 |
category:'tests-Regression-RuntimeSystem'
|
216
|
10 |
!
|
|
11 |
|
|
12 |
!MemoryTest class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
1447
|
19 |
Michael Beyl (mb@bart)
|
216
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
history
|
|
31 |
"Created: / 14.10.2003 / 17:53:03 / mb"
|
|
32 |
! !
|
|
33 |
|
1663
|
34 |
!MemoryTest methodsFor:'initialize / release'!
|
|
35 |
|
|
36 |
setUp
|
|
37 |
"common setup - invoked before testing."
|
|
38 |
|
|
39 |
(Smalltalk classNamed:'stx_goodies_xml_vw') isNil ifTrue:[
|
|
40 |
(Smalltalk loadPackage:'stx:goodies/xml/vw') ifFalse:[
|
|
41 |
self error:'stx:goodies/xml/vw cannot be loaded'.
|
|
42 |
].
|
|
43 |
].
|
|
44 |
(Smalltalk classNamed:'stx_goodies_xml_vw') load.
|
|
45 |
|
|
46 |
"Created: / 31-07-2017 / 15:12:57 / mawalch"
|
|
47 |
! !
|
|
48 |
|
216
|
49 |
!MemoryTest methodsFor:'tests'!
|
|
50 |
|
|
51 |
test1
|
1447
|
52 |
"cg: whoever wrote this test:
|
|
53 |
please add some comment on what is actually tested"
|
216
|
54 |
|
|
55 |
|x y z|
|
|
56 |
1 to: 100 do: [:rep|
|
|
57 |
x := XML::Element tag:'x'.
|
|
58 |
ObjectMemory garbageCollect.
|
|
59 |
|
|
60 |
x attributes: (Array with: (XML::Attribute name: 'a' value: '1')
|
|
61 |
with: (XML::Attribute name: 'a' value: '1')).
|
|
62 |
1 to: 500 do: [:i |
|
|
63 |
x addNode: (y := XML::Element tag: 'y').
|
|
64 |
y attributes: (Array with: (XML::Attribute name: 'a' value: '1')
|
|
65 |
with: (XML::Attribute name: 'a' value: '1')).
|
|
66 |
1 to: 1000 do: [:j |
|
1447
|
67 |
y addNode: (z := XML::Element tag: 'y').
|
216
|
68 |
z attributes: (Array with: (XML::Attribute name: 'a' value: '1')
|
|
69 |
with: (XML::Attribute name: 'a' value: '1')).]].
|
|
70 |
ObjectMemory garbageCollect.
|
|
71 |
x nodesDo: [:el |
|
|
72 |
(el isKindOf: XML::Element)
|
|
73 |
ifTrue: [(el attributeNamed:'a')
|
1447
|
74 |
value: ((el valueOfAttribute:'a' ifAbsent:[]) asNumber * 10 / 3 ) asString]
|
216
|
75 |
].
|
|
76 |
]
|
|
77 |
|
|
78 |
"
|
|
79 |
self run:#test1
|
|
80 |
self new test1
|
|
81 |
"
|
|
82 |
! !
|
|
83 |
|
|
84 |
!MemoryTest class methodsFor:'documentation'!
|
|
85 |
|
|
86 |
version
|
|
87 |
^ '$Header$'
|
|
88 |
! !
|
1159
|
89 |
|