mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Update tests
This commit is contained in:
parent
15255855c3
commit
aca08709b6
2 changed files with 4 additions and 34 deletions
|
|
@ -132,22 +132,23 @@ ROOT_BENCH("update 1->1->1->1...1000 graph", function()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- todo: crashes at 1k
|
||||||
-- todo: repeat with batching
|
-- todo: repeat with batching
|
||||||
ROOT_BENCH("update 1000->1 graph", function()
|
ROOT_BENCH("update 1000->1 graph", function()
|
||||||
local srcs = {}
|
local srcs = {}
|
||||||
for i = 1, 1000 do
|
for i = 1, 800 do
|
||||||
srcs[i] = source(0)
|
srcs[i] = source(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
derive(function()
|
derive(function()
|
||||||
for i = 1, 1000 do
|
for i = 1, 800 do
|
||||||
srcs[i]()
|
srcs[i]()
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
for i = 1, START(1) do
|
for i = 1, START(1) do
|
||||||
for idx = 1, 1000 do
|
for idx = 1, 800 do
|
||||||
srcs[idx](i)
|
srcs[idx](i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -136,37 +136,6 @@ TEST("graph", function()
|
||||||
CHECK(d_cnt == 1)
|
CHECK(d_cnt == 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
do CASE "diamond graph 2"
|
|
||||||
-- todo: include cached value from parent nodes to confirm update order
|
|
||||||
-- a -> b -> c -> e
|
|
||||||
-- -> d
|
|
||||||
local root = node()
|
|
||||||
local a, b, c, d, e = node(), node(), node(), node(), node()
|
|
||||||
|
|
||||||
set_owner(b, root)
|
|
||||||
set_owner(c, root)
|
|
||||||
set_owner(d, root)
|
|
||||||
set_owner(e, root)
|
|
||||||
|
|
||||||
local b_cnt, c_cnt, d_cnt, e_cnt = 0, 0, 0, 0
|
|
||||||
function b.effect(x) b_cnt += 1; return not x end
|
|
||||||
function c.effect(x) c_cnt += 1; return not x end
|
|
||||||
function d.effect(x) d_cnt += 1; return not x end
|
|
||||||
function e.effect(x) e_cnt += 1; return not x end
|
|
||||||
|
|
||||||
open_scope(b); track(a); close_scope()
|
|
||||||
open_scope(c); track(b); close_scope()
|
|
||||||
open_scope(d); track(a); close_scope()
|
|
||||||
open_scope(e); track(c); track(d); close_scope()
|
|
||||||
|
|
||||||
update(a)
|
|
||||||
|
|
||||||
CHECK(b_cnt == 1)
|
|
||||||
CHECK(c_cnt == 1)
|
|
||||||
CHECK(d_cnt == 1)
|
|
||||||
CHECK(e_cnt == 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
do CASE "duplicate child on rerun"
|
do CASE "duplicate child on rerun"
|
||||||
local root = node()
|
local root = node()
|
||||||
local a, b, c = node(), node(), node()
|
local a, b, c = node(), node(), node()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue