RegressionTests__DictionaryTest.st
branchjv
changeset 1500 d406a10b2965
parent 1499 26a16a04219b
parent 1447 2351db93aa5b
child 1544 657989d600f7
equal deleted inserted replaced
1499:26a16a04219b 1500:d406a10b2965
    12 
    12 
    13 !DictionaryTest methodsFor:'testing'!
    13 !DictionaryTest methodsFor:'testing'!
    14 
    14 
    15 testAddAll
    15 testAddAll
    16 	"(self run: #testAddAll)"
    16 	"(self run: #testAddAll)"
    17 	
    17 
    18 	| dict1 dict2 |
    18 	| dict1 dict2 |
    19 	dict1 := Dictionary new.
    19 	dict1 := Dictionary new.
    20 	dict1 at: #a put:1 ; at: #b put: 2. 
    20 	dict1 at: #a put:1 ; at: #b put: 2.
    21 	dict2 := Dictionary new.
    21 	dict2 := Dictionary new.
    22 	dict2 at: #a put: 3 ; at: #c put: 4.
    22 	dict2 at: #a put: 3 ; at: #c put: 4.
    23 	dict1 addAll: dict2.
    23 	dict1 addAll: dict2.
    24 	self assert: (dict1 at: #a) = 3.
    24 	self assert: (dict1 at: #a) = 3.
    25 	self assert: (dict1 at: #b) = 2.
    25 	self assert: (dict1 at: #b) = 2.
    49 	self should: [answer size == 0]
    49 	self should: [answer size == 0]
    50 !
    50 !
    51 
    51 
    52 testComma
    52 testComma
    53 	"(self run: #testComma)"
    53 	"(self run: #testComma)"
    54 	
    54 
    55 	| dict1 dict2 dict3 |
    55 	| dict1 dict2 dict3 |
    56 	dict1 := Dictionary new.
    56 	dict1 := Dictionary new.
    57 	dict1 at: #a put:1 ; at: #b put: 2. 
    57 	dict1 at: #a put:1 ; at: #b put: 2.
    58 	dict2 := Dictionary new.
    58 	dict2 := Dictionary new.
    59 	dict2 at: #a put: 3 ; at: #c put: 4.
    59 	dict2 at: #a put: 3 ; at: #c put: 4.
    60 	dict3 := dict1, dict2.
    60 	dict3 := dict1, dict2.
    61 	self assert: (dict3 at: #a) = 3.
    61 	self assert: (dict3 at: #a) = 3.
    62 	self assert: (dict3 at: #b) = 2.
    62 	self assert: (dict3 at: #b) = 2.
    65 
    65 
    66 testIncludesAssociation
    66 testIncludesAssociation
    67 	"self debug: #testIncludesAssociation"
    67 	"self debug: #testIncludesAssociation"
    68 
    68 
    69 	| d |
    69 	| d |
    70 	d := Dictionary new 
    70 	d := Dictionary new
    71 		at: #five put: 5; 
    71 		at: #five put: 5;
    72 		at: #givemefive put: 5;
    72 		at: #givemefive put: 5;
    73 		at: #six put: 6;
    73 		at: #six put: 6;
    74 		yourself.
    74 		yourself.
    75 		
    75 
    76 	self assert: (d includesAssociation: (d associationAt: #five)).
    76 	self assert: (d includesAssociation: (d associationAt: #five)).
    77 	self assert: (d includesAssociation: (#five -> 5)).
    77 	self assert: (d includesAssociation: (#five -> 5)).
    78 	self assert: (d includesAssociation: (#five -> 6)) not.
    78 	self assert: (d includesAssociation: (#five -> 6)) not.
    79 ! !
    79 ! !
    80 
    80