osc_sender_test.exs 1004 Bytes
Newer Older
1 2 3 4 5 6 7 8
defmodule OscSenderTest do

  use ExUnit.Case, async: true

  doctest GrainsEngine.OscSender
  alias GrainsEngine.{OscSender, Player}


9
  describe "convert values to osc values" do
10

11 12 13
    test "with floats" do
      assert OscSender.build_osc_value(0.5) == {:osc_float, 0.5}
    end
14

15 16
    test "with integers" do
      assert OscSender.build_osc_value(5) == {:osc_float, 5.0}
17 18
    end

19 20
  end

21

22 23 24 25 26
  describe "convert a raw tuple" do
    assert OscSender.build_osc_tuple([0.1, 0.2, 3.0]) == [osc_float: 0.1,
                                                        osc_float: 0.2,
                                                        osc_float: 3.0]
  end
27

28 29 30 31
  describe "convert a map" do
    assert OscSender.build_osc_tuple( %{"pitch" => 73, "roll" => 74, "yaw" => 3} ) == [osc_float: 73.0,
                                                                                       osc_float: 74.0,
                                                                                       osc_float: 3.0]
32 33
  end

34

35
end