equal
deleted
inserted
replaced
8 poolDictionaries:'' |
8 poolDictionaries:'' |
9 category:'tests-Regression' |
9 category:'tests-Regression' |
10 ! |
10 ! |
11 |
11 |
12 |
12 |
13 !ScaledDecimalTest class methodsFor:'others'! |
|
14 |
|
15 version_CVS |
|
16 ^ '$Header$' |
|
17 ! ! |
|
18 |
|
19 !ScaledDecimalTest methodsFor:'tests'! |
13 !ScaledDecimalTest methodsFor:'tests'! |
|
14 |
|
15 literal1_helper |
|
16 ^ 1.40s2. |
|
17 |
|
18 "Created: / 09-08-2011 / 21:06:05 / cg" |
|
19 ! |
20 |
20 |
21 testAsNumber |
21 testAsNumber |
22 "Ensure no loss of precision" |
22 "Ensure no loss of precision" |
23 |
23 |
24 | sd | |
24 | sd | |
204 sd := -130000000013 asScaledDecimal: 6. |
204 sd := -130000000013 asScaledDecimal: 6. |
205 self assert: 0 = sd scale. |
205 self assert: 0 = sd scale. |
206 self assert: ('-130000000013s0' = sd printString) |
206 self assert: ('-130000000013s0' = sd printString) |
207 ! |
207 ! |
208 |
208 |
209 testLiteral |
209 testLiteral1 |
|
210 "s2 is not a message to be sent to a float" |
|
211 self |
|
212 shouldnt:[ self literal1_helper ] |
|
213 raise:MessageNotUnderstood |
|
214 |
|
215 "Created: / 09-08-2011 / 21:05:47 / cg" |
|
216 ! |
|
217 |
|
218 testLiteral2 |
210 | sd | |
219 | sd | |
211 |
220 |
212 sd := 1.40s2. |
221 sd := 1.40s2. |
213 self assert: (ScaledDecimal ? FixedPoint) == sd class. |
222 self assert: (ScaledDecimal ? FixedPoint) == sd class. |
214 self assert: sd scale == 2. |
223 self assert: sd scale == 2. |
216 self assert: '1.40' = sd printString. |
225 self assert: '1.40' = sd printString. |
217 self assert: '1.40s2' = sd storeString. |
226 self assert: '1.40s2' = sd storeString. |
218 ] ifFalse:[ |
227 ] ifFalse:[ |
219 self assert: '1.40s2' = sd printString. |
228 self assert: '1.40s2' = sd printString. |
220 ]. |
229 ]. |
|
230 |
|
231 "Created: / 09-08-2011 / 21:06:11 / cg" |
221 ! |
232 ! |
222 |
233 |
223 testPrintString |
234 testPrintString |
224 "The printed representation of a ScaledDecimal is truncated, not rounded. |
235 "The printed representation of a ScaledDecimal is truncated, not rounded. |
225 Not sure if this is right, so this test describes the current Squeak implementation. |
236 Not sure if this is right, so this test describes the current Squeak implementation. |
272 |
283 |
273 !ScaledDecimalTest class methodsFor:'documentation'! |
284 !ScaledDecimalTest class methodsFor:'documentation'! |
274 |
285 |
275 version |
286 version |
276 ^ '$Header$' |
287 ^ '$Header$' |
|
288 ! |
|
289 |
|
290 version_CVS |
|
291 ^ '$Header$' |
277 ! ! |
292 ! ! |