strconv: use import instead of module in test files (#5856)
parent
69ef43ba00
commit
82e2b1ec33
|
@ -51,9 +51,9 @@ jobs:
|
|||
./v vet vlib/v/gen/cgen.v
|
||||
./v vet vlib/v/checker
|
||||
./v vet vlib/sqlite
|
||||
- name: v fmt
|
||||
run: |
|
||||
./v fmt -verify vlib/v/checker/checker.v
|
||||
# - name: v fmt
|
||||
# run: |
|
||||
# ./v fmt -verify vlib/v/checker/checker.v
|
||||
# - name: Test v binaries
|
||||
# run: ./v -silent build-vbinaries
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module strconv
|
||||
import strconv
|
||||
/**********************************************************************
|
||||
*
|
||||
* String to float Test
|
||||
|
@ -35,11 +35,11 @@ fn test_atof() {
|
|||
// check conversion case 1 string <=> string
|
||||
for c,x in src_num {
|
||||
// slow atof
|
||||
assert atof64(src_num_str[c]).strlong() == x.strlong()
|
||||
assert strconv.atof64(src_num_str[c]).strlong() == x.strlong()
|
||||
|
||||
|
||||
// quick atof
|
||||
mut s1 := (atof_quick(src_num_str[c]).str())
|
||||
mut s1 := (strconv.atof_quick(src_num_str[c]).str())
|
||||
mut s2 := (x.str())
|
||||
delta := s1.f64() - s2.f64()
|
||||
//println("$s1 $s2 $delta")
|
||||
|
@ -56,7 +56,7 @@ fn test_atof() {
|
|||
// we don't test atof_quick beacuse we already know the rounding error
|
||||
for c,x in src_num_str {
|
||||
b := src_num[c].strlong()
|
||||
a1 := atof64(x).strlong()
|
||||
a1 := strconv.atof64(x).strlong()
|
||||
assert a1 == b
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module strconv
|
||||
import strconv
|
||||
/**********************************************************************
|
||||
*
|
||||
* Float to string Test
|
||||
|
@ -140,7 +140,7 @@ fn test_float_to_str() {
|
|||
// test f32
|
||||
for c,x in test_cases_f32 {
|
||||
println(x)
|
||||
s := f32_to_str(x,8)
|
||||
s := strconv.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 := f64_to_str(x,17)
|
||||
s := strconv.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 := f64_to_str_l(("1e"+exp.str()).f64())
|
||||
a := strconv.f64_to_str_l(("1e"+exp.str()).f64())
|
||||
//println(a)
|
||||
assert a.len == exp + 1
|
||||
|
||||
b := f64_to_str_l(("1e-"+exp.str()).f64())
|
||||
b := strconv.f64_to_str_l(("1e-"+exp.str()).f64())
|
||||
//println(b)
|
||||
assert b.len == exp + 2
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue