-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move storeOn:base: to pharo specific package
- Loading branch information
Showing
10 changed files
with
64 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
source/Buoy-Math-Pharo-Extensions-Tests/PerMilleTest.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
] |
10 changes: 10 additions & 0 deletions
10
source/Buoy-Math-Pharo-Extensions-Tests/PercentageTest.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : #'Buoy-Math-Pharo-Extensions-Tests' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters