strconv: more fixes

pull/5856/head
Alexander Medvednikov 2020-07-16 20:55:15 +02:00
parent f1b4af33ac
commit cb1009d91b
2 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,4 @@
module strconv
/**********************************************************************
*
* String to float Test

View File

@ -1,9 +1,9 @@
module strconv
/**********************************************************************
*
* Float to string Test
*
**********************************************************************/
import strconv
import math
union Ufloat32 {
@ -140,7 +140,7 @@ fn test_float_to_str() {
// test f32
for c,x in test_cases_f32 {
println(x)
s := strconv.f32_to_str(x,8)
s := f32_to_str(x,8)
s1 := exp_result_f32[c]
//println("$s1 $s")
assert s == s1
@ -148,7 +148,7 @@ fn test_float_to_str() {
// test f64
for c,x in test_cases_f64 {
s := strconv.f64_to_str(x,17)
s := f64_to_str(x,17)
s1 := exp_result_f64[c]
//println("$s1 $s")
assert s == s1
@ -156,11 +156,11 @@ fn test_float_to_str() {
// test long format
for exp := 1 ; exp < 120 ; exp++ {
a := strconv.f64_to_str_l(("1e"+exp.str()).f64())
a := f64_to_str_l(("1e"+exp.str()).f64())
//println(a)
assert a.len == exp + 1
b := strconv.f64_to_str_l(("1e-"+exp.str()).f64())
b := f64_to_str_l(("1e-"+exp.str()).f64())
//println(b)
assert b.len == exp + 2
}