Changeset 1953
- Timestamp:
- 03/08/09 03:42:11 (3 years ago)
- Location:
- cobra/trunk
- Files:
-
- 7 modified
-
Source/Cobra.Lang/StringMaker.cobra (modified) (2 diffs)
-
Tests/110-basics-two/120-primitive-type-members.cobra (modified) (1 diff)
-
Tests/110-basics-two/310-primitive-members.cobra (modified) (1 diff)
-
Tests/110-basics-two/510-number-parse.cobra (modified) (1 diff)
-
Tests/200-misc/300-number-type/100-number-float32.cobra (modified) (2 diffs)
-
Tests/200-misc/300-number-type/102-number-float64.cobra (modified) (2 diffs)
-
Tests/200-misc/300-number-type/106-number-decimal.cobra (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Source/Cobra.Lang/StringMaker.cobra
r1895 r1953 2 2 3 3 use System.Collections 4 use System.Globalization 4 5 use System.Reflection 5 6 use System.Runtime.CompilerServices … … 39 40 else 40 41 # Is there a faster way to do this? Some types already have .toString(format as String) overload. 41 return String.format( '{0:' + format + '}', x) to !42 return String.format(CultureInfo.invariantCulture, '{0:' + format + '}', x) to ! 42 43 43 44 def makeString(x as Object?) as String -
cobra/trunk/Tests/110-basics-two/120-primitive-type-members.cobra
r1845 r1953 19 19 assert d.round(1) == 5.2 20 20 21 d = decimal.parse('5.0' )21 d = decimal.parse('5.0', System.Globalization.CultureInfo.invariantCulture) 22 22 assert d == 5.0 23 23 d = 3.0 -
cobra/trunk/Tests/110-basics-two/310-primitive-members.cobra
r1177 r1953 1 use System.Globalization 2 1 3 class Test 2 4 3 5 def main is shared 4 6 x = 5.0f 5 s = x.toString('0.0' )7 s = x.toString('0.0', CultureInfo.invariantCulture) 6 8 assert s == '5.0' 7 s = x.toString('0.0' ).trim9 s = x.toString('0.0', CultureInfo.invariantCulture).trim 8 10 assert s == '5.0' -
cobra/trunk/Tests/110-basics-two/510-number-parse.cobra
r1177 r1953 1 use System.Globalization 2 1 3 class Foo 2 4 3 5 def main is shared 4 f as float = float.parse('3.5' )6 f as float = float.parse('3.5', CultureInfo.invariantCulture) 5 7 assert f==3.5f -
cobra/trunk/Tests/200-misc/300-number-type/100-number-float32.cobra
r1553 r1953 8 8 The assertions below prove the imperfect arithmetic whether on .NET or Mono. 9 9 """ 10 11 use System.Globalization 12 10 13 class X 11 14 … … 30 33 assert 1.0 <> one or 0.9 <> pointNine 31 34 32 assert one.toString('R' ) == '1.00000012' or pointNine.toString('R') == '0.900000036'35 assert one.toString('R', CultureInfo.invariantCulture) == '1.00000012' or pointNine.toString('R', CultureInfo.invariantCulture) == '0.900000036' 33 36 34 37 x = 3.0 -
cobra/trunk/Tests/200-misc/300-number-type/102-number-float64.cobra
r1417 r1953 1 1 # .args. -number:float64 2 3 use System.Globalization 4 2 5 class X 3 6 … … 19 22 assert 1.0 <> one 20 23 21 roundTripFormat = one.toString('R' )24 roundTripFormat = one.toString('R', CultureInfo.invariantCulture) 22 25 assert roundTripFormat.startsWith('0.999999') 23 26 -
cobra/trunk/Tests/200-misc/300-number-type/106-number-decimal.cobra
r1417 r1953 1 1 # .args. -number:decimal 2 3 use System.Globalization 4 2 5 class X 3 6 … … 19 22 assert 1.0 == one 20 23 21 assert one.toString == '1.0'24 assert one.toString(CultureInfo.invariantCulture) == '1.0' 22 25 23 26 x = 3.0



