[Pkg] The Trunk: System-ul.208.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Dec 28 05:15:56 UTC 2009
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.208.mcz
==================== Summary ====================
Name: System-ul.208
Author: ul
Time: 28 December 2009, 6:13:46 am
UUID: 12d7aab4-724f-e54f-b619-6b1fdc6c1eba
Ancestors: System-ul.207
- new tests and a fix
=============== Diff against System-ul.207 ===============
Item was added:
+ ----- Method: TextDiffBuilderTest>>testIfSequence2 (in category 'tests') -----
+ testIfSequence2
+
+ | patch |
+ patch := self patchSequenceFor: #(a b c d) and: #(c d b a).
+ self assert: patch size = 6. "lcs is cd"
+ self assert: (patch count: [ :each | each key = #match ]) = 2.
+ self assert: (patch count: [ :each | each key = #insert ]) = 2.
+ self assert: (patch count: [ :each | each key = #remove ]) = 2.
+ patch do: [ :each |
+ each key = #match
+ ifTrue: [ self assert: ('cd' includes: each value first) ]
+ ifFalse: [ self assert: ('ab' includes: each value first) ] ]!
Item was changed:
----- Method: TextDiffBuilderTest>>testIfPatchIsMinimal (in category 'tests') -----
testIfPatchIsMinimal
| patch |
patch := self patchSequenceFor: #(a a a b) and: #(a b a a).
+ self assert: patch size = 5. "lcs is aaa"
- self assert: patch size = 5.
self assert: (patch count: [ :each | each key = #match ]) = 3.
self assert: (patch count: [ :each | each key = #insert ]) = 1.
self assert: (patch count: [ :each | each key = #remove ]) = 1.
patch do: [ :each |
each key = #match
+ ifTrue: [ self assert: each value first = $a ]
+ ifFalse: [ self assert: each value first = $b ] ]!
- ifTrue: [ each value beginsWith: 'a' ]
- ifFalse: [ each value beginsWith: 'b' ] ]!
Item was added:
+ ----- Method: TextDiffBuilderTest>>testIfSequence5 (in category 'tests') -----
+ testIfSequence5
+
+ | patch matches nonMatches |
+ patch := self patchSequenceFor: #(a b c d) and: #(c d a b).
+ self assert: patch size = 6. "lcs is ab or cd"
+ matches := (patch select: [ :each | each key = #match ])
+ collect: [ :each | each value first ] as: String.
+ self assert: (#('ab' 'cd') includes: matches).
+ self assert: (patch count: [ :each | each key = #insert ]) = 2.
+ self assert: (patch count: [ :each | each key = #remove ]) = 2.
+ nonMatches := #('ab' 'cd') detect: [ :each | each ~= matches ].
+ patch do: [ :each |
+ each key = #match
+ ifTrue: [ self assert: (matches includes: each value first) ]
+ ifFalse: [ self assert: (nonMatches includes: each value first) ] ]!
Item was added:
+ ----- Method: TextDiffBuilderTest>>testIfSequence3 (in category 'tests') -----
+ testIfSequence3
+
+ | patch |
+ patch := self patchSequenceFor: #(a b c d) and: #(b d c a).
+ self assert: patch size = 6. "lcs is bd"
+ self assert: (patch count: [ :each | each key = #match ]) = 2.
+ self assert: (patch count: [ :each | each key = #insert ]) = 2.
+ self assert: (patch count: [ :each | each key = #remove ]) = 2.
+ patch do: [ :each |
+ each key = #match
+ ifTrue: [ self assert: ('bd' includes: each value first) ]
+ ifFalse: [ self assert: ('ac' includes: each value first) ] ]!
Item was added:
+ ----- Method: TextDiffBuilderTest>>testIfSequence1 (in category 'tests') -----
+ testIfSequence1
+
+ | patch |
+ patch := self patchSequenceFor: #(a b c d) and: #(d c b a).
+ self assert: patch size = 7. "lcs is any one letter sequence"
+ self assert: (patch count: [ :each | each key = #match ]) = 1.
+ self assert: (patch count: [ :each | each key = #insert ]) = 3.
+ self assert: (patch count: [ :each | each key = #remove ]) = 3.
+ patch do: [ :each |
+ each key = #match
+ ifTrue: [ self assert: each value first = $d ]
+ ifFalse: [ self assert: ('abc' includes: each value first) ] ]!
Item was added:
+ ----- Method: TextDiffBuilderTest>>testIfSequence6 (in category 'tests') -----
+ testIfSequence6
+
+ | patch |
+ patch := self patchSequenceFor: #(a b c d) and: #(d a b c).
+ self assert: patch size = 5. "lcs is abc"
+ self assert: (patch count: [ :each | each key = #match ]) = 3.
+ self assert: (patch count: [ :each | each key = #insert ]) = 1.
+ self assert: (patch count: [ :each | each key = #remove ]) = 1.
+ patch do: [ :each |
+ each key = #match
+ ifTrue: [ self assert: ('abc' includes: each value first) ]
+ ifFalse: [ self assert: each value first = $d ] ]!
Item was added:
+ ----- Method: TextDiffBuilderTest>>testIfSequence4 (in category 'tests') -----
+ testIfSequence4
+
+ | patch |
+ patch := self patchSequenceFor: #(a b c d) and: #(d b c a).
+ self assert: patch size = 6. "lcs is bc"
+ self assert: (patch count: [ :each | each key = #match ]) = 2.
+ self assert: (patch count: [ :each | each key = #insert ]) = 2.
+ self assert: (patch count: [ :each | each key = #remove ]) = 2.
+ patch do: [ :each |
+ each key = #match
+ ifTrue: [ self assert: ('bc' includes: each value first) ]
+ ifFalse: [ self assert: ('ad' includes: each value first) ] ]!
More information about the Packages
mailing list