From 50027a0dcb2e81f6d25ebd2ea0644436776a0079 Mon Sep 17 00:00:00 2001 From: Spencer Russell Date: Thu, 16 Jul 2015 10:55:32 -0400 Subject: [PATCH] adds path method to OscMsg that return the OSC path --- src/OSC.jl | 4 +++- test/runtests.jl | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OSC.jl b/src/OSC.jl index 8ee3386..4816d8b 100644 --- a/src/OSC.jl +++ b/src/OSC.jl @@ -16,7 +16,7 @@ module OSC import Base.show -export OscMsg +export OscMsg, path macro incfp(x) quote begin local gensym_ = $(esc(x)) $(esc(x)) = $(esc(x))+1 @@ -27,6 +27,8 @@ type OscMsg data::Array{Uint8} end +path(msg::OscMsg) = stringify(msg.data) + function stringify(data::Array{Uint8}) zeroInd = find(data.== 0) if(length(zeroInd) == 0) diff --git a/test/runtests.jl b/test/runtests.jl index b8687dd..9e09404 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -124,8 +124,14 @@ function test_it_osc_spec() show(osc) end +function test_path() + osc = OscMsg("/foo", "f", float32(1.234)) + @test path(osc) == "/foo" +end + if test_type in ["ALL", "TEST", "INSTALL"] test_it_osc_spec() test_it_fat() + test_path() println("Done...") end