Skip to content

Commit

Permalink
Move storeOn:base: to pharo specific package
Browse files Browse the repository at this point in the history
  • Loading branch information
ytsejam78 committed Aug 9, 2023
1 parent 8bb5f55 commit bc3137a
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 56 deletions.
5 changes: 4 additions & 1 deletion source/BaselineOfBuoy/BaselineOfBuoy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ BaselineOfBuoy >> baselineMath: spec [
spec requires:
#( 'Buoy-Math-Extensions' 'Buoy-Math-Pharo-Extensions'
'Dependent-SUnit-Extensions' ) ];
group: 'Tests' with: 'Buoy-Math-Tests'
group: 'Tests' with: 'Buoy-Math-Tests';
package: 'Buoy-Math-Pharo-Extensions-Tests' with: [
spec requires: 'Buoy-Math-Tests' ];
group: 'Tests' with: 'Buoy-Math-Pharo-Extensions-Tests'
]

{ #category : #baselines }
Expand Down
10 changes: 10 additions & 0 deletions source/Buoy-Math-Pharo-Extensions-Tests/PerMilleTest.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extension { #name : #PerMilleTest }

{ #category : #'*Buoy-Math-Pharo-Extensions-Tests' }
PerMilleTest >> testStoreOnBase [

self
assert: ( 0 perMille storeStringBase: 16 ) equals: '16r0 perMille';
assert: ( 1000 perMille storeStringBase: 16 ) equals: '16r3E8 perMille';
assert: ( ( PerMille of: 12 ) storeStringBase: 16 ) equals: '16rC perMille'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extension { #name : #PercentageTest }

{ #category : #'*Buoy-Math-Pharo-Extensions-Tests' }
PercentageTest >> testStoreOnBase [

self
assert: ( Percentage zero storeStringBase: 16 ) equals: 'Percentage zero';
assert: ( Percentage oneHundred storeStringBase: 16 ) equals: 'Percentage oneHundred';
assert: ( ( Percentage of: 12 ) storeStringBase: 16 ) equals: 'Percentage of: 16rC'
]
1 change: 1 addition & 0 deletions source/Buoy-Math-Pharo-Extensions-Tests/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Buoy-Math-Pharo-Extensions-Tests' }
17 changes: 17 additions & 0 deletions source/Buoy-Math-Pharo-Extensions/PerMille.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Extension { #name : #PerMille }

{ #category : #'*Buoy-Math-Pharo-Extensions' }
PerMille >> printOn: aStream base: anInteger [

self value printOn: aStream base: anInteger.
aStream nextPut: $‰
]

{ #category : #'*Buoy-Math-Pharo-Extensions' }
PerMille >> storeOn: aStream base: base [

self value storeOn: aStream base: base.
aStream
space;
nextPutAll: 'perMille'
]
22 changes: 22 additions & 0 deletions source/Buoy-Math-Pharo-Extensions/Percentage.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Extension { #name : #Percentage }

{ #category : #'*Buoy-Math-Pharo-Extensions' }
Percentage >> printOn: aStream base: anInteger [

self value printOn: aStream base: anInteger.
aStream nextPut: $%
]

{ #category : #'*Buoy-Math-Pharo-Extensions' }
Percentage >> storeOn: aStream base: base [

self isWellKnown ifTrue: [ self storeOn: aStream ]
ifFalse: [
aStream
nextPutAll: self class name asString;
space;
nextPutAll: 'of:';
space.
self value storeOn: aStream base: base
]
]
9 changes: 0 additions & 9 deletions source/Buoy-Math-Tests/PerMilleTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,6 @@ PerMilleTest >> testStoreOn [
assert: (PerMille of: 12) storeString equals: '12 perMille'
]

{ #category : #'tests - printing' }
PerMilleTest >> testStoreOnBase [

self
assert: ( 0 perMille storeStringBase: 16 ) equals: '16r0 perMille';
assert: ( 1000 perMille storeStringBase: 16 ) equals: '16r3E8 perMille';
assert: ( ( PerMille of: 12 ) storeStringBase: 16 ) equals: '16rC perMille'
]

{ #category : #'tests - testing' }
PerMilleTest >> testStrictlyPositive [

Expand Down
9 changes: 0 additions & 9 deletions source/Buoy-Math-Tests/PercentageTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,6 @@ PercentageTest >> testStoreOn [
assert: (Percentage of: 12) storeString equals: 'Percentage of: 12'
]

{ #category : #'tests - printing' }
PercentageTest >> testStoreOnBase [

self
assert: ( Percentage zero storeStringBase: 16 ) equals: 'Percentage zero';
assert: ( Percentage oneHundred storeStringBase: 16 ) equals: 'Percentage oneHundred';
assert: ( ( Percentage of: 12 ) storeStringBase: 16 ) equals: 'Percentage of: 16rC'
]

{ #category : #'tests - testing' }
PercentageTest >> testStrictlyPositive [

Expand Down
16 changes: 0 additions & 16 deletions source/Buoy-Math/PerMille.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ PerMille class >> fraction [
^ 1000
]

{ #category : #printing }
PerMille >> printOn: aStream base: anInteger [

self value printOn: aStream base: anInteger.
aStream nextPut: $‰
]

{ #category : #printing }
PerMille >> storeOn: aStream [

Expand All @@ -28,12 +21,3 @@ PerMille >> storeOn: aStream [
space;
nextPutAll: 'perMille'
]

{ #category : #printing }
PerMille >> storeOn: aStream base: base [

self value storeOn: aStream base: base.
aStream
space;
nextPutAll: 'perMille'
]
21 changes: 0 additions & 21 deletions source/Buoy-Math/Percentage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ Percentage >> isWellKnown [
^ #( 0 1 ) includes: ratio
]

{ #category : #printing }
Percentage >> printOn: aStream base: anInteger [

self value printOn: aStream base: anInteger.
aStream nextPut: $%
]

{ #category : #printing }
Percentage >> storeOn: aStream [

Expand All @@ -75,17 +68,3 @@ Percentage >> storeOn: aStream [
space.
self value storeOn: aStream
]

{ #category : #printing }
Percentage >> storeOn: aStream base: base [

self isWellKnown ifTrue: [ self storeOn: aStream ]
ifFalse: [
aStream
nextPutAll: self class name asString;
space;
nextPutAll: 'of:';
space.
self value storeOn: aStream base: base
]
]

0 comments on commit bc3137a

Please sign in to comment.