cosmos 3.3.3 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -0
- data/.travis.yml +2 -1
- data/Gemfile +4 -3
- data/Manifest.txt +22 -0
- data/autohotkey/tools/handbook_creator.ahk +9 -0
- data/autohotkey/tools/packet_viewer.ahk +4 -0
- data/bin/exchndl20-x64.dll +0 -0
- data/bin/exchndl20.dll +0 -0
- data/bin/exchndl21-x64.dll +0 -0
- data/bin/exchndl21.dll +0 -0
- data/bin/exchndl22-x64.dll +0 -0
- data/bin/exchndl22.dll +0 -0
- data/bin/mgwhelp-x64.dll +0 -0
- data/bin/mgwhelp.dll +0 -0
- data/cosmos.gemspec +1 -0
- data/data/crc.txt +30 -24
- data/demo/config/data/crc.txt +3 -3
- data/demo/config/tools/handbook_creator/templates/command_packets.html.erb +3 -1
- data/demo/config/tools/handbook_creator/templates/telemetry_packets.html.erb +3 -1
- data/demo/procedures/cosmos_api_test.rb +1 -1
- data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +4 -0
- data/ext/cosmos/ext/platform/platform.c +22 -2
- data/ext/cosmos/ext/structure/structure.c +631 -104
- data/ext/cosmos/ext/telemetry/telemetry.c +3 -2
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +71 -92
- data/lib/cosmos/gui/line_graph/overview_graph.rb +1 -1
- data/lib/cosmos/gui/qt.rb +38 -24
- data/lib/cosmos/gui/text/ruby_editor.rb +1 -1
- data/lib/cosmos/packets/binary_accessor.rb +1 -288
- data/lib/cosmos/packets/telemetry.rb +2 -1
- data/lib/cosmos/script/cmd_tlm_server.rb +110 -0
- data/lib/cosmos/script/commands.rb +166 -0
- data/lib/cosmos/script/extract.rb +2 -2
- data/lib/cosmos/script/limits.rb +108 -0
- data/lib/cosmos/script/script.rb +28 -1487
- data/lib/cosmos/script/scripting.rb +889 -0
- data/lib/cosmos/script/telemetry.rb +174 -0
- data/lib/cosmos/script/tools.rb +138 -0
- data/lib/cosmos/streams/stream_protocol.rb +9 -6
- data/lib/cosmos/system/target.rb +55 -38
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +6 -3
- data/lib/cosmos/tools/cmd_tlm_server/connections.rb +0 -1
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +17 -7
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +15 -4
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +15 -8
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +41 -13
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +18 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +1 -1
- data/lib/cosmos/top_level.rb +1 -1
- data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/spec/gui/line_graph/line_clip_spec.rb +6 -6
- data/spec/gui/qt_spec.rb +102 -0
- data/spec/interfaces/interface_spec.rb +9 -9
- data/spec/interfaces/linc_interface_spec.rb +72 -15
- data/spec/interfaces/serial_interface_spec.rb +9 -9
- data/spec/interfaces/simulated_target_interface_spec.rb +7 -7
- data/spec/interfaces/stream_interface_spec.rb +4 -4
- data/spec/interfaces/tcpip_client_interface_spec.rb +8 -8
- data/spec/interfaces/tcpip_server_interface_spec.rb +9 -9
- data/spec/interfaces/udp_interface_spec.rb +20 -20
- data/spec/io/json_drb_spec.rb +4 -4
- data/spec/io/raw_logger_pair_spec.rb +20 -20
- data/spec/io/raw_logger_spec.rb +3 -3
- data/spec/io/tcpip_server_spec.rb +9 -9
- data/spec/io/udp_sockets_spec.rb +2 -2
- data/spec/io/win32_serial_driver_spec.rb +2 -2
- data/spec/packets/binary_accessor_spec.rb +143 -6
- data/spec/packets/commands_spec.rb +5 -5
- data/spec/packets/limits_spec.rb +15 -15
- data/spec/packets/packet_config_spec.rb +19 -19
- data/spec/packets/packet_item_limits_spec.rb +3 -3
- data/spec/packets/packet_item_spec.rb +4 -4
- data/spec/packets/packet_spec.rb +33 -33
- data/spec/packets/structure_item_spec.rb +19 -19
- data/spec/packets/telemetry_spec.rb +6 -6
- data/spec/script/cmd_tlm_server_spec.rb +110 -0
- data/spec/script/commands_disconnect_spec.rb +270 -0
- data/spec/script/commands_spec.rb +288 -0
- data/spec/script/limits_spec.rb +153 -0
- data/spec/script/script_spec.rb +32 -696
- data/spec/script/scripting_spec.rb +436 -0
- data/spec/script/telemetry_spec.rb +130 -0
- data/spec/script/tools_spec.rb +117 -0
- data/spec/spec_helper.rb +10 -5
- data/spec/streams/preidentified_stream_protocol_spec.rb +4 -4
- data/spec/streams/serial_stream_spec.rb +8 -8
- data/spec/streams/stream_protocol_spec.rb +4 -4
- data/spec/streams/tcpip_client_stream_spec.rb +3 -3
- data/spec/streams/tcpip_socket_stream_spec.rb +7 -7
- data/spec/streams/template_stream_protocol_spec.rb +1 -1
- data/spec/system/system_spec.rb +6 -6
- data/spec/system/target_spec.rb +2 -0
- data/spec/tools/cmd_tlm_server/api_spec.rb +17 -17
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +5 -5
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +3 -3
- data/spec/top_level/top_level_spec.rb +8 -8
- data/spec/utilities/csv_spec.rb +3 -3
- data/spec/utilities/message_log_spec.rb +3 -3
- data/spec/utilities/ruby_lex_utils_spec.rb +7 -7
- data/test/performance/config/tools/launcher/launcher_threads.txt +8 -1
- data/test/performance/tools/CmdTlmServerMemProf +1 -1
- data/test/performance/tools/TlmGrapherMemProf +19 -0
- data/test/performance/tools/TlmGrapherMemProf.bat +59 -0
- metadata +38 -2
data/spec/gui/qt_spec.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
|
11
|
+
require 'spec_helper'
|
12
|
+
require 'cosmos/gui/qt'
|
13
|
+
|
14
|
+
module Cosmos
|
15
|
+
|
16
|
+
describe Qt do
|
17
|
+
describe "Cosmos.getColor" do
|
18
|
+
it "returns a Qt::Color when given a Qt::Color" do
|
19
|
+
expect(Cosmos.getColor(Qt::Color.new('red'))).to be_instance_of(Qt::Color)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns a Qt::Pen when given a Qt::Pen" do
|
23
|
+
expect(Cosmos.getColor(Qt::Pen.new)).to be_instance_of(Qt::Pen)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns a Qt::LinearGradient when given a Qt::LinearGradient" do
|
27
|
+
expect(Cosmos.getColor(Qt::LinearGradient.new)).to be_instance_of(Qt::LinearGradient)
|
28
|
+
end
|
29
|
+
|
30
|
+
context "when given a string" do
|
31
|
+
it "processes 'white'" do
|
32
|
+
expect(Cosmos.getColor('white')).to be_instance_of(Qt::Color)
|
33
|
+
expect(Cosmos.getColor('white').rgb()).to eql 0xFFFFFFFF
|
34
|
+
end
|
35
|
+
it "processes 'black'" do
|
36
|
+
expect(Cosmos.getColor('black')).to be_instance_of(Qt::Color)
|
37
|
+
expect(Cosmos.getColor('black').rgb()).to eql 0xFF000000
|
38
|
+
end
|
39
|
+
it "processes 'red'" do
|
40
|
+
expect(Cosmos.getColor('red')).to be_instance_of(Qt::Color)
|
41
|
+
expect(Cosmos.getColor('red').rgb()).to eql 0xFFFF0000
|
42
|
+
end
|
43
|
+
it "processes 'lime'" do
|
44
|
+
expect(Cosmos.getColor('lime')).to be_instance_of(Qt::Color)
|
45
|
+
expect(Cosmos.getColor('lime').rgb()).to eql 0xFF00FF00
|
46
|
+
end
|
47
|
+
it "processes 'blue'" do
|
48
|
+
expect(Cosmos.getColor('blue')).to be_instance_of(Qt::Color)
|
49
|
+
expect(Cosmos.getColor('blue').rgb()).to eql 0xFF0000FF
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "when given a Qt::Enum" do
|
54
|
+
it "processes Qt::white" do
|
55
|
+
expect(Cosmos.getColor(Qt::white)).to be_instance_of(Qt::Color)
|
56
|
+
expect(Cosmos.getColor(Qt::white).rgb()).to eql 0xFFFFFFFF
|
57
|
+
end
|
58
|
+
it "processes Qt::black" do
|
59
|
+
expect(Cosmos.getColor(Qt::black)).to be_instance_of(Qt::Color)
|
60
|
+
expect(Cosmos.getColor(Qt::black).rgb()).to eql 0xFF000000
|
61
|
+
end
|
62
|
+
it "processes Qt::red" do
|
63
|
+
expect(Cosmos.getColor(Qt::red)).to be_instance_of(Qt::Color)
|
64
|
+
expect(Cosmos.getColor(Qt::red).rgb()).to eql 0xFFFF0000
|
65
|
+
end
|
66
|
+
it "processes Qt::green" do
|
67
|
+
expect(Cosmos.getColor(Qt::green)).to be_instance_of(Qt::Color)
|
68
|
+
expect(Cosmos.getColor(Qt::green).rgb()).to eql 0xFF00FF00
|
69
|
+
end
|
70
|
+
it "processes Qt::blue" do
|
71
|
+
expect(Cosmos.getColor(Qt::blue)).to be_instance_of(Qt::Color)
|
72
|
+
expect(Cosmos.getColor(Qt::blue).rgb()).to eql 0xFF0000FF
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "when given rgb values" do
|
77
|
+
it "processes FF,FF,FF" do
|
78
|
+
expect(Cosmos.getColor(0xFF,0xFF,0xFF)).to be_instance_of(Qt::Color)
|
79
|
+
expect(Cosmos.getColor(0xFF,0xFF,0xFF).rgb()).to eql 0xFFFFFFFF
|
80
|
+
end
|
81
|
+
it "processes 00,00,00 " do
|
82
|
+
expect(Cosmos.getColor(0,0,0)).to be_instance_of(Qt::Color)
|
83
|
+
expect(Cosmos.getColor(0,0,0).rgb()).to eql 0xFF000000
|
84
|
+
end
|
85
|
+
it "processes FF,00,00" do
|
86
|
+
expect(Cosmos.getColor(0xFF,0,0)).to be_instance_of(Qt::Color)
|
87
|
+
expect(Cosmos.getColor(0xFF,0,0).rgb()).to eql 0xFFFF0000
|
88
|
+
end
|
89
|
+
it "processes 00,FF,00" do
|
90
|
+
expect(Cosmos.getColor(0,0xFF,0)).to be_instance_of(Qt::Color)
|
91
|
+
expect(Cosmos.getColor(0,0xFF,0).rgb()).to eql 0xFF00FF00
|
92
|
+
end
|
93
|
+
it "processes 00,00,FF" do
|
94
|
+
expect(Cosmos.getColor(0,0,0xFF)).to be_instance_of(Qt::Color)
|
95
|
+
expect(Cosmos.getColor(0,0,0xFF).rgb()).to eql 0xFF0000FF
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end # module Cosmos
|
@@ -27,10 +27,10 @@ module Cosmos
|
|
27
27
|
expect(i.name).to eql "Cosmos::Interface"
|
28
28
|
expect(i.target_names).to eql []
|
29
29
|
expect(i.thread).to be_nil
|
30
|
-
expect(i.connect_on_startup).to
|
31
|
-
expect(i.auto_reconnect).to
|
30
|
+
expect(i.connect_on_startup).to be true
|
31
|
+
expect(i.auto_reconnect).to be true
|
32
32
|
expect(i.reconnect_delay).to eql 5.0
|
33
|
-
expect(i.disable_disconnect).to
|
33
|
+
expect(i.disable_disconnect).to be false
|
34
34
|
expect(i.packet_log_writer_pairs).to eql []
|
35
35
|
expect(i.routers).to eql []
|
36
36
|
expect(i.read_count).to eql 0
|
@@ -58,19 +58,19 @@ module Cosmos
|
|
58
58
|
|
59
59
|
describe "read_allowed?" do
|
60
60
|
it "is true" do
|
61
|
-
expect(Interface.new.read_allowed?).to
|
61
|
+
expect(Interface.new.read_allowed?).to be true
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe "write_allowed?" do
|
66
66
|
it "is true" do
|
67
|
-
expect(Interface.new.write_allowed?).to
|
67
|
+
expect(Interface.new.write_allowed?).to be true
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "write_raw_allowed?" do
|
72
72
|
it "is true" do
|
73
|
-
expect(Interface.new.write_raw_allowed?).to
|
73
|
+
expect(Interface.new.write_raw_allowed?).to be true
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -100,10 +100,10 @@ module Cosmos
|
|
100
100
|
expect(i2.name).to eql 'TEST'
|
101
101
|
expect(i2.target_names).to eql ['TGT1','TGT2']
|
102
102
|
expect(i2.thread).to be_nil # Thread does not get copied
|
103
|
-
expect(i2.connect_on_startup).to
|
104
|
-
expect(i2.auto_reconnect).to
|
103
|
+
expect(i2.connect_on_startup).to be false
|
104
|
+
expect(i2.auto_reconnect).to be false
|
105
105
|
expect(i2.reconnect_delay).to eql 1.0
|
106
|
-
expect(i2.disable_disconnect).to
|
106
|
+
expect(i2.disable_disconnect).to be true
|
107
107
|
expect(i2.packet_log_writer_pairs).to eql [1,2]
|
108
108
|
expect(i2.routers).to eql [3,4]
|
109
109
|
expect(i2.read_count).to eql 1
|
@@ -28,25 +28,25 @@ module Cosmos
|
|
28
28
|
expect(stream).to receive(:raw_logger_pair=) { nil }
|
29
29
|
i = LincInterface.new('localhost','8888')
|
30
30
|
i.target_names << "INST"
|
31
|
-
expect(i.connected?).to
|
31
|
+
expect(i.connected?).to be false
|
32
32
|
i.connect
|
33
|
-
expect(i.connected?).to
|
33
|
+
expect(i.connected?).to be true
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "write" do
|
38
38
|
before(:each) do
|
39
|
-
stream = double("stream")
|
40
|
-
allow(stream).to receive(:connect)
|
41
|
-
expect(TcpipClientStream).to receive(:new) { stream }
|
42
|
-
allow(stream).to receive(:connected?) { true }
|
43
|
-
allow(stream).to receive(:write)
|
44
|
-
expect(stream).to receive(:raw_logger_pair=) { nil }
|
39
|
+
@stream = double("stream")
|
40
|
+
allow(@stream).to receive(:connect)
|
41
|
+
expect(TcpipClientStream).to receive(:new) { @stream }
|
42
|
+
allow(@stream).to receive(:connected?) { true }
|
43
|
+
allow(@stream).to receive(:write)
|
44
|
+
expect(@stream).to receive(:raw_logger_pair=) { nil }
|
45
45
|
@i = LincInterface.new('localhost','8888','true','2','nil','5','0','16','4','GSE_HDR_GUID','BIG_ENDIAN','GSE_HDR_LEN')
|
46
46
|
@i.target_names << "INST"
|
47
|
-
expect(@i.connected?).to
|
47
|
+
expect(@i.connected?).to be false
|
48
48
|
@i.connect
|
49
|
-
expect(@i.connected?).to
|
49
|
+
expect(@i.connected?).to be true
|
50
50
|
end
|
51
51
|
|
52
52
|
it "returns an exception if its not connected" do
|
@@ -79,11 +79,11 @@ module Cosmos
|
|
79
79
|
disable.restore_defaults
|
80
80
|
|
81
81
|
@i.write(enable)
|
82
|
-
expect(@i.instance_variable_get(:@handshake_enabled)).to
|
82
|
+
expect(@i.instance_variable_get(:@handshake_enabled)).to be true
|
83
83
|
@i.write(disable)
|
84
|
-
expect(@i.instance_variable_get(:@handshake_enabled)).to
|
84
|
+
expect(@i.instance_variable_get(:@handshake_enabled)).to be false
|
85
85
|
@i.write(enable)
|
86
|
-
expect(@i.instance_variable_get(:@handshake_enabled)).to
|
86
|
+
expect(@i.instance_variable_get(:@handshake_enabled)).to be true
|
87
87
|
end
|
88
88
|
|
89
89
|
it "timeouts waiting for handshake" do
|
@@ -107,6 +107,7 @@ module Cosmos
|
|
107
107
|
@cmd = System.commands.packet("INST","LINC_COMMAND")
|
108
108
|
@cmd.restore_defaults
|
109
109
|
@cmd.write("GSE_HDR_GUID",0xDEADBEEF)
|
110
|
+
@cmd.write("DATA",1)
|
110
111
|
@handshake = System.telemetry.packet("INST","HANDSHAKE")
|
111
112
|
@handshake.write("GSE_HDR_ID", 1001)
|
112
113
|
@handshake.write("STATUS","OK")
|
@@ -134,6 +135,62 @@ module Cosmos
|
|
134
135
|
t.join
|
135
136
|
end
|
136
137
|
|
138
|
+
it "handles two simultaneous writes" do
|
139
|
+
cmd2 = @cmd.clone
|
140
|
+
cmd2.write("GSE_HDR_GUID",0xBA5EBA11)
|
141
|
+
cmd2.write("DATA",2)
|
142
|
+
handshake2 = @handshake.clone
|
143
|
+
handshake2.write("GSE_HDR_ID", 1001)
|
144
|
+
buffer = ''
|
145
|
+
buffer << ["INST".length].pack("C")
|
146
|
+
buffer << "INST"
|
147
|
+
buffer << ["LINC_COMMAND".length].pack("C")
|
148
|
+
buffer << "LINC_COMMAND"
|
149
|
+
buffer << [cmd2.buffer.length].pack("N")
|
150
|
+
buffer << cmd2.buffer
|
151
|
+
buffer << [3].pack("N")
|
152
|
+
buffer << "BAD"
|
153
|
+
handshake2.write("DATA", buffer)
|
154
|
+
|
155
|
+
read_cnt = 0
|
156
|
+
write_cnt = 0
|
157
|
+
allow_any_instance_of(LengthStreamProtocol).to receive(:read) do
|
158
|
+
read_cnt += 1
|
159
|
+
result = nil
|
160
|
+
result = handshake2 if read_cnt == 1
|
161
|
+
result = @handshake if read_cnt == 2
|
162
|
+
result
|
163
|
+
end
|
164
|
+
|
165
|
+
# Create new thread for each write
|
166
|
+
t1 = Thread.new do
|
167
|
+
expect(@stream).to receive(:write) do
|
168
|
+
write_cnt += 1
|
169
|
+
end
|
170
|
+
@i.write(cmd2)
|
171
|
+
end
|
172
|
+
# Create new thread for each write
|
173
|
+
t2 = Thread.new do
|
174
|
+
expect(@stream).to receive(:write) do
|
175
|
+
write_cnt += 1
|
176
|
+
end
|
177
|
+
@i.write(@cmd)
|
178
|
+
end
|
179
|
+
|
180
|
+
sleep 0.5
|
181
|
+
# Expect both write threads have written
|
182
|
+
expect(write_cnt).to eql 2
|
183
|
+
# But no handshakes have been received
|
184
|
+
expect(read_cnt).to eql 0
|
185
|
+
|
186
|
+
# Now read the handshakes and allow the reads to complete
|
187
|
+
@i.read
|
188
|
+
@i.read
|
189
|
+
t1.join
|
190
|
+
t2.join
|
191
|
+
expect(read_cnt).to eql 2
|
192
|
+
end
|
193
|
+
|
137
194
|
it "warns if an error code is set" do
|
138
195
|
expect(Logger).to receive(:warn) do |msg|
|
139
196
|
expect(msg).to eql "Warning sending command (12345): BAD"
|
@@ -168,9 +225,9 @@ module Cosmos
|
|
168
225
|
expect(stream).to receive(:raw_logger_pair=) { nil }
|
169
226
|
@i = LincInterface.new('localhost','8888','true','2','nil','5','0','16','4','GSE_HDR_GUID','BIG_ENDIAN','GSE_HDR_LEN')
|
170
227
|
@i.target_names << "INST"
|
171
|
-
expect(@i.connected?).to
|
228
|
+
expect(@i.connected?).to be false
|
172
229
|
@i.connect
|
173
|
-
expect(@i.connected?).to
|
230
|
+
expect(@i.connected?).to be true
|
174
231
|
end
|
175
232
|
|
176
233
|
it "handles local commands" do
|
@@ -24,17 +24,17 @@ module Cosmos
|
|
24
24
|
it "is not writeable if no write port given" do
|
25
25
|
i = SerialInterface.new('nil','COM1','9600','NONE','1','0','0','burst')
|
26
26
|
expect(i.name).to eql "Cosmos::SerialInterface"
|
27
|
-
expect(i.write_allowed?).to
|
28
|
-
expect(i.write_raw_allowed?).to
|
29
|
-
expect(i.read_allowed?).to
|
27
|
+
expect(i.write_allowed?).to be false
|
28
|
+
expect(i.write_raw_allowed?).to be false
|
29
|
+
expect(i.read_allowed?).to be true
|
30
30
|
end
|
31
31
|
|
32
32
|
it "is not readable if no read port given" do
|
33
33
|
i = SerialInterface.new('COM1','nil','9600','NONE','1','0','0','burst')
|
34
34
|
expect(i.name).to eql "Cosmos::SerialInterface"
|
35
|
-
expect(i.write_allowed?).to
|
36
|
-
expect(i.write_raw_allowed?).to
|
37
|
-
expect(i.read_allowed?).to
|
35
|
+
expect(i.write_allowed?).to be true
|
36
|
+
expect(i.write_raw_allowed?).to be true
|
37
|
+
expect(i.read_allowed?).to be false
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -43,11 +43,11 @@ module Cosmos
|
|
43
43
|
# Ensure the 'NONE' parity is coverted to a symbol
|
44
44
|
if Kernel.is_windows?
|
45
45
|
i = SerialInterface.new('COM1','COM1','9600','NONE','1','0','0','burst')
|
46
|
-
expect(i.connected?).to
|
46
|
+
expect(i.connected?).to be false
|
47
47
|
i.connect
|
48
|
-
expect(i.connected?).to
|
48
|
+
expect(i.connected?).to be true
|
49
49
|
i.disconnect
|
50
|
-
expect(i.connected?).to
|
50
|
+
expect(i.connected?).to be false
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -66,9 +66,9 @@ end
|
|
66
66
|
it "initiallies be false" do
|
67
67
|
sti = SimulatedTargetInterface.new("test_inst.rb")
|
68
68
|
sti.target_names = ['COSMOS']
|
69
|
-
expect(sti.connected?).to
|
69
|
+
expect(sti.connected?).to be false
|
70
70
|
sti.connect
|
71
|
-
expect(sti.connected?).to
|
71
|
+
expect(sti.connected?).to be true
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -80,7 +80,7 @@ end
|
|
80
80
|
it "returns a simulated packet" do
|
81
81
|
sti = SimulatedTargetInterface.new("test_inst.rb")
|
82
82
|
sti.target_names = ['COSMOS']
|
83
|
-
expect(sti.connected?).to
|
83
|
+
expect(sti.connected?).to be false
|
84
84
|
sti.connect
|
85
85
|
pkt = sti.read
|
86
86
|
expect(pkt.target_name).to eql "COSMOS"
|
@@ -99,7 +99,7 @@ end
|
|
99
99
|
it "writes commands to the simulator" do
|
100
100
|
sti = SimulatedTargetInterface.new("test_inst.rb")
|
101
101
|
sti.target_names = ['COSMOS']
|
102
|
-
expect(sti.connected?).to
|
102
|
+
expect(sti.connected?).to be false
|
103
103
|
sti.connect
|
104
104
|
sti.write(Packet.new("COSMOS","SETLOGLABEL"))
|
105
105
|
end
|
@@ -115,11 +115,11 @@ end
|
|
115
115
|
it "disconnects from the simulator" do
|
116
116
|
sti = SimulatedTargetInterface.new("test_inst.rb")
|
117
117
|
sti.target_names = ['COSMOS']
|
118
|
-
expect(sti.connected?).to
|
118
|
+
expect(sti.connected?).to be false
|
119
119
|
sti.connect
|
120
|
-
expect(sti.connected?).to
|
120
|
+
expect(sti.connected?).to be true
|
121
121
|
sti.disconnect
|
122
|
-
expect(sti.connected?).to
|
122
|
+
expect(sti.connected?).to be false
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -112,24 +112,24 @@ module Cosmos
|
|
112
112
|
# Ensure we reload since TestStreamProtocol is used throughout
|
113
113
|
load @file
|
114
114
|
|
115
|
-
expect($disconnect).to
|
115
|
+
expect($disconnect).to be false
|
116
116
|
si = StreamInterface.new("test")
|
117
117
|
begin
|
118
118
|
si.write(nil)
|
119
119
|
rescue
|
120
120
|
end
|
121
121
|
expect(si.write_count).to eql 0
|
122
|
-
expect($disconnect).to
|
122
|
+
expect($disconnect).to be true
|
123
123
|
|
124
124
|
$disconnect = false
|
125
|
-
expect($disconnect).to
|
125
|
+
expect($disconnect).to be false
|
126
126
|
si = StreamInterface.new("test")
|
127
127
|
begin
|
128
128
|
si.write_raw(nil)
|
129
129
|
rescue
|
130
130
|
end
|
131
131
|
expect(si.write_count).to eql 0
|
132
|
-
expect($disconnect).to
|
132
|
+
expect($disconnect).to be true
|
133
133
|
end
|
134
134
|
|
135
135
|
it "writes to the stream interface and count the packet" do
|
@@ -23,17 +23,17 @@ module Cosmos
|
|
23
23
|
it "is not writeable if no write port given" do
|
24
24
|
i = TcpipClientInterface.new('localhost','nil','8889','nil','5','burst')
|
25
25
|
expect(i.name).to eql "Cosmos::TcpipClientInterface"
|
26
|
-
expect(i.write_allowed?).to
|
27
|
-
expect(i.write_raw_allowed?).to
|
28
|
-
expect(i.read_allowed?).to
|
26
|
+
expect(i.write_allowed?).to be false
|
27
|
+
expect(i.write_raw_allowed?).to be false
|
28
|
+
expect(i.read_allowed?).to be true
|
29
29
|
end
|
30
30
|
|
31
31
|
it "is not readable if no read port given" do
|
32
32
|
i = TcpipClientInterface.new('localhost','8888','nil','5','nil','burst')
|
33
33
|
expect(i.name).to eql "Cosmos::TcpipClientInterface"
|
34
|
-
expect(i.write_allowed?).to
|
35
|
-
expect(i.write_raw_allowed?).to
|
36
|
-
expect(i.read_allowed?).to
|
34
|
+
expect(i.write_allowed?).to be true
|
35
|
+
expect(i.write_raw_allowed?).to be true
|
36
|
+
expect(i.read_allowed?).to be false
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -45,9 +45,9 @@ module Cosmos
|
|
45
45
|
expect(stream).to receive(:connected?) { true }
|
46
46
|
expect(stream).to receive(:raw_logger_pair=) { nil }
|
47
47
|
i = TcpipClientInterface.new('localhost','8888','8889','5','5','burst')
|
48
|
-
expect(i.connected?).to
|
48
|
+
expect(i.connected?).to be false
|
49
49
|
i.connect
|
50
|
-
expect(i.connected?).to
|
50
|
+
expect(i.connected?).to be true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -28,17 +28,17 @@ module Cosmos
|
|
28
28
|
it "is not writeable if no write port given" do
|
29
29
|
i = TcpipServerInterface.new('nil','8889','nil','5','burst')
|
30
30
|
expect(i.name).to eql "Cosmos::TcpipServerInterface"
|
31
|
-
expect(i.write_allowed?).to
|
32
|
-
expect(i.write_raw_allowed?).to
|
33
|
-
expect(i.read_allowed?).to
|
31
|
+
expect(i.write_allowed?).to be false
|
32
|
+
expect(i.write_raw_allowed?).to be false
|
33
|
+
expect(i.read_allowed?).to be true
|
34
34
|
end
|
35
35
|
|
36
36
|
it "is not readable if no read port given" do
|
37
37
|
i = TcpipServerInterface.new('8888','nil','5','nil','burst')
|
38
38
|
expect(i.name).to eql "Cosmos::TcpipServerInterface"
|
39
|
-
expect(i.write_allowed?).to
|
40
|
-
expect(i.write_raw_allowed?).to
|
41
|
-
expect(i.read_allowed?).to
|
39
|
+
expect(i.write_allowed?).to be true
|
40
|
+
expect(i.write_raw_allowed?).to be true
|
41
|
+
expect(i.read_allowed?).to be false
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -56,11 +56,11 @@ module Cosmos
|
|
56
56
|
expect(@stream).to receive(:write_queue_size).and_return(50)
|
57
57
|
expect(@stream).to receive(:raw_logger_pair=) { nil }
|
58
58
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
59
|
-
expect(i.connected?).to
|
59
|
+
expect(i.connected?).to be false
|
60
60
|
i.connect
|
61
|
-
expect(i.connected?).to
|
61
|
+
expect(i.connected?).to be true
|
62
62
|
i.disconnect
|
63
|
-
expect(i.connected?).to
|
63
|
+
expect(i.connected?).to be false
|
64
64
|
i.bytes_read = 1000
|
65
65
|
i.bytes_written = 2000
|
66
66
|
expect(i.bytes_read).to eql 10
|