midi-nibbler 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +2 -2
- data/README.md +139 -0
- data/lib/nibbler.rb +13 -10
- data/lib/nibbler/hex_processor.rb +47 -0
- data/lib/nibbler/midi-message.rb +53 -0
- data/lib/nibbler/midilib.rb +67 -0
- data/lib/nibbler/parser.rb +86 -94
- data/lib/nibbler/session.rb +134 -0
- data/lib/nibbler/type_conversion.rb +17 -10
- data/test/helper.rb +3 -9
- data/test/{test_hex_char_array_filter.rb → hex_processor_test.rb} +18 -23
- data/test/midi_message_test.rb +126 -0
- data/test/midilib_test.rb +131 -0
- data/test/{test_parser_buffer.rb → parser_buffer_test.rb} +3 -8
- data/test/{test_parser_rejected.rb → parser_rejected_test.rb} +9 -14
- data/test/parser_test.rb +188 -0
- data/test/session_test.rb +135 -0
- data/test/{test_type_conversion.rb → type_conversion_test.rb} +6 -11
- metadata +60 -65
- data/README.rdoc +0 -115
- data/lib/nibbler/hex_char_array_filter.rb +0 -37
- data/lib/nibbler/midi-message_factory.rb +0 -54
- data/lib/nibbler/midilib_factory.rb +0 -66
- data/lib/nibbler/nibbler.rb +0 -89
- data/test/test_midi_message_factory.rb +0 -130
- data/test/test_midilib_factory.rb +0 -137
- data/test/test_nibbler.rb +0 -120
- data/test/test_parser.rb +0 -159
@@ -1,11 +1,6 @@
|
|
1
|
-
|
1
|
+
require "helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
class BufferTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
include Nibbler
|
8
|
-
include TestHelper
|
3
|
+
class Nibbler::BufferTest < Test::Unit::TestCase
|
9
4
|
|
10
5
|
def test_buffer_nibble_str
|
11
6
|
nibbler = Nibbler.new
|
@@ -68,4 +63,4 @@ class BufferTest < Test::Unit::TestCase
|
|
68
63
|
assert_equal(["9", "4", "0"], nibbler.buffer)
|
69
64
|
end
|
70
65
|
|
71
|
-
end
|
66
|
+
end
|
@@ -1,16 +1,11 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require "helper"
|
4
2
|
|
5
|
-
class ParserRejectedTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
include Nibbler
|
8
|
-
include TestHelper
|
3
|
+
class Nibbler::ParserRejectedTest < Test::Unit::TestCase
|
9
4
|
|
10
5
|
def test_leading_chars
|
11
6
|
nibbler = Nibbler.new
|
12
7
|
msg = nibbler.parse("0", "9", "04", "040")
|
13
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
8
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
14
9
|
assert_equal(["0"], nibbler.rejected)
|
15
10
|
end
|
16
11
|
|
@@ -23,43 +18,43 @@ class ParserRejectedTest < Test::Unit::TestCase
|
|
23
18
|
def test_leading_string
|
24
19
|
nibbler = Nibbler.new
|
25
20
|
msg = nibbler.parse("10", "9", "04", "040")
|
26
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
21
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
27
22
|
assert_equal(["1", "0"], nibbler.rejected)
|
28
23
|
end
|
29
24
|
|
30
25
|
def test_long_leading_string
|
31
26
|
nibbler = Nibbler.new
|
32
27
|
msg = nibbler.parse("000001000010", "9", "04", "040")
|
33
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
28
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
34
29
|
assert_equal("000001000010".split(//), nibbler.rejected)
|
35
30
|
end
|
36
31
|
|
37
32
|
def test_long_leading_string_overlap
|
38
33
|
nibbler = Nibbler.new
|
39
34
|
msg = nibbler.parse("000001000010090", "4", "040")
|
40
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
35
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
41
36
|
assert_equal("0000010000100".split(//), nibbler.rejected)
|
42
37
|
end
|
43
38
|
|
44
39
|
def test_leading_number
|
45
40
|
nibbler = Nibbler.new
|
46
41
|
msg = nibbler.parse(0x30, "9", "04", "040")
|
47
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
42
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
48
43
|
assert_equal(["3", "0"], nibbler.rejected)
|
49
44
|
end
|
50
45
|
|
51
46
|
def test_2_leading_numbers
|
52
47
|
nibbler = Nibbler.new
|
53
48
|
msg = nibbler.parse(0x60, 0x30, "9", "04", "040")
|
54
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
49
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
55
50
|
assert_equal(["6", "0", "3", "0"], nibbler.rejected)
|
56
51
|
end
|
57
52
|
|
58
53
|
def test_3_leading_numbers
|
59
54
|
nibbler = Nibbler.new
|
60
55
|
msg = nibbler.parse(0x00, 0x30, "9", "04", "040")
|
61
|
-
assert_equal(MIDIMessage::NoteOn, msg.class)
|
56
|
+
assert_equal(::MIDIMessage::NoteOn, msg.class)
|
62
57
|
assert_equal(["0", "0", "3", "0"], nibbler.rejected)
|
63
58
|
end
|
64
59
|
|
65
|
-
end
|
60
|
+
end
|
data/test/parser_test.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
require "helper"
|
2
|
+
|
3
|
+
class Nibbler::ParserTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_lookahead
|
6
|
+
parser = Nibbler::Parser.new
|
7
|
+
num = 6
|
8
|
+
parser.instance_variable_set("@buffer", ["9", "0", "4", "0", "5", "0"])
|
9
|
+
parser.send(:populate_current)
|
10
|
+
output = parser.send(:lookahead, num) { |nibble_2, bytes| [nibble_2, bytes] }
|
11
|
+
assert_equal([0,[0x90, 0x40, 0x50]], output[:message])
|
12
|
+
assert_equal(["9", "0", "4", "0", "5", "0"], output[:processed])
|
13
|
+
assert_equal([], parser.instance_variable_get("@current"))
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_lookahead_trailing
|
17
|
+
parser = Nibbler::Parser.new
|
18
|
+
num = 6
|
19
|
+
parser.instance_variable_set("@buffer", ["9", "0", "4", "0", "5", "0", "5", "0"])
|
20
|
+
parser.send(:populate_current)
|
21
|
+
output = parser.send(:lookahead, num) { |nibble_2, bytes| [nibble_2, bytes] }
|
22
|
+
assert_equal([0,[0x90, 0x40, 0x50]], output[:message])
|
23
|
+
assert_equal(["9", "0", "4", "0", "5", "0"], output[:processed])
|
24
|
+
assert_equal(["5", "0"], parser.instance_variable_get("@current"))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_lookahead_too_short
|
28
|
+
parser = Nibbler::Parser.new
|
29
|
+
num = 6
|
30
|
+
parser.instance_variable_set("@buffer", ["9", "0", "4"])
|
31
|
+
parser.send(:populate_current)
|
32
|
+
output = parser.send(:lookahead, num) do |nibble_2, bytes|
|
33
|
+
{
|
34
|
+
:message => nibble_2,
|
35
|
+
:processed => bytes
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_nil output
|
40
|
+
assert_equal(["9", "0", "4"], parser.instance_variable_get("@current"))
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_lookahead_sysex
|
44
|
+
parser = Nibbler::Parser.new
|
45
|
+
parser.instance_variable_set("@buffer", "F04110421240007F0041F750".split(//))
|
46
|
+
parser.send(:populate_current)
|
47
|
+
output = parser.send(:lookahead_sysex) { |b| b }
|
48
|
+
assert_equal([0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7F, 0x00, 0x41, 0xF7], output[:message])
|
49
|
+
assert_equal("F04110421240007F0041F7".split(//), output[:processed])
|
50
|
+
assert_equal(["5", "0"], parser.instance_variable_get("@current"))
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_lookahead_sysex_too_short
|
54
|
+
parser = Nibbler::Parser.new
|
55
|
+
parser.instance_variable_set("@buffer", ["9", "0", "4"])
|
56
|
+
parser.send(:populate_current)
|
57
|
+
output = parser.send(:lookahead_sysex) { |b| b }
|
58
|
+
|
59
|
+
assert_nil output
|
60
|
+
assert_equal(["9", "0", "4"], parser.instance_variable_get("@current"))
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_process
|
64
|
+
parser = Nibbler::Parser.new
|
65
|
+
short = ["9", "0", "4", "0", "5", "0", "5", "0"]
|
66
|
+
output = parser.send(:process, short)
|
67
|
+
|
68
|
+
assert_equal(::MIDIMessage::NoteOn, output[:messages].first.class)
|
69
|
+
assert_equal(["5", "0"], parser.buffer)
|
70
|
+
assert_equal(["9", "0", "4", "0", "5", "0"], output[:processed])
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_process_running_status
|
74
|
+
parser = Nibbler::Parser.new
|
75
|
+
two_msgs = ["9", "0", "4", "0", "5", "0", "4", "0", "6", "0"]
|
76
|
+
output = parser.send(:process, two_msgs)
|
77
|
+
|
78
|
+
assert_not_nil output
|
79
|
+
assert_equal(::MIDIMessage::NoteOn, output[:messages][0].class)
|
80
|
+
#assert_equal(::MIDIMessage::NoteOn, output[:messages][1].class)
|
81
|
+
assert_equal([], parser.buffer)
|
82
|
+
assert_equal(["9", "0", "4", "0", "5", "0", "4", "0", "6", "0"], output[:processed])
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_process_multiple_overlapping_calls
|
86
|
+
parser = Nibbler::Parser.new
|
87
|
+
short = ["9", "0", "4", "0", "5", "0", "9", "0"]
|
88
|
+
short2 = ["3", "0", "2", "0", "1", "0"]
|
89
|
+
|
90
|
+
output = parser.send(:process, short)
|
91
|
+
|
92
|
+
assert_not_nil output
|
93
|
+
assert_equal(::MIDIMessage::NoteOn, output[:messages].first.class)
|
94
|
+
assert_equal(["9", "0"], parser.buffer)
|
95
|
+
assert_equal(["9", "0", "4", "0", "5", "0"], output[:processed])
|
96
|
+
|
97
|
+
output2 = parser.send(:process, short2)
|
98
|
+
|
99
|
+
assert_not_nil output2
|
100
|
+
assert_equal(::MIDIMessage::NoteOn, output2[:messages].first.class)
|
101
|
+
assert_equal(["1", "0"], parser.buffer)
|
102
|
+
assert_equal(["9", "0", "3", "0", "2", "0"], output2[:processed])
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_nibbles_to_message_leading
|
106
|
+
parser = Nibbler::Parser.new
|
107
|
+
short = ["5", "0", "9", "0", "4", "0", "5", "0"]
|
108
|
+
parser.instance_variable_set("@buffer", short)
|
109
|
+
parser.send(:populate_current)
|
110
|
+
output = parser.send(:nibbles_to_message)
|
111
|
+
|
112
|
+
assert_nil output
|
113
|
+
assert_equal(["5", "0", "9", "0", "4", "0", "5", "0"], parser.buffer)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_nibbles_to_message_trailing
|
117
|
+
parser = Nibbler::Parser.new
|
118
|
+
short = ["9", "0", "4", "0", "5", "0", "5", "0"]
|
119
|
+
parser.instance_variable_set("@buffer", short)
|
120
|
+
parser.send(:populate_current)
|
121
|
+
output = parser.send(:nibbles_to_message)
|
122
|
+
|
123
|
+
assert_not_nil output
|
124
|
+
assert_equal(::MIDIMessage::NoteOn, output[:message].class)
|
125
|
+
assert_equal(["5", "0"], parser.instance_variable_get("@current"))
|
126
|
+
assert_equal(["9", "0", "4", "0", "5", "0"], output[:processed])
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_nibbles_to_message
|
130
|
+
parser = Nibbler::Parser.new
|
131
|
+
short = ["9", "0", "4", "0", "5", "0", "5", "0"]
|
132
|
+
parser.instance_variable_set("@buffer", short)
|
133
|
+
parser.send(:populate_current)
|
134
|
+
output = parser.send(:nibbles_to_message)
|
135
|
+
|
136
|
+
assert_not_nil output
|
137
|
+
assert_equal(::MIDIMessage::NoteOn, output[:message].class)
|
138
|
+
assert_equal(["5", "0"], parser.instance_variable_get("@current"))
|
139
|
+
assert_equal(["9", "0", "4", "0", "5", "0"], output[:processed])
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_nibbles_to_message_running_status
|
143
|
+
parser = Nibbler::Parser.new
|
144
|
+
short = ["9", "0", "4", "0", "5", "0"]
|
145
|
+
parser.instance_variable_set("@buffer", short)
|
146
|
+
parser.send(:populate_current)
|
147
|
+
output = parser.send(:nibbles_to_message)
|
148
|
+
|
149
|
+
assert_not_nil output
|
150
|
+
assert_equal(::MIDIMessage::NoteOn, output[:message].class)
|
151
|
+
|
152
|
+
running_status = ["5", "0", "6", "0"]
|
153
|
+
parser.instance_variable_set("@buffer", running_status)
|
154
|
+
parser.send(:populate_current)
|
155
|
+
output = parser.send(:nibbles_to_message)
|
156
|
+
|
157
|
+
assert_not_nil output
|
158
|
+
assert_equal(::MIDIMessage::NoteOn, output[:message].class)
|
159
|
+
assert_equal(["5", "0", "6", "0"], output[:processed])
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_nibbles_to_message_sysex
|
163
|
+
parser = Nibbler::Parser.new
|
164
|
+
sysex = "F04110421240007F0041F750".split(//)
|
165
|
+
parser.instance_variable_set("@buffer", sysex)
|
166
|
+
parser.send(:populate_current)
|
167
|
+
output = parser.send(:nibbles_to_message)
|
168
|
+
|
169
|
+
assert_not_nil output
|
170
|
+
assert_equal(::MIDIMessage::SystemExclusive::Command, output[:message].class)
|
171
|
+
assert_equal(["5", "0"], parser.instance_variable_get("@current"))
|
172
|
+
assert_equal("F04110421240007F0041F7".split(//), output[:processed])
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_message_library
|
176
|
+
parser = nil
|
177
|
+
assert_nothing_raised Exception do
|
178
|
+
parser = Nibbler::Parser.new(:message_lib => :midilib)
|
179
|
+
end
|
180
|
+
assert_equal Nibbler::Midilib, parser.instance_variable_get("@message")
|
181
|
+
|
182
|
+
assert_nothing_raised Exception do
|
183
|
+
parser = Nibbler::Parser.new
|
184
|
+
end
|
185
|
+
assert_equal Nibbler::MIDIMessage, parser.instance_variable_get("@message")
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require "helper"
|
2
|
+
|
3
|
+
class Nibbler::SessionTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_varying_length_strings
|
6
|
+
session = Nibbler::Session.new
|
7
|
+
message = session.parse("9", "04", "040")
|
8
|
+
|
9
|
+
assert_not_nil message
|
10
|
+
assert_equal(MIDIMessage::NoteOn, message.class)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_note_off
|
14
|
+
session = Nibbler::Session.new
|
15
|
+
message = session.parse(0x80, 0x40, 0x40)
|
16
|
+
|
17
|
+
assert_not_nil message
|
18
|
+
assert_equal(MIDIMessage::NoteOff, message.class)
|
19
|
+
assert_equal(0, message.channel)
|
20
|
+
assert_equal(0x40, message.note)
|
21
|
+
assert_equal(0x40, message.velocity)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_note_on
|
25
|
+
session = Nibbler::Session.new
|
26
|
+
message = session.parse(0x90, 0x40, 0x40)
|
27
|
+
|
28
|
+
assert_not_nil message
|
29
|
+
assert_equal(MIDIMessage::NoteOn, message.class)
|
30
|
+
assert_equal(0, message.channel)
|
31
|
+
assert_equal(0x40, message.note)
|
32
|
+
assert_equal(0x40, message.velocity)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_timestamp
|
36
|
+
session = Nibbler::Session.new
|
37
|
+
stamp = Time.now.to_i
|
38
|
+
report = session.parse(0x90, 0x40, 0x40, :timestamp => stamp)
|
39
|
+
message = report[:messages]
|
40
|
+
|
41
|
+
assert_not_nil message
|
42
|
+
assert_equal(MIDIMessage::NoteOn, message.class)
|
43
|
+
assert_equal(0, message.channel)
|
44
|
+
assert_equal(0x40, message.note)
|
45
|
+
assert_equal(0x40, message.velocity)
|
46
|
+
assert_equal(stamp, report[:timestamp])
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_polyphonic_aftertouch
|
50
|
+
session = Nibbler::Session.new
|
51
|
+
message = session.parse(0xA1, 0x40, 0x40)
|
52
|
+
|
53
|
+
assert_not_nil message
|
54
|
+
assert_equal(MIDIMessage::PolyphonicAftertouch, message.class)
|
55
|
+
assert_equal(1, message.channel)
|
56
|
+
assert_equal(0x40, message.note)
|
57
|
+
assert_equal(0x40, message.value)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_control_change
|
61
|
+
session = Nibbler::Session.new
|
62
|
+
message = session.parse(0xB2, 0x20, 0x20)
|
63
|
+
|
64
|
+
assert_not_nil message
|
65
|
+
assert_equal(MIDIMessage::ControlChange, message.class)
|
66
|
+
assert_equal(message.channel, 2)
|
67
|
+
assert_equal(0x20, message.index)
|
68
|
+
assert_equal(0x20, message.value)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_program_change
|
72
|
+
session = Nibbler::Session.new
|
73
|
+
message = session.parse(0xC3, 0x40)
|
74
|
+
|
75
|
+
assert_not_nil message
|
76
|
+
assert_equal(MIDIMessage::ProgramChange, message.class)
|
77
|
+
assert_equal(3, message.channel)
|
78
|
+
assert_equal(0x40, message.program)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_channel_aftertouch
|
82
|
+
session = Nibbler::Session.new
|
83
|
+
message = session.parse(0xD3, 0x50)
|
84
|
+
|
85
|
+
assert_not_nil message
|
86
|
+
assert_equal(MIDIMessage::ChannelAftertouch, message.class)
|
87
|
+
assert_equal(3, message.channel)
|
88
|
+
assert_equal(0x50, message.value)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_pitch_bend
|
92
|
+
session = Nibbler::Session.new
|
93
|
+
message = session.parse(0xE0, 0x20, 0x00) # center
|
94
|
+
|
95
|
+
assert_not_nil message
|
96
|
+
assert_equal(MIDIMessage::PitchBend, message.class)
|
97
|
+
assert_equal(0, message.channel)
|
98
|
+
assert_equal(0x20, message.low)
|
99
|
+
assert_equal(0x00, message.high)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_system_common_generic_3_bytes
|
103
|
+
session = Nibbler::Session.new
|
104
|
+
message = session.parse(0xF1, 0x50, 0xA0)
|
105
|
+
|
106
|
+
assert_not_nil message
|
107
|
+
assert_equal(MIDIMessage::SystemCommon, message.class)
|
108
|
+
assert_equal(1, message.status[1])
|
109
|
+
assert_equal(0x50, message.data[0])
|
110
|
+
assert_equal(0xA0, message.data[1])
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_system_common_generic_2_bytes
|
114
|
+
session = Nibbler::Session.new
|
115
|
+
message = session.parse(0xF1, 0x50)
|
116
|
+
assert_equal(MIDIMessage::SystemCommon, message.class)
|
117
|
+
assert_equal(1, message.status[1])
|
118
|
+
assert_equal(0x50, message.data[0])
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_system_common_generic_1_byte
|
122
|
+
session = Nibbler::Session.new
|
123
|
+
message = session.parse(0xF1)
|
124
|
+
assert_equal(MIDIMessage::SystemCommon, message.class)
|
125
|
+
assert_equal(1, message.status[1])
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_system_realtime
|
129
|
+
session = Nibbler::Session.new
|
130
|
+
message = session.parse(0xF8)
|
131
|
+
assert_equal(MIDIMessage::SystemRealtime, message.class)
|
132
|
+
assert_equal(8, message.id)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
@@ -1,15 +1,10 @@
|
|
1
|
-
|
1
|
+
require "helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
class TypeConversionTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
include Nibbler
|
8
|
-
include TestHelper
|
3
|
+
class Nibbler::TypeConversionTest < Test::Unit::TestCase
|
9
4
|
|
10
5
|
def test_hex_chars_to_numeric_bytes
|
11
6
|
nibbles = ["4", "5", "9", "3"]
|
12
|
-
bytes = TypeConversion.hex_chars_to_numeric_bytes(nibbles)
|
7
|
+
bytes = Nibbler::TypeConversion.hex_chars_to_numeric_bytes(nibbles)
|
13
8
|
|
14
9
|
assert_equal(["4", "5", "9", "3"], nibbles)
|
15
10
|
assert_equal([0x45, 0x93], bytes)
|
@@ -17,7 +12,7 @@ class TypeConversionTest < Test::Unit::TestCase
|
|
17
12
|
|
18
13
|
def test_hex_str_to_hex_chars
|
19
14
|
str = "904050"
|
20
|
-
nibbles = TypeConversion.send(:hex_str_to_hex_chars, str)
|
15
|
+
nibbles = Nibbler::TypeConversion.send(:hex_str_to_hex_chars, str)
|
21
16
|
|
22
17
|
assert_equal("904050", str)
|
23
18
|
assert_equal(["9", "0", "4", "0", "5", "0"], nibbles)
|
@@ -25,10 +20,10 @@ class TypeConversionTest < Test::Unit::TestCase
|
|
25
20
|
|
26
21
|
def test_numeric_byte_to_hex_chars
|
27
22
|
num = 0x90
|
28
|
-
nibbles = TypeConversion.send(:numeric_byte_to_hex_chars, num)
|
23
|
+
nibbles = Nibbler::TypeConversion.send(:numeric_byte_to_hex_chars, num)
|
29
24
|
|
30
25
|
assert_equal(0x90, num)
|
31
26
|
assert_equal(["9", "0"], nibbles)
|
32
27
|
end
|
33
28
|
|
34
|
-
end
|
29
|
+
end
|