A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ct.355.mcz ==================== Summary ==================== Name: CollectionsTests-ct.355 Author: ct Time: 13 April 2021, 7:38:02.054492 pm UUID: 5d57fca7-6372-9c47-8c19-2cad3062c0de Ancestors: CollectionsTests-nice.354 Tests SequenceableCollection >> #indexOf:[startingAt:][ifPresent:][ifAbsent:]. Depends on Collections-ct.936. =============== Diff against CollectionsTests-nice.354 =============== Item was added: + ----- Method: SequenceableCollectionTest>>testIndexOf (in category 'tests - accessing') ----- + testIndexOf + + | values | + values := #(2 3 5 7 9). + + self assert: 2 equals: (values indexOf: 3). + self assert: 3 equals: (values indexOf: 5). + + self assert: 0 equals: (values indexOf: 1).! Item was added: + ----- Method: SequenceableCollectionTest>>testIndexOfIfAbsent (in category 'tests - accessing') ----- + testIndexOfIfAbsent + + | values | + values := #(2 3 5 7 9). + + self assert: 2 equals: (values indexOf: 3 ifAbsent: [self fail]). + self assert: 3 equals: (values indexOf: 5 ifAbsent: [self fail]). + + self assert: #notFound equals: (values indexOf: 1 ifAbsent: [#notFound]).! Item was added: + ----- Method: SequenceableCollectionTest>>testIndexOfIfPresent (in category 'tests - accessing') ----- + testIndexOfIfPresent + + | values | + values := #(2 3 5 7 9). + + self assert: 2 negated equals: (values indexOf: 3 ifPresent: [:index | index negated]). + self assert: 3 negated equals: (values indexOf: 5 ifPresent: #negated). + + self assert: 0 equals: (values indexOf: 1 ifPresent: [:index | self fail]).! Item was added: + ----- Method: SequenceableCollectionTest>>testIndexOfStartingAtIfAbsent (in category 'tests - accessing') ----- + testIndexOfStartingAtIfAbsent + + | values | + values := #(2 3 5 7 9). + + self assert: 3 equals: (values indexOf: 5 startingAt: 2 ifAbsent: [self fail]). + self assert: 3 equals: (values indexOf: 5 startingAt: 3 ifAbsent: [self fail]). + + self assert: #notFound equals: (values indexOf: 5 startingAt: 4 ifAbsent: [#notFound]).! Item was added: + ----- Method: SequenceableCollectionTest>>testIndexOfStartingAtIfPresent (in category 'tests - accessing') ----- + testIndexOfStartingAtIfPresent + + | values | + values := #(2 3 5 7 9). + + self assert: 3 negated equals: (values indexOf: 5 startingAt: 2 ifPresent: [:index | index negated]). + self assert: 3 negated equals: (values indexOf: 5 startingAt: 3 ifPresent: #negated). + + self assert: 0 equals: (values indexOf: 5 startingAt: 4 ifPresent: [self fail]).! Item was added: + ----- Method: SequenceableCollectionTest>>testIndexOfStartingAtIfPresentIfAsbent (in category 'tests - accessing') ----- + testIndexOfStartingAtIfPresentIfAsbent + + | values | + values := #(2 3 5 7 9). + + self assert: 3 negated equals: (values indexOf: 5 startingAt: 2 ifPresent: [:index | index negated] ifAbsent: [self fail]). + self assert: 3 negated equals: (values indexOf: 5 startingAt: 3 ifPresent: #negated ifAbsent: [self fail]). + + self assert: #notFound equals: (values indexOf: 5 startingAt: 4 ifPresent: [self fail] ifAbsent: [#notFound]).! |
Free forum by Nabble | Edit this page |