ci,tests: fix compilation of vlib/v/tests/bench/gcboehm/GC_bench.v, add a CI task for checking that .v files inside vlib/v/tests/bench continue to compile

This commit is contained in:
Delyan Angelov 2023-08-14 18:53:51 +03:00
parent e446eb5953
commit 8ae962b4d5
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 11 additions and 9 deletions

View File

@ -76,10 +76,12 @@ jobs:
run: TZ=Europe/Paris ./v test vlib/time/
- name: Build examples
run: ./v -W build-examples
- name: Test building v tools
- name: Build v tools
run: ./v -W build-tools
- name: Test v binaries
- name: Build v binaries
run: ./v build-vbinaries
- name: Build benches
run: ./v should-compile-all vlib/v/tests/bench/
- name: Run a VSH script
run: ./v run examples/v_script.vsh
- name: Test v tutorials

View File

@ -26,21 +26,21 @@ const (
fn waste_mem() {
mut objs := PtrPtrObj{
nxt: []&PtrObj{len: n}
nxt: unsafe { []&PtrObj{len: n} }
}
for {
sz := rand.int_in_range(10, 1000)
sz := rand.int_in_range(10, 1000) or { 10 }
mut new_obj := &PtrObj{
nxt: []&DataObj{len: sz}
nxt: unsafe { []&DataObj{len: sz} }
}
sz2 := rand.int_in_range(10, 500000)
sz2 := rand.int_in_range(10, 500000) or { 10 }
new_obj2 := &DataObj{
data: []f64{len: sz2}
data: unsafe { []f64{len: sz2} }
}
idx2 := rand.int_in_range(0, sz)
idx2 := rand.int_in_range(0, sz) or { 0 }
new_obj.nxt[idx2] = new_obj2
// non-equally distributed random index
idx := int(math.sqrt(math.sqrt(rand.f64n(n4))))
idx := int(math.sqrt(math.sqrt(rand.f64n(n4) or { 0.0 })))
objs.nxt[idx] = new_obj
}
}