Skip to content

Commit 4cfc93d

Browse files
committed
all: fix tests
1 parent 307a670 commit 4cfc93d

5 files changed

Lines changed: 15 additions & 8 deletions

File tree

cmd/tools/vtest-self.v

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ const essential_list = [
9090
'vlib/v/fmt/fmt_test.v',
9191
'vlib/v/gen/c/coutput_test.v',
9292
'vlib/v/gen/js/program_test.v',
93-
'vlib/v/gen/native/macho_test.v',
94-
'vlib/v/gen/native/tests/native_test.v',
9593
'vlib/v/pkgconfig/pkgconfig_test.v',
9694
'vlib/v/slow_tests/inout/compiler_test.v',
9795
'vlib/x/json2/tests/json2_test.v',

vlib/builtin/float.c.v

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ pub fn (x f64) str() string {
3333
// strg return a `f64` as `string` in "g" printf format.
3434
@[inline]
3535
pub fn (x f64) strg() string {
36-
if x == 0 {
37-
return '0.0'
36+
unsafe {
37+
f := strconv.Float64u{
38+
f: x
39+
}
40+
if f.u == strconv.double_minus_zero || f.u == strconv.double_plus_zero {
41+
return '0.0'
42+
}
3843
}
3944
abs_x := f64_abs(x)
4045
if abs_x >= 0.0001 && abs_x < 1.0e6 {
@@ -99,8 +104,13 @@ pub fn (x f32) str() string {
99104
// strg return a `f32` as `string` in "g" printf format
100105
@[inline]
101106
pub fn (x f32) strg() string {
102-
if x == 0 {
103-
return '0.0'
107+
unsafe {
108+
f := strconv.Float32u{
109+
f: x
110+
}
111+
if f.u == strconv.single_minus_zero || f.u == strconv.single_plus_zero {
112+
return '0.0'
113+
}
104114
}
105115
abs_x := f32_abs(x)
106116
if abs_x >= 0.0001 && abs_x < 1.0e6 {

vlib/builtin/js/map_test.js.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// vtest retry: 3
22
// vtest build: present_node?
33
import rand
4-
import strings
54

65
const strings = unique_strings(200, 10)
76

vlib/builtin/map_test.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import rand
2-
import strings
32

43
const strings = unique_strings(7000, 10)
54

vlib/v/checker/str.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ fn (mut c Checker) string_inter_lit(mut node ast.StringInterLiteral) ast.Type {
168168
node.fmt_poss[i])
169169
}
170170
node.need_fmts[i] = fmt != c.get_default_fmt(ftyp, typ)
171+
|| (typ.is_float() && fmt in [`g`, `G`])
171172
}
172173
// check recursive str
173174
if c.table.cur_fn != unsafe { nil } && c.table.cur_fn.is_method

0 commit comments

Comments
 (0)