Skip to content

Commit

Permalink
remove unnecessary not's
Browse files Browse the repository at this point in the history
  • Loading branch information
vonbecmann committed Sep 3, 2023
1 parent d9a0a25 commit 53fb185
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 19 deletions.
17 changes: 12 additions & 5 deletions repository/LinkedList-Tests/AssociationListTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,18 @@ AssociationListTest >> testAllSatisfy [

| element |
" when all element satisfy the condition, should return true : "
self assert: ( self collectionWithoutNilElements allSatisfy: [:each | (each notNil) ] ).
self assert:
(self collectionWithoutNilElements allSatisfy: [ :each |
each notNil ]).

" when all element don't satisfy the condition, should return false : "
self deny: ( self collectionWithoutNilElements allSatisfy: [:each | (each notNil) not ] ).
self deny: (self collectionWithoutNilElements allSatisfy: [ :each |
each notNil not ]).

" when only one element doesn't satisfy the condition' should return false'"
element := self collectionWithoutNilElements anyOne.
self deny: ( self collectionWithoutNilElements allSatisfy: [:each | (each = element) not] )
self deny: (self collectionWithoutNilElements allSatisfy: [ :each |
each ~= element ])
]

{ #category : #'tests - iterating' }
Expand Down Expand Up @@ -2025,9 +2029,12 @@ AssociationListTest >> testKeysSortedSafely [
AssociationListTest >> testNoneSatisfy [

| element |
self assert: ( self collectionWithoutNilElements noneSatisfy: [:each | each notNil not ] ).
self assert:
(self collectionWithoutNilElements noneSatisfy: [ :each |
each notNil not ]).
element := self collectionWithoutNilElements anyOne.
self deny: ( self collectionWithoutNilElements noneSatisfy: [:each | (each = element)not ] )
self deny: (self collectionWithoutNilElements noneSatisfy: [ :each |
each ~= element ])
]

{ #category : #'tests - iterating' }
Expand Down
17 changes: 12 additions & 5 deletions repository/LinkedList-Tests/DoublyLinkedListTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,18 @@ DoublyLinkedListTest >> testAllSatisfy [

| element |
" when all element satisfy the condition, should return true : "
self assert: ( self collectionWithoutNilElements allSatisfy: [:each | (each notNil) ] ).
self assert:
(self collectionWithoutNilElements allSatisfy: [ :each |
each notNil ]).

" when all element don't satisfy the condition, should return false : "
self deny: ( self collectionWithoutNilElements allSatisfy: [:each | (each notNil) not ] ).
self deny: (self collectionWithoutNilElements allSatisfy: [ :each |
each notNil not ]).

" when only one element doesn't satisfy the condition' should return false'"
element := self collectionWithoutNilElements anyOne.
self deny: ( self collectionWithoutNilElements allSatisfy: [:each | (each = element) not] )
self deny: (self collectionWithoutNilElements allSatisfy: [ :each |
each ~= element ])
]

{ #category : #'tests - iterating' }
Expand Down Expand Up @@ -506,9 +510,12 @@ DoublyLinkedListTest >> testLast03 [
DoublyLinkedListTest >> testNoneSatisfy [

| element |
self assert: ( self collectionWithoutNilElements noneSatisfy: [:each | each notNil not ] ).
self assert:
(self collectionWithoutNilElements noneSatisfy: [ :each |
each notNil not ]).
element := self collectionWithoutNilElements anyOne.
self deny: ( self collectionWithoutNilElements noneSatisfy: [:each | (each = element)not ] )
self deny: (self collectionWithoutNilElements noneSatisfy: [ :each |
each ~= element ])
]

{ #category : #'tests - iterating' }
Expand Down
15 changes: 15 additions & 0 deletions repository/LinkedList-Tests/ManifestLinkedListTests.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
"
Class {
#name : #ManifestLinkedListTests,
#superclass : #PackageManifest,
#category : #'LinkedList-Tests-Manifest'
}

{ #category : #'code-critics' }
ManifestLinkedListTests class >> ruleNotEliminationRuleV1FalsePositive [

<ignoreForCoverage>
^ #(#(#(#RGMethodDefinition #(#DoublyLinkedListTest #testRejectNoReject #false)) #'2023-09-03T12:03:19.48957-03:00') #(#(#RGMethodDefinition #(#DoublyLinkedListTest #testSelect #false)) #'2023-09-03T12:03:19.489147-03:00') #(#(#RGMethodDefinition #(#SinglyLinkedListTest #testReject #false)) #'2023-09-03T12:03:19.489551-03:00') #(#(#RGMethodDefinition #(#SinglyLinkedListTest #testRejectNoReject #false)) #'2023-09-03T12:03:19.489519-03:00') #(#(#RGMethodDefinition #(#DoublyLinkedListTest #testReject #false)) #'2023-09-03T12:03:19.489322-03:00') )
]
31 changes: 22 additions & 9 deletions repository/LinkedList-Tests/SinglyLinkedListTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,18 @@ SinglyLinkedListTest >> testAllSatisfy [

| element |
" when all element satisfy the condition, should return true : "
self assert: ( self collectionWithoutNilElements allSatisfy: [:each | (each notNil) ] ).
self assert:
(self collectionWithoutNilElements allSatisfy: [ :each |
each notNil ]).

" when all element don't satisfy the condition, should return false : "
self deny: ( self collectionWithoutNilElements allSatisfy: [:each | (each notNil) not ] ).
self deny: (self collectionWithoutNilElements allSatisfy: [ :each |
each notNil not ]).

" when only one element doesn't satisfy the condition' should return false'"
element := self collectionWithoutNilElements anyOne.
self deny: ( self collectionWithoutNilElements allSatisfy: [:each | (each = element) not] )
self deny: (self collectionWithoutNilElements allSatisfy: [ :each |
each ~= element ])
]

{ #category : #'tests - iterating' }
Expand Down Expand Up @@ -607,9 +611,12 @@ SinglyLinkedListTest >> testLast03 [
SinglyLinkedListTest >> testNoneSatisfy [

| element |
self assert: ( self collectionWithoutNilElements noneSatisfy: [:each | each notNil not ] ).
self assert:
(self collectionWithoutNilElements noneSatisfy: [ :each |
each notNil not ]).
element := self collectionWithoutNilElements anyOne.
self deny: ( self collectionWithoutNilElements noneSatisfy: [:each | (each = element)not ] )
self deny: (self collectionWithoutNilElements noneSatisfy: [ :each |
each ~= element ])
]

{ #category : #'tests - iterating' }
Expand Down Expand Up @@ -851,12 +858,18 @@ SinglyLinkedListTest >> testSecond03 [
SinglyLinkedListTest >> testSelect [

| result element |
result := self collectionWithoutNilElements select: [ :each | each notNil].
self assert: result size equals: self collectionWithoutNilElements size.
result := self collectionWithoutNilElements select: [ :each |
each notNil ].
self
assert: result size
equals: self collectionWithoutNilElements size.

element := self collectionWithoutNilElements anyOne.
result := self collectionWithoutNilElements select: [ :each | (each = element) not].
self assert: result size equals: (self collectionWithoutNilElements size - 1)
result := self collectionWithoutNilElements select: [ :each |
each ~= element ].
self
assert: result size
equals: self collectionWithoutNilElements size - 1
]

{ #category : #'tests - iterating' }
Expand Down

0 comments on commit 53fb185

Please sign in to comment.