onkyo_eiscp_ruby 0.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +0,0 @@
1
- require 'socket'
2
- require 'eiscp/receiver'
3
- require 'eiscp/message'
4
-
5
- # Mock server that only responds to ECNQSTN.
6
-
7
- module EISCP
8
- class MockReceiver
9
-
10
- ONKYO_DISCOVERY_RESPONSE = Message.new("ECN", "TX-NR609/60128/DX/001122334455")
11
-
12
- # Create/start the server object.
13
-
14
- def initialize
15
- Socket.udp_server_loop("255.255.255.255", EISCP::ONKYO_PORT) do |msg, msg_src|
16
- msg_src.reply ONKYO_DISCOVERY_RESPONSE.to_eiscp
17
- puts msg
18
- end
19
- end
20
-
21
- end
22
- end
data/test/tc_command.rb DELETED
@@ -1,43 +0,0 @@
1
- require_relative "../lib/eiscp/command.rb"
2
- require_relative "../lib/eiscp/message.rb"
3
- require "test/unit"
4
-
5
- class TestCommand < Test::Unit::TestCase
6
-
7
- def test_command_to_name
8
- assert_equal(Command.command_to_name("PWR"), "system-power")
9
- end
10
-
11
- def test_command_name_to_command
12
- assert_equal(Command.command_name_to_command("system-power"), "PWR")
13
- end
14
-
15
- def test_command_value_to_value_name
16
- assert_equal(Command.command_value_to_value_name("PWR", "01"), "on")
17
- end
18
-
19
- def test_command_value_name_to_value
20
- assert_equal(Command.command_value_name_to_value("PWR", "on"), "01")
21
- end
22
-
23
- def test_description_from_command_name
24
- assert_equal(Command.description_from_command_name("system-power"), "System Power Command")
25
- end
26
-
27
- def test_description_from_command
28
- assert_equal(Command.description_from_command("PWR"), "System Power Command")
29
- end
30
-
31
- def test_parse_system_power
32
- assert_equal(Command.parse('system-power on'), EISCP::Message.parse('PWR01'))
33
- end
34
-
35
- def test_parse_zone2_system_power
36
- assert_equal(Command.parse('zone2 power on'), EISCP::Message.parse('ZPW01'))
37
- end
38
-
39
- def test_parse_volume_as_integer
40
- assert_equal(Command.parse('main-volume 25'), EISCP::Message.parse('MVL19'))
41
- end
42
-
43
- end