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
@@ -324,22 +324,22 @@ module Cosmos
|
|
324
324
|
|
325
325
|
it "returns true if the command overall is hazardous" do
|
326
326
|
hazardous, description = @cmd.cmd_hazardous?("TGT1","PKT1")
|
327
|
-
expect(hazardous).to
|
327
|
+
expect(hazardous).to be false
|
328
328
|
expect(description).to be_nil
|
329
329
|
hazardous, description = @cmd.cmd_hazardous?("tgt2","pkt3")
|
330
|
-
expect(hazardous).to
|
330
|
+
expect(hazardous).to be true
|
331
331
|
expect(description).to eql "Hazardous"
|
332
332
|
end
|
333
333
|
|
334
334
|
it "returns true if a command parameter is hazardous" do
|
335
335
|
hazardous, description = @cmd.cmd_hazardous?("TGT1","PKT2",{"ITEM2"=>0})
|
336
|
-
expect(hazardous).to
|
336
|
+
expect(hazardous).to be true
|
337
337
|
expect(description).to eql "Hazardous"
|
338
338
|
hazardous, description = @cmd.cmd_hazardous?("TGT1","PKT2",{"ITEM2"=>1})
|
339
|
-
expect(hazardous).to
|
339
|
+
expect(hazardous).to be true
|
340
340
|
expect(description).to eql ""
|
341
341
|
hazardous, description = @cmd.cmd_hazardous?("TGT1","PKT2",{"ITEM2"=>2})
|
342
|
-
expect(hazardous).to
|
342
|
+
expect(hazardous).to be false
|
343
343
|
expect(description).to be_nil
|
344
344
|
end
|
345
345
|
end
|
data/spec/packets/limits_spec.rb
CHANGED
@@ -193,11 +193,11 @@ module Cosmos
|
|
193
193
|
it "enables limits for all items in the group" do
|
194
194
|
@limits.enable_group("group1")
|
195
195
|
pkt = @tlm.packet("TGT1","PKT1")
|
196
|
-
expect(pkt.get_item("ITEM1").limits.enabled).to
|
197
|
-
expect(pkt.get_item("ITEM2").limits.enabled).to
|
198
|
-
expect(pkt.get_item("ITEM3").limits.enabled).to
|
199
|
-
expect(pkt.get_item("ITEM4").limits.enabled).to
|
200
|
-
expect(pkt.get_item("ITEM5").limits.enabled).to
|
196
|
+
expect(pkt.get_item("ITEM1").limits.enabled).to be true
|
197
|
+
expect(pkt.get_item("ITEM2").limits.enabled).to be true
|
198
|
+
expect(pkt.get_item("ITEM3").limits.enabled).to be true
|
199
|
+
expect(pkt.get_item("ITEM4").limits.enabled).to be true
|
200
|
+
expect(pkt.get_item("ITEM5").limits.enabled).to be false
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -210,12 +210,12 @@ module Cosmos
|
|
210
210
|
pkt = @tlm.packet("TGT1","PKT1")
|
211
211
|
pkt.enable_limits("ITEM1")
|
212
212
|
pkt.enable_limits("ITEM2")
|
213
|
-
expect(pkt.get_item("ITEM1").limits.enabled).to
|
214
|
-
expect(pkt.get_item("ITEM2").limits.enabled).to
|
213
|
+
expect(pkt.get_item("ITEM1").limits.enabled).to be true
|
214
|
+
expect(pkt.get_item("ITEM2").limits.enabled).to be true
|
215
215
|
|
216
216
|
@limits.disable_group("group1")
|
217
|
-
expect(pkt.get_item("ITEM1").limits.enabled).to
|
218
|
-
expect(pkt.get_item("ITEM2").limits.enabled).to
|
217
|
+
expect(pkt.get_item("ITEM1").limits.enabled).to be false
|
218
|
+
expect(pkt.get_item("ITEM2").limits.enabled).to be false
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
@@ -234,9 +234,9 @@ module Cosmos
|
|
234
234
|
|
235
235
|
it "returns whether limits are enable for an item" do
|
236
236
|
pkt = @tlm.packet("TGT1","PKT1")
|
237
|
-
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to
|
237
|
+
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to be false
|
238
238
|
pkt.enable_limits("ITEM5")
|
239
|
-
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to
|
239
|
+
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to be true
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
@@ -255,9 +255,9 @@ module Cosmos
|
|
255
255
|
|
256
256
|
it "enables limits for an item" do
|
257
257
|
pkt = @tlm.packet("TGT1","PKT1")
|
258
|
-
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to
|
258
|
+
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to be false
|
259
259
|
@limits.enable("TGT1","PKT1","ITEM5")
|
260
|
-
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to
|
260
|
+
expect(@limits.enabled?("TGT1","PKT1","ITEM5")).to be true
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
@@ -277,9 +277,9 @@ module Cosmos
|
|
277
277
|
it "disables limits for an item" do
|
278
278
|
pkt = @tlm.packet("TGT1","PKT1")
|
279
279
|
@limits.enable("TGT1","PKT1","ITEM1")
|
280
|
-
expect(@limits.enabled?("TGT1","PKT1","ITEM1")).to
|
280
|
+
expect(@limits.enabled?("TGT1","PKT1","ITEM1")).to be true
|
281
281
|
@limits.disable("TGT1","PKT1","ITEM1")
|
282
|
-
expect(@limits.enabled?("TGT1","PKT1","ITEM1")).to
|
282
|
+
expect(@limits.enabled?("TGT1","PKT1","ITEM1")).to be false
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
@@ -355,8 +355,8 @@ module Cosmos
|
|
355
355
|
tf.puts 'TELEMETRY tgt1 pkt2 LITTLE_ENDIAN "Description"'
|
356
356
|
tf.close
|
357
357
|
@pc.process_file(tf.path, "TGT1")
|
358
|
-
expect(@pc.telemetry["TGT1"]["PKT1"].short_buffer_allowed).to
|
359
|
-
expect(@pc.telemetry["TGT1"]["PKT2"].short_buffer_allowed).to
|
358
|
+
expect(@pc.telemetry["TGT1"]["PKT1"].short_buffer_allowed).to be true
|
359
|
+
expect(@pc.telemetry["TGT1"]["PKT2"].short_buffer_allowed).to be false
|
360
360
|
tf.unlink
|
361
361
|
end
|
362
362
|
end
|
@@ -384,8 +384,8 @@ module Cosmos
|
|
384
384
|
tf.puts 'COMMAND tgt1 pkt2 LITTLE_ENDIAN "Description"'
|
385
385
|
tf.close
|
386
386
|
@pc.process_file(tf.path, "TGT1")
|
387
|
-
expect(@pc.commands["TGT1"]["PKT1"].messages_disabled).to
|
388
|
-
expect(@pc.commands["TGT1"]["PKT2"].messages_disabled).to
|
387
|
+
expect(@pc.commands["TGT1"]["PKT1"].messages_disabled).to be true
|
388
|
+
expect(@pc.commands["TGT1"]["PKT2"].messages_disabled).to be false
|
389
389
|
tf.unlink
|
390
390
|
end
|
391
391
|
end
|
@@ -398,10 +398,10 @@ module Cosmos
|
|
398
398
|
tf.puts 'COMMAND tgt1 pkt2 LITTLE_ENDIAN "Description"'
|
399
399
|
tf.close
|
400
400
|
@pc.process_file(tf.path, "TGT1")
|
401
|
-
expect(@pc.commands["TGT1"]["PKT1"].hidden).to
|
402
|
-
expect(@pc.commands["TGT1"]["PKT1"].disabled).to
|
403
|
-
expect(@pc.commands["TGT1"]["PKT2"].hidden).to
|
404
|
-
expect(@pc.commands["TGT1"]["PKT2"].disabled).to
|
401
|
+
expect(@pc.commands["TGT1"]["PKT1"].hidden).to be true
|
402
|
+
expect(@pc.commands["TGT1"]["PKT1"].disabled).to be false
|
403
|
+
expect(@pc.commands["TGT1"]["PKT2"].hidden).to be false
|
404
|
+
expect(@pc.commands["TGT1"]["PKT2"].disabled).to be false
|
405
405
|
tf.unlink
|
406
406
|
end
|
407
407
|
end
|
@@ -414,10 +414,10 @@ module Cosmos
|
|
414
414
|
tf.puts 'COMMAND tgt1 pkt2 LITTLE_ENDIAN "Description"'
|
415
415
|
tf.close
|
416
416
|
@pc.process_file(tf.path, "TGT1")
|
417
|
-
expect(@pc.commands["TGT1"]["PKT1"].hidden).to
|
418
|
-
expect(@pc.commands["TGT1"]["PKT1"].disabled).to
|
419
|
-
expect(@pc.commands["TGT1"]["PKT2"].hidden).to
|
420
|
-
expect(@pc.commands["TGT1"]["PKT2"].disabled).to
|
417
|
+
expect(@pc.commands["TGT1"]["PKT1"].hidden).to be true
|
418
|
+
expect(@pc.commands["TGT1"]["PKT1"].disabled).to be true
|
419
|
+
expect(@pc.commands["TGT1"]["PKT2"].hidden).to be false
|
420
|
+
expect(@pc.commands["TGT1"]["PKT2"].disabled).to be false
|
421
421
|
tf.unlink
|
422
422
|
end
|
423
423
|
end
|
@@ -433,10 +433,10 @@ module Cosmos
|
|
433
433
|
tf.puts 'COMMAND tgt2 pkt2 LITTLE_ENDIAN "Description"'
|
434
434
|
tf.close
|
435
435
|
@pc.process_file(tf.path, "SYSTEM")
|
436
|
-
expect(@pc.telemetry["TGT1"]["PKT1"].hazardous).to
|
437
|
-
expect(@pc.telemetry["TGT1"]["PKT2"].hazardous).to
|
438
|
-
expect(@pc.commands["TGT2"]["PKT1"].hazardous).to
|
439
|
-
expect(@pc.commands["TGT2"]["PKT2"].hazardous).to
|
436
|
+
expect(@pc.telemetry["TGT1"]["PKT1"].hazardous).to be true
|
437
|
+
expect(@pc.telemetry["TGT1"]["PKT2"].hazardous).to be false
|
438
|
+
expect(@pc.commands["TGT2"]["PKT1"].hazardous).to be true
|
439
|
+
expect(@pc.commands["TGT2"]["PKT2"].hazardous).to be false
|
440
440
|
tf.unlink
|
441
441
|
end
|
442
442
|
|
@@ -446,7 +446,7 @@ module Cosmos
|
|
446
446
|
tf.puts 'HAZARDOUS "Hazardous description"'
|
447
447
|
tf.close
|
448
448
|
@pc.process_file(tf.path, "TGT1")
|
449
|
-
expect(@pc.commands["TGT1"]["PKT1"].hazardous).to
|
449
|
+
expect(@pc.commands["TGT1"]["PKT1"].hazardous).to be true
|
450
450
|
expect(@pc.commands["TGT1"]["PKT1"].hazardous_description).to eql "Hazardous description"
|
451
451
|
tf.unlink
|
452
452
|
end
|
@@ -735,8 +735,8 @@ module Cosmos
|
|
735
735
|
tf.puts ' PARAMETER item2 0 8 UINT 0 1 1'
|
736
736
|
tf.close
|
737
737
|
@pc.process_file(tf.path, "TGT1")
|
738
|
-
expect(@pc.commands["TGT1"]["PKT1"].items["ITEM1"].required).to
|
739
|
-
expect(@pc.commands["TGT1"]["PKT1"].items["ITEM2"].required).to
|
738
|
+
expect(@pc.commands["TGT1"]["PKT1"].items["ITEM1"].required).to be true
|
739
|
+
expect(@pc.commands["TGT1"]["PKT1"].items["ITEM2"].required).to be false
|
740
740
|
tf.unlink
|
741
741
|
end
|
742
742
|
end
|
@@ -63,7 +63,7 @@ module Cosmos
|
|
63
63
|
it "accepts LimitsResponse instances" do
|
64
64
|
r = LimitsResponse.new()
|
65
65
|
@l.response = r
|
66
|
-
expect(LimitsResponse === @l.response).to
|
66
|
+
expect(LimitsResponse === @l.response).to be true
|
67
67
|
end
|
68
68
|
|
69
69
|
it "sets the response to nil" do
|
@@ -132,7 +132,7 @@ module Cosmos
|
|
132
132
|
hash = @l.to_hash
|
133
133
|
expect(hash.keys.length).to eql 6
|
134
134
|
expect(hash.keys).to include('values','enabled','state','response','persistence_setting','persistence_count')
|
135
|
-
expect(hash["enabled"]).to
|
135
|
+
expect(hash["enabled"]).to be true
|
136
136
|
expect(hash["values"]).to include(:DEFAULT => [0,1,2,3,4,5])
|
137
137
|
expect(hash["state"]).to eql :RED_LOW
|
138
138
|
expect(hash["response"]).to match "LimitsResponse"
|
@@ -148,7 +148,7 @@ module Cosmos
|
|
148
148
|
@l.persistence_count = 2
|
149
149
|
|
150
150
|
hash = @l.to_hash
|
151
|
-
expect(hash["enabled"]).to
|
151
|
+
expect(hash["enabled"]).to be true
|
152
152
|
expect(hash["values"]).to include(:DEFAULT => [0,1,2,3,4,5])
|
153
153
|
expect(hash["state"]).to eql :RED_LOW
|
154
154
|
expect(hash["response"]).to be_nil
|
@@ -46,7 +46,7 @@ module Cosmos
|
|
46
46
|
it "accepts Conversion instances" do
|
47
47
|
c = GenericConversion.new("value / 2")
|
48
48
|
@pi.read_conversion = c
|
49
|
-
expect(@pi.read_conversion.to_s == c.to_s).to
|
49
|
+
expect(@pi.read_conversion.to_s == c.to_s).to be true
|
50
50
|
end
|
51
51
|
|
52
52
|
it "sets the read_conversion to nil" do
|
@@ -63,7 +63,7 @@ module Cosmos
|
|
63
63
|
it "accepts Conversion instances" do
|
64
64
|
c = GenericConversion.new("value / 2")
|
65
65
|
@pi.write_conversion = c
|
66
|
-
expect(@pi.write_conversion.to_s == c.to_s).to
|
66
|
+
expect(@pi.write_conversion.to_s == c.to_s).to be true
|
67
67
|
end
|
68
68
|
|
69
69
|
it "sets the write_conversion to nil" do
|
@@ -324,7 +324,7 @@ module Cosmos
|
|
324
324
|
describe "clone" do
|
325
325
|
it "duplicates the entire PacketItem" do
|
326
326
|
pi2 = @pi.clone
|
327
|
-
expect(@pi == pi2).to
|
327
|
+
expect(@pi == pi2).to be true
|
328
328
|
end
|
329
329
|
end
|
330
330
|
|
@@ -368,7 +368,7 @@ module Cosmos
|
|
368
368
|
expect(hash["units"]).to eql "C"
|
369
369
|
expect(hash["default"]).to eql 0
|
370
370
|
expect(hash["range"]).to eql (0..100)
|
371
|
-
expect(hash["required"]).to
|
371
|
+
expect(hash["required"]).to be true
|
372
372
|
expect(hash["hazardous"]).to include("TRUE"=>nil,"FALSE"=>"NO!")
|
373
373
|
expect(hash["state_colors"]).to include("TRUE"=>:GREEN,"FALSE"=>:RED)
|
374
374
|
expect(hash["limits"]).to eql PacketItemLimits.new.to_hash
|
data/spec/packets/packet_spec.rb
CHANGED
@@ -731,9 +731,9 @@ module Cosmos
|
|
731
731
|
p.append_item("item1",8,:UINT)
|
732
732
|
p.append_item("item2",16,:UINT,nil,:BIG_ENDIAN,:ERROR,nil,nil,nil,5)
|
733
733
|
p.append_item("item3",32,:UINT)
|
734
|
-
expect(p.identify?("\x00\x00\x05\x01\x02\x03\x04")).to
|
735
|
-
expect(p.identify?("\x00\x00\x04\x01\x02\x03\x04")).to
|
736
|
-
expect(p.identify?("\x00")).to
|
734
|
+
expect(p.identify?("\x00\x00\x05\x01\x02\x03\x04")).to be true
|
735
|
+
expect(p.identify?("\x00\x00\x04\x01\x02\x03\x04")).to be false
|
736
|
+
expect(p.identify?("\x00")).to be false
|
737
737
|
end
|
738
738
|
|
739
739
|
it "identifies if the buffer is too short" do
|
@@ -741,7 +741,7 @@ module Cosmos
|
|
741
741
|
p.append_item("item1",8,:UINT)
|
742
742
|
p.append_item("item2",16,:UINT,nil,:BIG_ENDIAN,:ERROR,nil,nil,nil,5)
|
743
743
|
p.append_item("item3",32,:UINT)
|
744
|
-
expect(p.identify?("\x00\x00\x05\x01\x02\x03")).to
|
744
|
+
expect(p.identify?("\x00\x00\x05\x01\x02\x03")).to be true
|
745
745
|
end
|
746
746
|
|
747
747
|
it "identifies if the buffer is too long" do
|
@@ -749,15 +749,15 @@ module Cosmos
|
|
749
749
|
p.append_item("item1",8,:UINT)
|
750
750
|
p.append_item("item2",16,:UINT,nil,:BIG_ENDIAN,:ERROR,nil,nil,nil,5)
|
751
751
|
p.append_item("item3",32,:UINT)
|
752
|
-
expect(p.identify?("\x00\x00\x05\x01\x02\x03\x04\x05")).to
|
752
|
+
expect(p.identify?("\x00\x00\x05\x01\x02\x03\x04\x05")).to be true
|
753
753
|
end
|
754
754
|
end
|
755
755
|
|
756
756
|
describe "identified?" do
|
757
757
|
it "returns true if the target name and packet name are set" do
|
758
|
-
expect(Packet.new('TGT',nil).identified?).to
|
759
|
-
expect(Packet.new(nil,'PKT').identified?).to
|
760
|
-
expect(Packet.new('TGT','PKT').identified?).to
|
758
|
+
expect(Packet.new('TGT',nil).identified?).to be false
|
759
|
+
expect(Packet.new(nil,'PKT').identified?).to be false
|
760
|
+
expect(Packet.new('TGT','PKT').identified?).to be true
|
761
761
|
end
|
762
762
|
end
|
763
763
|
|
@@ -789,14 +789,14 @@ module Cosmos
|
|
789
789
|
p = Packet.new("tgt","pkt")
|
790
790
|
p.append_item("test1", 8, :UINT, 16)
|
791
791
|
p.append_item("test2", 16, :UINT)
|
792
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
793
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
792
|
+
expect(p.get_item("TEST1").limits.enabled).to be false
|
793
|
+
expect(p.get_item("TEST2").limits.enabled).to be false
|
794
794
|
p.enable_limits("TEST1")
|
795
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
796
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
795
|
+
expect(p.get_item("TEST1").limits.enabled).to be true
|
796
|
+
expect(p.get_item("TEST2").limits.enabled).to be false
|
797
797
|
p.enable_limits("TEST2")
|
798
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
799
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
798
|
+
expect(p.get_item("TEST1").limits.enabled).to be true
|
799
|
+
expect(p.get_item("TEST2").limits.enabled).to be true
|
800
800
|
end
|
801
801
|
end
|
802
802
|
|
@@ -807,14 +807,14 @@ module Cosmos
|
|
807
807
|
p.append_item("test2", 16, :UINT)
|
808
808
|
p.enable_limits("TEST1")
|
809
809
|
p.enable_limits("TEST2")
|
810
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
811
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
810
|
+
expect(p.get_item("TEST1").limits.enabled).to be true
|
811
|
+
expect(p.get_item("TEST2").limits.enabled).to be true
|
812
812
|
p.disable_limits("TEST1")
|
813
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
814
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
813
|
+
expect(p.get_item("TEST1").limits.enabled).to be false
|
814
|
+
expect(p.get_item("TEST2").limits.enabled).to be true
|
815
815
|
p.disable_limits("TEST2")
|
816
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
817
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
816
|
+
expect(p.get_item("TEST1").limits.enabled).to be false
|
817
|
+
expect(p.get_item("TEST2").limits.enabled).to be false
|
818
818
|
end
|
819
819
|
|
820
820
|
it "calls the limits_change_callback for all non STALE items" do
|
@@ -839,8 +839,8 @@ module Cosmos
|
|
839
839
|
p.check_limits
|
840
840
|
p.disable_limits("TEST1")
|
841
841
|
p.disable_limits("TEST2")
|
842
|
-
expect(p.get_item("TEST1").limits.enabled).to
|
843
|
-
expect(p.get_item("TEST2").limits.enabled).to
|
842
|
+
expect(p.get_item("TEST1").limits.enabled).to be false
|
843
|
+
expect(p.get_item("TEST2").limits.enabled).to be false
|
844
844
|
end
|
845
845
|
end
|
846
846
|
|
@@ -922,14 +922,14 @@ module Cosmos
|
|
922
922
|
end
|
923
923
|
|
924
924
|
it "sets clear the stale flag" do
|
925
|
-
expect(@p.stale).to
|
925
|
+
expect(@p.stale).to be true
|
926
926
|
@p.check_limits
|
927
|
-
expect(@p.stale).to
|
927
|
+
expect(@p.stale).to be false
|
928
928
|
end
|
929
929
|
|
930
930
|
it "does not call the limits_change_callback if limits are disabled" do
|
931
|
-
expect(@p.get_item("TEST1").limits.enabled).to
|
932
|
-
expect(@p.get_item("TEST2").limits.enabled).to
|
931
|
+
expect(@p.get_item("TEST1").limits.enabled).to be false
|
932
|
+
expect(@p.get_item("TEST2").limits.enabled).to be false
|
933
933
|
callback = double("callback")
|
934
934
|
allow(callback).to receive(:call)
|
935
935
|
@p.limits_change_callback = callback
|
@@ -940,14 +940,14 @@ module Cosmos
|
|
940
940
|
context "with states" do
|
941
941
|
it "calls the limits_change_callback" do
|
942
942
|
test1 = @p.get_item("TEST1")
|
943
|
-
expect(test1.limits.enabled).to
|
943
|
+
expect(test1.limits.enabled).to be false
|
944
944
|
test1.states = {"TRUE"=>1,"FALSE"=>0}
|
945
945
|
test1.state_colors = {"TRUE"=>:GREEN,"FALSE"=>:RED}
|
946
946
|
@p.update_limits_items_cache(test1)
|
947
947
|
@p.write("TEST1", 0)
|
948
948
|
@p.enable_limits("TEST1")
|
949
949
|
test2 = @p.get_item("TEST2")
|
950
|
-
expect(test2.limits.enabled).to
|
950
|
+
expect(test2.limits.enabled).to be false
|
951
951
|
test2.states = {"TRUE"=>1,"FALSE"=>0}
|
952
952
|
test2.state_colors = {"TRUE"=>:RED,"FALSE"=>:GREEN}
|
953
953
|
@p.write("TEST2", 0)
|
@@ -978,19 +978,19 @@ module Cosmos
|
|
978
978
|
context "with values" do
|
979
979
|
before(:each) do
|
980
980
|
@test1 = @p.get_item("TEST1")
|
981
|
-
expect(@test1.limits.enabled).to
|
981
|
+
expect(@test1.limits.enabled).to be false
|
982
982
|
@test1.limits.values = {:DEFAULT=>[1,2,4,5]} # red yellow
|
983
983
|
@p.update_limits_items_cache(@test1)
|
984
984
|
@p.enable_limits("TEST1")
|
985
985
|
|
986
986
|
@test2 = @p.get_item("TEST2")
|
987
|
-
expect(@test2.limits.enabled).to
|
987
|
+
expect(@test2.limits.enabled).to be false
|
988
988
|
@test2.limits.values = {:DEFAULT=>[1,2,6,7,3,5]} # red yellow and blue
|
989
989
|
@p.update_limits_items_cache(@test2)
|
990
990
|
@p.enable_limits("TEST2")
|
991
991
|
|
992
992
|
@test3 = @p.get_item("TEST3")
|
993
|
-
expect(@test3.limits.enabled).to
|
993
|
+
expect(@test3.limits.enabled).to be false
|
994
994
|
@test3.limits.values = {:DEFAULT=>[1,1.5,2.5,3]} # red yellow
|
995
995
|
@p.update_limits_items_cache(@test3)
|
996
996
|
@p.enable_limits("TEST3")
|
@@ -1254,12 +1254,12 @@ module Cosmos
|
|
1254
1254
|
p.enable_limits("TEST2")
|
1255
1255
|
expect(p.out_of_limits).to eql []
|
1256
1256
|
|
1257
|
-
expect(p.stale).to
|
1257
|
+
expect(p.stale).to be true
|
1258
1258
|
expect(p.get_item("TEST1").limits.state).to eql :STALE
|
1259
1259
|
expect(p.get_item("TEST2").limits.state).to eql :STALE
|
1260
1260
|
# Update the limits
|
1261
1261
|
p.check_limits
|
1262
|
-
expect(p.stale).to
|
1262
|
+
expect(p.stale).to be false
|
1263
1263
|
expect(p.get_item("TEST1").limits.state).not_to eql :STALE
|
1264
1264
|
expect(p.get_item("TEST2").limits.state).not_to eql :STALE
|
1265
1265
|
# set them all back to stale
|
@@ -126,44 +126,44 @@ module Cosmos
|
|
126
126
|
it "sorts items according to positive bit offset" do
|
127
127
|
si1 = StructureItem.new("si1", 0, 8, :UINT, :BIG_ENDIAN, nil)
|
128
128
|
si2 = StructureItem.new("si2", 8, 8, :UINT, :BIG_ENDIAN, nil)
|
129
|
-
expect(si1 < si2).to
|
130
|
-
expect(si1 == si2).to
|
131
|
-
expect(si1 > si2).to
|
129
|
+
expect(si1 < si2).to be true
|
130
|
+
expect(si1 == si2).to be false
|
131
|
+
expect(si1 > si2).to be false
|
132
132
|
|
133
133
|
si2 = StructureItem.new("si2", 0, 8, :UINT, :BIG_ENDIAN, nil)
|
134
|
-
expect(si1 < si2).to
|
135
|
-
expect(si1 == si2).to
|
136
|
-
expect(si1 > si2).to
|
134
|
+
expect(si1 < si2).to be false
|
135
|
+
expect(si1 == si2).to be true
|
136
|
+
expect(si1 > si2).to be false
|
137
137
|
end
|
138
138
|
|
139
139
|
it "sorts items with 0 bit offset according to bit size" do
|
140
140
|
si1 = StructureItem.new("si1", 0, 8, :UINT, :BIG_ENDIAN, nil)
|
141
141
|
si2 = StructureItem.new("si2", 0, 0, :BLOCK, :BIG_ENDIAN, nil)
|
142
|
-
expect(si1 < si2).to
|
143
|
-
expect(si1 == si2).to
|
144
|
-
expect(si1 > si2).to
|
142
|
+
expect(si1 < si2).to be false
|
143
|
+
expect(si1 == si2).to be false
|
144
|
+
expect(si1 > si2).to be true
|
145
145
|
end
|
146
146
|
|
147
147
|
it "sorts items according to negative bit offset" do
|
148
148
|
si1 = StructureItem.new("si1", -8, 8, :UINT, :BIG_ENDIAN, nil)
|
149
149
|
si2 = StructureItem.new("si2", -16, 8, :UINT, :BIG_ENDIAN, nil)
|
150
|
-
expect(si1 < si2).to
|
151
|
-
expect(si1 == si2).to
|
152
|
-
expect(si1 > si2).to
|
150
|
+
expect(si1 < si2).to be false
|
151
|
+
expect(si1 == si2).to be false
|
152
|
+
expect(si1 > si2).to be true
|
153
153
|
|
154
154
|
si2 = StructureItem.new("si2", -8, 8, :UINT, :BIG_ENDIAN, nil)
|
155
|
-
expect(si1 < si2).to
|
155
|
+
expect(si1 < si2).to be false
|
156
156
|
# si1 == si2 even though they have different names and sizes
|
157
|
-
expect(si1 == si2).to
|
158
|
-
expect(si1 > si2).to
|
157
|
+
expect(si1 == si2).to be true
|
158
|
+
expect(si1 > si2).to be false
|
159
159
|
end
|
160
160
|
|
161
161
|
it "sorts items according to mixed bit offset" do
|
162
162
|
si1 = StructureItem.new("si1", 16, 8, :UINT, :BIG_ENDIAN, nil)
|
163
163
|
si2 = StructureItem.new("si2", -8, 8, :UINT, :BIG_ENDIAN, nil)
|
164
|
-
expect(si1 < si2).to
|
165
|
-
expect(si1 == si2).to
|
166
|
-
expect(si1 > si2).to
|
164
|
+
expect(si1 < si2).to be true
|
165
|
+
expect(si1 == si2).to be false
|
166
|
+
expect(si1 > si2).to be false
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
@@ -171,7 +171,7 @@ module Cosmos
|
|
171
171
|
it "duplicates the entire structure item " do
|
172
172
|
si1 = StructureItem.new("si1", -8, 1, :UINT, :LITTLE_ENDIAN, nil)
|
173
173
|
si2 = si1.clone
|
174
|
-
expect(si1 == si2).to
|
174
|
+
expect(si1 == si2).to be true
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|