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