From 58bf84a5b2dd639bd4684a7b1e4bc5403430a825 Mon Sep 17 00:00:00 2001 From: jwikmark <jacob@wikmark.se> Date: Wed, 7 Mar 2018 18:13:05 +0100 Subject: [PATCH] some tests --- test/runtests.jl | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 6f1ec06..ea756ba 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,46 @@ using LabGUI +using Observables using Base.Test -# write your own tests here -@test 1 == 2 +################################################## +print("Tools:\n") +a = Observables.Observable(5.0) +b = Observables.Observable(5.0) +f(x) = 2*x +g(x) = x/2 +link!(a,b, f, g) + +a[] = 3.0 +@test b[] == 6.0 + +b[] = 10.6 +@test a[] == 5.3 + +push!(b.listeners, (x) -> b.val += 1.0) +a[] = 1.0 +@test b[] == 2.0 + +c = Observables.Observable(5.0) +d = Observables.Observable(5.0) +link!(c,d, f, g, true) + +c[] = 3.0 +@test d[] == 6.0 + +d[] = 10.6 +@test c[] == 5.3 + +push!(d.listeners, (x) -> d.val += 1.0) +c[] = 1.0 +@test d[] == 3.0 + + +################################################## +print("Gridmaker:\n") +grid = make_grid(3,5) +@test typeof(grid) <: WebIO.Node +@test grid.children.length==3 +@test grid.children[1].children.length==5 + + +################################################## -- GitLab