RegressionTests__DeepCopyTests.st
author Claus Gittinger <cg@exept.de>
Mon, 03 Feb 2003 09:45:57 +0100
changeset 181 a56517005229
parent 158 0d741c461dfc
child 963 50736877d51d
permissions -rw-r--r--
category change
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
114
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
     1
"{ Package: 'exept:regression' }"
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
     2
158
0d741c461dfc moved to namespace
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
     3
"{ NameSpace: RegressionTests }"
0d741c461dfc moved to namespace
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
     4
114
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
     5
TestCase subclass:#DeepCopyTests
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
     6
	instanceVariableNames:''
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
     7
	classVariableNames:''
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
     8
	poolDictionaries:''
181
a56517005229 category change
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
     9
	category:'tests-Regression'
114
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    10
!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    11
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    12
!DeepCopyTests class methodsFor:'documentation'!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    13
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    14
documentation
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    15
"
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    16
    documentation to be added.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    17
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    18
    [author:]
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    19
         (james@miraculix)
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    20
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    21
    [see also:]
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    22
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    23
    [instance variables:]
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    24
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    25
    [class variables:]
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    26
"
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    27
!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    28
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    29
history
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    30
    "Created: / 25.10.2001 / 11:32:08 / james"
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    31
! !
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    32
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    33
!DeepCopyTests methodsFor:'tests'!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    34
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    35
testCopyTwoLevel
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    36
    |original copy elL1 elL2 elL3 copyOfElL1|
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    37
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    38
    original := Array new:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    39
    original at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    40
    original at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    41
    original at:3 put:(elL1 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    42
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    43
    elL1 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    44
    elL1 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    45
    elL1 at:3 put:(elL2 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    46
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    47
    elL2 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    48
    elL2 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    49
    elL2 at:3 put:(elL3 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    50
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    51
    elL3 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    52
    elL3 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    53
    elL3 at:3 put:(Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    54
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    55
    copy := original copyTwoLevel.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    56
    self assert:( (original at:2) ~~ (copy at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    57
    self assert:( (original at:3) ~~ (copy at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    58
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    59
    copyOfElL1 := copy at:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    60
    self assert:( (elL1 at:2) == (copyOfElL1 at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    61
    self assert:( (elL1 at:3) == (copyOfElL1 at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    62
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    63
    "
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    64
     self basicNew testCopyTwoLevel
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    65
    "
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    66
!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    67
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    68
testToLevel2
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    69
     |original copy elL1 elL2 elL3 copyOfElL1|
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    70
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    71
     original := Array new:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    72
     original at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    73
     original at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    74
     original at:3 put:(elL1 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    75
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    76
     elL1 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    77
     elL1 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    78
     elL1 at:3 put:(elL2 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    79
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    80
     elL2 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    81
     elL2 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    82
     elL2 at:3 put:(elL3 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    83
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    84
     elL3 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    85
     elL3 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    86
     elL3 at:3 put:(Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    87
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    88
     copy := original copyToLevel:2.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    89
     self assert:( (original at:2) ~~ (copy at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    90
     self assert:( (original at:3) ~~ (copy at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    91
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    92
     copyOfElL1 := copy at:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    93
     self assert:( (elL1 at:2) == (copyOfElL1 at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    94
     self assert:( (elL1 at:3) == (copyOfElL1 at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    95
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    96
    "
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    97
     self basicNew testToLevel2
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    98
    "
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
    99
!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   100
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   101
testToLevel3
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   102
     |original copy elL1 elL2 elL3 copyOfElL1 copyOfElL2|
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   103
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   104
     original := Array new:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   105
     original at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   106
     original at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   107
     original at:3 put:(elL1 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   108
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   109
     elL1 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   110
     elL1 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   111
     elL1 at:3 put:(elL2 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   112
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   113
     elL2 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   114
     elL2 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   115
     elL2 at:3 put:(elL3 := Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   116
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   117
     elL3 at:1 put:1234.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   118
     elL3 at:2 put:'hello'.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   119
     elL3 at:3 put:(Array new:3).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   120
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   121
     copy := original copyToLevel:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   122
     self assert:( (original at:2) ~~ (copy at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   123
     self assert:( (original at:3) ~~ (copy at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   124
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   125
     copyOfElL1 := copy at:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   126
     self assert:( (elL1 at:2) ~~ (copyOfElL1 at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   127
     self assert:( (elL1 at:3) ~~ (copyOfElL1 at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   128
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   129
     copyOfElL2 := copyOfElL1 at:3.
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   130
     self assert:( (elL2 at:2) == (copyOfElL2 at:2) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   131
     self assert:( (elL2 at:3) == (copyOfElL2 at:3) ).
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   132
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   133
    "
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   134
     self basicNew testToLevel3
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   135
    "
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   136
! !
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   137
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   138
!DeepCopyTests class methodsFor:'documentation'!
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   139
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   140
version
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   141
    ^ '$Header$'
4bc8e8c6c4fc initial checkin
james
parents:
diff changeset
   142
! !