Ticket #153: regression_test_fixes.patch
File regression_test_fixes.patch, 4.3 KB (added by jonathandavid, 16 years ago) |
---|
Fixes culture-related issues on several regression tests |
-
Source/Cobra.Lang/StringMaker.cobra
38 38 return .makeString(x) 39 39 else 40 40 # 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 !41 return String.format(CultureInfo.invariantCulture, '{0:' + format + '}', x) to ! 42 42 43 43 def makeString(x as Object?) as String 44 44 has MethodImpl(MethodImplOptions.Synchronized) -
Tests/110-basics-two/120-primitive-type-members.cobra
1 2 1 3 class Test 2 4 3 5 def main is shared … … 18 20 assert d.round == 5.0 19 21 assert d.round(1) == 5.2 20 22 21 d = decimal.parse('5.0' )23 d = decimal.parse('5.0', System.Globalization.CultureInfo.invariantCulture) 22 24 assert d == 5.0 23 25 d = 3.0 24 26 assert d.pow(4.5).round(3) == 140.296 -
Tests/110-basics-two/310-primitive-members.cobra
1 use System.Globalization 2 1 3 class Test 2 4 3 5 def main is shared … … 2 4 x = 5.0f 3 s = x.toString('0.0' )5 s = x.toString('0.0', CultureInfo.invariantCulture) 4 6 assert s == '5.0' 5 s = x.toString('0.0' ).trim7 s = x.toString('0.0', CultureInfo.invariantCulture).trim 6 8 assert s == '5.0' -
Tests/110-basics-two/510-number-parse.cobra
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 -
Tests/200-misc/300-number-type/100-number-float32.cobra
7 7 I checked the code gen and the System.Single type is definitely in use. 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 12 15 shared … … 29 32 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 35 38 y = 4.0 -
Tests/200-misc/300-number-type/102-number-float64.cobra
1 1 # .args. -number:float64 2 3 use System.Globalization 4 2 5 class X 3 6 4 7 shared … … 18 21 one = 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 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 24 27 x = 3.0 -
Tests/200-misc/300-number-type/106-number-decimal.cobra
1 1 # .args. -number:decimal 2 3 use System.Globalization 4 2 5 class X 3 6 4 7 shared … … 18 21 one = 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 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 24 27 y = 4.0