gagolews / stringi

Fast and portable character string processing in R (with the Unicode ICU)
https://stringi.gagolewski.com/
Other
304 stars 44 forks source link

stri_sprintf is platform-dependent #444

Open gagolews opened 3 years ago

gagolews commented 3 years ago

macOS-latest (release) yields:

----- FAILED[data]: test-sprintf.R<25--25>
 call| expect_identical(outer(f, x, stri_sprintf, na_string = "NA"), 
 call| -->    outer(f, x, sprintf))
 diff| 4 string mismatches
 ----- FAILED[data]: test-sprintf.R<203--203>
 call| expect_identical(stri_sprintf("%08s", "abc"), sprintf("%08s", 
 call| -->    "abc"))
 diff| Expected '00000abc', got '     abc'

windows-latest (3.6):

----- FAILED[data]: test-sprintf.R<18--19>
 call| expect_identical(stri_sprintf("%0000000000000000001$#0+ *0000002$.*003$e", 
 call| -->    1.23456, -12, 3), sprintf("%#0+-12.3e", 1.23456))
 diff| Expected '+1.235e+00  ', got '+1.235e+000 '
 ----- FAILED[data]: test-sprintf.R<20--21>
 call| expect_identical(stri_sprintf("%0000000000000000001$#0+ *0000002$.*003$e", 
 call| -->    1.23456, 12, 3), sprintf("%#0+12.3e", 1.23456))
 diff| Expected '+001.235e+00', got '+01.235e+000'
 ----- FAILED[data]: test-sprintf.R<228--228>
 call| expect_identical(stri_sprintf("%e", pi), sprintf("%e", pi))
 diff| Expected '3.141593e+00', got '3.141593e+000'
 ----- FAILED[data]: test-sprintf.R<229--229>
 call| expect_identical(stri_sprintf("%E", pi), sprintf("%E", pi))
 diff| Expected '3.141593E+00', got '3.141593E+000'
 ----- FAILED[data]: test-sprintf.R<231--231>
 call| expect_identical(stri_sprintf("%g", 1e+06 * pi), sprintf("%g", 
 call| -->    1e+06 * pi))
 diff| Expected '3.14159e+06', got '3.14159e+006'
There were 50 or more warnings (use warnings() to see the first 50)
 ----- FAILED[data]: test-sprintf.R<233--233>
 call| expect_identical(stri_sprintf("%G", 1e-06 * pi), sprintf("%G", 
 call| -->    1e-06 * pi))
 diff| Expected '3.14159E-06', got '3.14159E-006'
 ----- FAILED[data]: test-sprintf.R<243--243>
 call| expect_identical(stri_sprintf("%a", seq(0, 1, 0.1)), sprintf("%a", 
 call| -->    seq(0, 1, 0.1)))
 diff| 10 string mismatches
 ----- FAILED[data]: test-sprintf.R<244--244>
 call| expect_identical(stri_sprintf("%a", c(0, 0.1, 0.2, 0.3, 0.4, 
 call| -->    0.5, 0.6, 0.7, 0.8, 0.9, 1)), sprintf("%a", c(0, 0.1, 0.2, 
 call| -->    0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1)))
 diff| 10 string mismatches

windows-latest (release):

----- FAILED[data]: test-sprintf.R<243--243>
 call| expect_identical(stri_sprintf("%a", seq(0, 1, 0.1)), sprintf("%a", 
 call| -->    seq(0, 1, 0.1)))
 diff| 10 string mismatches
 ----- FAILED[data]: test-sprintf.R<244--244>
 call| expect_identical(stri_sprintf("%a", c(0, 0.1, 0.2, 0.3, 0.4, 
 call| -->    0.5, 0.6, 0.7, 0.8, 0.9, 1)), sprintf("%a", c(0, 0.1, 0.2, 
 call| -->    0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1)))
 diff| 10 string mismatches