From 2238bf9a83458a132fc693926c48ebe7fb00e83a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 24 Jan 2021 10:12:49 +0100 Subject: [PATCH] fmt: use new const rule in tests --- vlib/v/fmt/tests/chan_ops_keep.vv | 4 ++-- vlib/v/fmt/tests/chan_or_keep.vv | 6 +++--- vlib/v/fmt/tests/shared_expected.vv | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vlib/v/fmt/tests/chan_ops_keep.vv b/vlib/v/fmt/tests/chan_ops_keep.vv index df3d3af1da..270f3e10b4 100644 --- a/vlib/v/fmt/tests/chan_ops_keep.vv +++ b/vlib/v/fmt/tests/chan_ops_keep.vv @@ -41,7 +41,7 @@ fn test_channel_array_mut() { sem := sync.new_semaphore() go do_rec_calc_send(chs, sem) mut t := i64(100) - for _ in 0 .. num_iterations { + for _ in 0 .. main.num_iterations { chs[0] <- t t = <-chs[1] } @@ -55,7 +55,7 @@ fn test_channel_array_mut() { c := ch[1].cap d := ch[o].len sem.wait() - assert t == 100 + num_iterations + assert t == 100 + main.num_iterations ch2 := chan mut St{cap: 10} go g(ch2) } diff --git a/vlib/v/fmt/tests/chan_or_keep.vv b/vlib/v/fmt/tests/chan_or_keep.vv index a6e7a90625..4cd531862f 100644 --- a/vlib/v/fmt/tests/chan_or_keep.vv +++ b/vlib/v/fmt/tests/chan_or_keep.vv @@ -2,13 +2,13 @@ const n = 1000 fn f(ch chan int) { mut s := 0 - for _ in 0 .. n { + for _ in 0 .. main.n { s += <-ch or { println('Something went wrong:') println('got $err') } } - assert s == n * (n + 1) / 2 + assert s == main.n * (main.n + 1) / 2 ch.close() } @@ -29,5 +29,5 @@ fn main() { for { s = do_send(ch, s) or { break } } - assert s == n + 1 + assert s == main.n + 1 } diff --git a/vlib/v/fmt/tests/shared_expected.vv b/vlib/v/fmt/tests/shared_expected.vv index 9b9ddc25fe..ada9531fa4 100644 --- a/vlib/v/fmt/tests/shared_expected.vv +++ b/vlib/v/fmt/tests/shared_expected.vv @@ -6,7 +6,7 @@ mut: } fn (shared x St) f(shared z St) { - for _ in 0 .. reads_per_thread { + for _ in 0 .. main.reads_per_thread { rlock x { // other instances may read at the same time time.sleep_ms(1) assert x.a == 7 || x.a == 5 @@ -29,12 +29,12 @@ fn test_shared_lock() { a: 5 } shared z := &St{ - a: read_threads + a: main.read_threads } - for _ in 0 .. read_threads { + for _ in 0 .. main.read_threads { go x.f(shared z) } - for i in 0 .. writes { + for i in 0 .. main.writes { lock x { // wait for ongoing reads to finish, don't start new ones x.a = 17 // this value should never be read time.sleep_ms(50)