|
6 | 6 | let(:simulator) { described_class.new }
|
7 | 7 |
|
8 | 8 | describe '#response_counter' do
|
9 |
| - it '256の次は0になること' do |
10 |
| - 255.times do |
| 9 | + it '255の次は0になること' do |
| 10 | + 254.times do |
11 | 11 | simulator.send(:response_counter)
|
12 | 12 | end
|
13 |
| - |
14 |
| - expect(simulator.send(:response_counter)).to eq("256") |
15 |
| - expect(simulator.send(:response_counter)).to eq("00") |
| 13 | + expect(simulator.send(:response_counter)).to eq("255") |
| 14 | + expect(simulator.send(:response_counter)).to eq("0") |
16 | 15 | end
|
17 | 16 | end
|
18 | 17 |
|
|
72 | 71 | expect(simulator.read_once).to eq("0000")
|
73 | 72 | expect(simulator.read_once).to match("8101000300005e00535e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
74 | 73 | expect(simulator.read_once).to match("81020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
75 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}800300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-03 |
76 |
| - expect(simulator.read_once).to match(nil) |
77 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}804800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-48 |
78 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}820203480302#{procon_mac_addr.reverse}030100000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-02 |
79 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}800800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-08 |
80 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}90100060000010ffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000/) # 01-10-0060, Serial number |
81 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}90105060000010bc114275a928ffffffffffffff00000000000000000000000000000000000000000000000000000000000000/) # Controller Color |
82 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}810103000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-01, Bluetooth manual pairing |
83 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}83040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-04, Trigger buttons elapsed time |
84 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}9010806000001050fd0000c60f0f30619630f3d41454411554c7799c333663000000000000000000000000000000000000000/) # 01-10-8060, Factory Sensor and Stick device parameters |
85 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}901098600000100f30619630f3d41454411554c7799c333663000000000000000000000000000000000000000000000000000/) # 01-10-9860, Factory Stick device parameters 2 |
86 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}90101080000010ffffffffffffffffffffffffffffffffffffffffffffb2a1000000000000000000000000000000000000000/) # 01-10-1080, User Analog sticks calibration |
87 |
| - expect(simulator.read_once).to be_nil # unkown |
88 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}90103d60000010ba156211b87f29065bffe77e0e36569e8560ff323232ffffff0000000000000000000000000000000000000/) # 01-10-3d60, Factory configuration & calibration 2 |
89 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}90102880000010beff3e00f001004000400040fefffeff0800e73be73be73b000000000000000000000000000000000000000/) # 01-10-2880, User 6-Axis Motion Sensor calibration |
90 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}80400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
91 |
| - expect(simulator.read_once).to be_nil # unkown |
92 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}80480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
93 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}80480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
94 |
| - expect(simulator.read_once).to match(/^21..#{initial_input}80300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
| 74 | + expect(simulator.read_once).to match(/^21.#{initial_input}8003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-03 |
| 75 | + expect(simulator.read_once).to match(nil) |
| 76 | + expect(simulator.read_once).to match(/^21.#{initial_input}804800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-48 |
| 77 | + expect(simulator.read_once).to match(/^21.#{initial_input}820203480302#{procon_mac_addr.reverse}0301000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-02 |
| 78 | + expect(simulator.read_once).to match(/^21.#{initial_input}8008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-08 |
| 79 | + expect(simulator.read_once).to match(/^21.#{initial_input}90100060000010ffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000/) # 01-10-0060, Serial number |
| 80 | + expect(simulator.read_once).to match(/^21.#{initial_input}90105060000010bc114275a928ffffffffffffff000000000000000000000000000000000000000000000000000000000000000/) # Controller Color |
| 81 | + expect(simulator.read_once).to match(/^21.#{initial_input}8101030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-01, Bluetooth manual pairing |
| 82 | + expect(simulator.read_once).to match(/^21.#{initial_input}830400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-04, Trigger buttons elapsed time |
| 83 | + expect(simulator.read_once).to match(/^21.#{initial_input}9010806000001050fd0000c60f0f30619630f3d41454411554c7799c3336630000000000000000000000000000000000000000/) # 01-10-8060, Factory Sensor and Stick device parameters |
| 84 | + expect(simulator.read_once).to match(/^21..?#{initial_input}901098600000100f30619630f3d41454411554c7799c3336630000000000000000000000000000000000000000000000000000/) # 01-10-9860, Factory Stick device parameters 2 |
| 85 | + expect(simulator.read_once).to match(/^21..?#{initial_input}90101080000010ffffffffffffffffffffffffffffffffffffffffffffb2a10000000000000000000000000000000000000000/) # 01-10-1080, User Analog sticks calibration |
| 86 | + expect(simulator.read_once).to be_nil # unkown |
| 87 | + expect(simulator.read_once).to match(/^21..?#{initial_input}90103d60000010ba156211b87f29065bffe77e0e36569e8560ff323232ffffff00000000000000000000000000000000000000/) # 01-10-3d60, Factory configuration & calibration 2 |
| 88 | + expect(simulator.read_once).to match(/^21..?#{initial_input}90102880000010beff3e00f001004000400040fefffeff0800e73be73be73b0000000000000000000000000000000000000000/) # 01-10-2880, User 6-Axis Motion Sensor calibration |
| 89 | + expect(simulator.read_once).to match(/^21..?#{initial_input}804000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
| 90 | + expect(simulator.read_once).to be_nil # unkown |
| 91 | + expect(simulator.read_once).to match(/^21..?#{initial_input}804800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
| 92 | + expect(simulator.read_once).to match(/^21..?#{initial_input}804800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
| 93 | + expect(simulator.read_once).to match(/^21..?#{initial_input}803000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/) # 01-40 |
95 | 94 | end
|
96 | 95 | end
|
97 | 96 | end
|
|
0 commit comments