Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BitmapCharacterSetTest>>#assertSet:copiedFrom:equals: should use isNotNil #9

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
Unit tests for BitmapCharacterSet
"
Class {
#name : #BitmapCharacterSetTest,
#superclass : #TestCase,
#name : 'BitmapCharacterSetTest',
#superclass : 'TestCase',
#instVars : [
'characters'
],
#category : #'Collections-BitmapCharacterSet-Tests-Base'
#category : 'Collections-BitmapCharacterSet-Tests-Base',
#package : 'Collections-BitmapCharacterSet-Tests',
#tag : 'Base'
}

{ #category : #enumerating }
{ #category : 'enumerating' }
BitmapCharacterSetTest >> absentCharactersDo: aBlock [
| previousValue |

Expand All @@ -24,22 +26,22 @@ BitmapCharacterSetTest >> absentCharactersDo: aBlock [
aBlock value: i asCharacter].
]

{ #category : #asserting }
{ #category : 'asserting' }
BitmapCharacterSetTest >> assertSet: aFirstSet copiedFrom: aSecondSet equals: aThirdSet [

self
deny: aFirstSet identicalTo: aSecondSet;
deny: aFirstSet byteCharacters
identicalTo: aSecondSet byteCharacters.
(aFirstSet wideCharacters notNil or: [
aSecondSet wideCharacters notNil ]) ifTrue: [
(aFirstSet wideCharacters isNotNil or: [
aSecondSet wideCharacters isNotNil ]) ifTrue: [
self
deny: aFirstSet wideCharacters
identicalTo: aSecondSet wideCharacters ].
self assert: aFirstSet equals: aThirdSet
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> characters [

^ characters
Expand All @@ -60,54 +62,54 @@ BitmapCharacterSetTest >> characters [
characters := writeStream contents]
]

{ #category : #enumerating }
{ #category : 'enumerating' }
BitmapCharacterSetTest >> charactersDo: aBlock [
self characters do: aBlock
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> emptySet [

^ self setClass new
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> lastCodePoint [

^ 16r10FFFF
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> nonEmptySet [

^ self setClass newFrom: self characters
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> rangeCharacters [

^ 'abcdefghijklmnopqrstuvwxyz'
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> rangeStart [

^ self rangeCharacters first
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> rangeStop [

^ self rangeCharacters last
]

{ #category : #accessing }
{ #category : 'accessing' }
BitmapCharacterSetTest >> setClass [

^ BitmapCharacterSet
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testAdd [

| set |
Expand All @@ -121,7 +123,7 @@ BitmapCharacterSetTest >> testAdd [
assert: (set includes: each) ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testAddRangeFromTo [

| set |
Expand All @@ -142,7 +144,7 @@ BitmapCharacterSetTest >> testAddRangeFromTo [
assert: set equals: (self setClass with: self rangeStart)
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testByteCharactersDo [

| set enumerated |
Expand All @@ -161,7 +163,7 @@ BitmapCharacterSetTest >> testByteCharactersDo [
assert: each equals: (self characters at: i) ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testCapacity [
"Since the bitmap is allocated in bytes, the last byte can have excess capacity
even when a specific capacity is specified."
Expand All @@ -175,7 +177,7 @@ BitmapCharacterSetTest >> testCapacity [
self assert: (self setClass new: i) capacity equals: 272 ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testComplement [

| set complement |
Expand All @@ -193,7 +195,7 @@ BitmapCharacterSetTest >> testComplement [
self assert: complement complement equals: set
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testConcatenation [
| set |

Expand All @@ -214,7 +216,7 @@ BitmapCharacterSetTest >> testConcatenation [
equals: self nonEmptySet
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testCopy [
| set |

Expand All @@ -231,7 +233,7 @@ BitmapCharacterSetTest >> testCopy [
equals: self nonEmptySet
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testCopyEmpty [
| set |

Expand All @@ -248,7 +250,7 @@ BitmapCharacterSetTest >> testCopyEmpty [
equals: self emptySet
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testDo [

| set enumerated |
Expand All @@ -267,7 +269,7 @@ BitmapCharacterSetTest >> testDo [
self assert: enumeratedChar equals: expectedChar ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testEquals [

self
Expand All @@ -277,7 +279,7 @@ BitmapCharacterSetTest >> testEquals [
deny: self nonEmptySet equals: self emptySet
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testHasWideCharacters [
| set |

Expand All @@ -294,15 +296,15 @@ BitmapCharacterSetTest >> testHasWideCharacters [
self deny: set hasWideCharacters
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testHash [

self
assert: self emptySet hash equals: self emptySet hash;
assert: self nonEmptySet hash equals: self nonEmptySet hash
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testIncludes [

| set |
Expand All @@ -317,7 +319,7 @@ BitmapCharacterSetTest >> testIncludes [
absentCharactersDo: [ :each | self deny: (set includes: each) ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testIncludesRangeFromTo [

| set |
Expand All @@ -332,7 +334,7 @@ BitmapCharacterSetTest >> testIncludesRangeFromTo [
assert: (set includesRangeFrom: self rangeStop to: self rangeStart)
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testMaxCapacity [

| maxCapacity set |
Expand All @@ -348,7 +350,7 @@ BitmapCharacterSetTest >> testMaxCapacity [
self assert: set capacity equals: maxCapacity
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testMaxCharacter [

| set |
Expand All @@ -360,7 +362,7 @@ BitmapCharacterSetTest >> testMaxCharacter [
raise: Error
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testNewFrom [

| set newSet |
Expand All @@ -374,7 +376,7 @@ BitmapCharacterSetTest >> testNewFrom [
deny: newSet identicalTo: set
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testRemoveAll [

| set capacity byteCharactersSize wideCharactersSize |
Expand All @@ -392,7 +394,7 @@ BitmapCharacterSetTest >> testRemoveAll [
assert: (set wideCharacters allSatisfy: [ :each | each = 0 ])
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testRemoveIfAbsent [

| set |
Expand All @@ -408,7 +410,7 @@ BitmapCharacterSetTest >> testRemoveIfAbsent [
equals: #absent ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testRemoveRangeFromTo [

| set |
Expand All @@ -434,7 +436,7 @@ BitmapCharacterSetTest >> testRemoveRangeFromTo [
self should: [ set removeRangeFrom: each to: each ] raise: Error ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testSize [

| set size |
Expand All @@ -454,7 +456,7 @@ BitmapCharacterSetTest >> testSize [
self assert: set size equals: size ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testWideCharacters [

0 to: 7 do: [ :i |
Expand All @@ -481,7 +483,7 @@ BitmapCharacterSetTest >> testWideCharacters [
self assert: set wideCharacters second equals: 0 ]
]

{ #category : #tests }
{ #category : 'tests' }
BitmapCharacterSetTest >> testWideCharactersDo [

| set enumerated wideCharOffset |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,35 @@
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 : #ManifestCollectionsBitmapCharacterSetTests,
#superclass : #PackageManifest,
#category : #'Collections-BitmapCharacterSet-Tests-Manifest'
#name : 'ManifestCollectionsBitmapCharacterSetTests',
#superclass : 'PackageManifest',
#category : 'Collections-BitmapCharacterSet-Tests-Manifest',
#package : 'Collections-BitmapCharacterSet-Tests',
#tag : 'Manifest'
}

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestCollectionsBitmapCharacterSetTests class >> ruleCollectionProtocolRuleV1FalsePositive [

<ignoreForCoverage>
^ #(#(#(#RGMethodDefinition #(#BitmapCharacterSetTest #testIncludesRangeFromTo #false)) #'2023-09-10T10:22:27.072+02:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestCollectionsBitmapCharacterSetTests class >> ruleEqualsTrueRuleV1FalsePositive [

<ignoreForCoverage>
^ #(#(#(#RGMethodDefinition #(#BitmapCharacterSetTest #testRemoveAll #false)) #'2023-09-10T10:23:20.756+02:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestCollectionsBitmapCharacterSetTests class >> ruleLiteralArrayContainsSuspiciousTrueFalseOrNilRuleV1FalsePositive [

<ignoreForCoverage>
^ #(#(#(#RGMetaclassDefinition #(#'ManifestCollectionsBitmapCharacterSetTests class' #ManifestCollectionsBitmapCharacterSetTests)) #'2023-09-10T10:26:38.422+02:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestCollectionsBitmapCharacterSetTests class >> ruleUsesAddRuleV1FalsePositive [

<ignoreForCoverage>
Expand Down
2 changes: 1 addition & 1 deletion src/Collections-BitmapCharacterSet-Tests/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'Collections-BitmapCharacterSet-Tests' }
Package { #name : 'Collections-BitmapCharacterSet-Tests' }
Loading