cosmos 3.9.1 → 3.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Manifest.txt +7 -0
- data/autohotkey/tools/cmd_extractor.ahk +17 -0
- data/autohotkey/tools/tlm_extractor.ahk +62 -1
- data/bin/cosmos +182 -12
- data/data/crc.txt +35 -34
- data/demo/config/data/crc.txt +6 -2
- data/demo/config/targets/INST/screens/adcs.txt +1 -1
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +1 -1
- data/demo/config/tools/example_application.css +58 -0
- data/demo/config/tools/launcher/launcher.css +7 -0
- data/demo/config/tools/launcher/launcher2.css +10 -0
- data/demo/config/tools/test_runner/test_runner.css +45 -0
- data/ext/cosmos/ext/packet/packet.c +6 -0
- data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +15 -6
- data/lib/cosmos/gui/qt_tool.rb +58 -8
- data/lib/cosmos/gui/text/ruby_editor.rb +54 -6
- data/lib/cosmos/gui/utilities/analyze_log.rb +153 -0
- data/lib/cosmos/interfaces/interface.rb +6 -0
- data/lib/cosmos/packets/packet_item_limits.rb +14 -2
- data/lib/cosmos/packets/structure_item.rb +22 -3
- data/lib/cosmos/script/cmd_tlm_server.rb +28 -0
- data/lib/cosmos/script/extract.rb +10 -9
- data/lib/cosmos/script/tools.rb +10 -4
- data/lib/cosmos/system/system.rb +2 -1
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +12 -0
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +84 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +3 -2
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +9 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +26 -17
- data/lib/cosmos/tools/cmd_tlm_server/interfaces.rb +26 -0
- data/lib/cosmos/tools/cmd_tlm_server/packet_logging.rb +29 -0
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +33 -0
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
- data/lib/cosmos/tools/launcher/launcher.rb +14 -25
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +3 -7
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +6 -4
- data/lib/cosmos/tools/script_runner/script_runner.rb +58 -9
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +45 -19
- data/lib/cosmos/tools/table_manager/table_manager.rb +7 -7
- data/lib/cosmos/tools/test_runner/test_runner.rb +6 -0
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +145 -8
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +89 -19
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +14 -0
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/screen.rb +15 -3
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +23 -12
- data/lib/cosmos/version.rb +4 -4
- data/spec/packets/packet_item_limits_spec.rb +33 -6
- data/spec/packets/packet_item_spec.rb +9 -9
- data/spec/packets/packet_spec.rb +18 -6
- data/spec/packets/structure_item_spec.rb +22 -4
- data/spec/script/cmd_tlm_server_spec.rb +66 -0
- data/spec/script/extract_spec.rb +144 -0
- data/spec/script/tools_spec.rb +17 -2
- data/spec/system/system_spec.rb +1 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +6 -0
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +1 -1
- data/spec/tools/table_manager/table_item_parser_spec.rb +61 -0
- data/spec/tools/table_manager/table_item_spec.rb +1 -1
- metadata +9 -2
@@ -16,18 +16,20 @@ module Cosmos
|
|
16
16
|
class TlmExtractorConfig
|
17
17
|
|
18
18
|
VALUE_TYPES = [:RAW, :CONVERTED, :FORMATTED, :WITH_UNITS]
|
19
|
+
COLUMN_MODES = [:NORMAL, :SHARE_ALL_COLUMNS, :SHARE_INDIV_COLUMNS, :FULL_COLUMN_NAMES]
|
19
20
|
DEFAULT_UNIQUE_IGNORED = ['RECEIVED_TIMEFORMATTED', 'RECEIVED_TIMESECONDS']
|
20
21
|
ITEM = 'ITEM'.freeze
|
21
22
|
TEXT = 'TEXT'.freeze
|
22
23
|
|
23
24
|
attr_accessor :matlab_header
|
24
25
|
attr_accessor :fill_down
|
25
|
-
|
26
|
+
attr_reader :column_mode
|
26
27
|
attr_accessor :unique_only
|
27
28
|
attr_accessor :delimiter
|
28
29
|
attr_accessor :downsample_seconds
|
29
30
|
attr_accessor :print_filenames_to_output
|
30
31
|
attr_reader :items
|
32
|
+
attr_reader :shared_indiv_columns
|
31
33
|
|
32
34
|
attr_accessor :output_filename
|
33
35
|
attr_accessor :input_filenames
|
@@ -38,18 +40,19 @@ module Cosmos
|
|
38
40
|
@output_file = nil
|
39
41
|
reset_settings()
|
40
42
|
clear_items()
|
43
|
+
clear_shared_columns()
|
41
44
|
restore(config_file) if config_file
|
42
45
|
end
|
43
46
|
|
44
47
|
def reset_settings
|
45
48
|
@matlab_header = false
|
46
49
|
@fill_down = false
|
47
|
-
@share_columns = false
|
48
50
|
@unique_only = false
|
49
51
|
@delimiter = "\t"
|
50
52
|
@unique_ignored = DEFAULT_UNIQUE_IGNORED.clone
|
51
53
|
@downsample_seconds = 0.0
|
52
54
|
@print_filenames_to_output = true
|
55
|
+
set_column_mode(:NORMAL)
|
53
56
|
end
|
54
57
|
|
55
58
|
def clear_items
|
@@ -70,10 +73,12 @@ module Cosmos
|
|
70
73
|
|
71
74
|
hash_index = item_name + ' ' + value_type.to_s
|
72
75
|
|
73
|
-
if @
|
76
|
+
if @column_mode == :SHARE_ALL_COLUMNS and @columns_hash[hash_index]
|
77
|
+
column_index = @columns_hash[hash_index]
|
78
|
+
elsif @column_mode == :SHARE_INDIV_COLUMNS and @shared_indiv_columns.include?(hash_index) and @columns_hash[hash_index]
|
74
79
|
column_index = @columns_hash[hash_index]
|
75
80
|
else
|
76
|
-
@columns << [item_name, value_type, nil]
|
81
|
+
@columns << [item_name, value_type, nil, target_name, packet_name]
|
77
82
|
column_index = @columns.length - 1
|
78
83
|
@columns_hash[hash_index] = column_index
|
79
84
|
end
|
@@ -84,22 +89,52 @@ module Cosmos
|
|
84
89
|
end
|
85
90
|
|
86
91
|
def add_text(column_name, text)
|
87
|
-
@columns << [column_name, nil, nil]
|
92
|
+
@columns << [column_name, nil, nil, nil, nil]
|
88
93
|
@items << [TEXT, column_name, text, nil, nil]
|
89
94
|
@text_items << [@columns.length - 1, text]
|
90
95
|
end
|
91
96
|
|
97
|
+
def set_column_mode(mode)
|
98
|
+
raise "Unknown Column Mode: #{mode}" unless COLUMN_MODES.include?(mode)
|
99
|
+
|
100
|
+
@column_mode = mode
|
101
|
+
if @column_mode != :SHARE_INDIV_COLUMNS
|
102
|
+
clear_shared_columns()
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def clear_shared_columns()
|
107
|
+
@shared_indiv_columns = []
|
108
|
+
end
|
109
|
+
|
110
|
+
def add_shared_column(item_name, value_type = :CONVERTED)
|
111
|
+
raise "Unknown Value Type: #{value_type}" unless VALUE_TYPES.include?(value_type)
|
112
|
+
|
113
|
+
shared_column_name = item_name + ' ' + value_type.to_s
|
114
|
+
@shared_indiv_columns << shared_column_name
|
115
|
+
@shared_indiv_columns.uniq!
|
116
|
+
end
|
117
|
+
|
92
118
|
def column_names
|
93
|
-
|
94
|
-
|
95
|
-
|
119
|
+
if @column_mode == :FULL_COLUMN_NAMES
|
120
|
+
col_offset = 0
|
121
|
+
row = Array.new(@columns.length)
|
122
|
+
else
|
123
|
+
col_offset = 2
|
124
|
+
row = Array.new(@columns.length + 2)
|
125
|
+
row[0] = 'TARGET'
|
126
|
+
row[1] = 'PACKET'
|
127
|
+
end
|
96
128
|
index = 0
|
97
|
-
@columns.each do |column_name, column_value_type, item_data_type|
|
129
|
+
@columns.each do |column_name, column_value_type, item_data_type, target_name, packet_name|
|
130
|
+
if @column_mode == :FULL_COLUMN_NAMES and target_name and packet_name
|
131
|
+
column_name = [target_name, packet_name, column_name].join(' ')
|
132
|
+
end
|
98
133
|
case column_value_type
|
99
134
|
when :CONVERTED, nil
|
100
|
-
row[index +
|
135
|
+
row[index + col_offset] = column_name
|
101
136
|
else
|
102
|
-
row[index +
|
137
|
+
row[index + col_offset] = (column_name + '(' + column_value_type.to_s + ')')
|
103
138
|
end
|
104
139
|
index += 1
|
105
140
|
end
|
@@ -132,7 +167,30 @@ module Cosmos
|
|
132
167
|
when 'SHARE_COLUMNS'
|
133
168
|
# Expect 0 parameters
|
134
169
|
parser.verify_num_parameters(0, 0, "SHARE_COLUMNS")
|
135
|
-
|
170
|
+
set_column_mode(:SHARE_ALL_COLUMNS)
|
171
|
+
|
172
|
+
when 'SHARE_COLUMN'
|
173
|
+
# Expect 1 or 2 parameters
|
174
|
+
parser.verify_num_parameters(1, 2, "SHARE_COLUMN <Item Name> <Data Type (optional)>")
|
175
|
+
item_name = params[0].upcase
|
176
|
+
if params.length == 1
|
177
|
+
value_type = :CONVERTED
|
178
|
+
else
|
179
|
+
value_type = params[1].upcase
|
180
|
+
case value_type
|
181
|
+
when 'CONVERTED', 'RAW', 'FORMATTED', 'WITH_UNITS'
|
182
|
+
value_type = value_type.intern
|
183
|
+
else
|
184
|
+
raise "Unknown Value Type: #{value_type}"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
set_column_mode(:SHARE_INDIV_COLUMNS)
|
188
|
+
add_shared_column(item_name, value_type)
|
189
|
+
|
190
|
+
when 'FULL_COLUMN_NAMES'
|
191
|
+
# Expect 0 parameters
|
192
|
+
parser.verify_num_parameters(0, 0, "FULL_COLUMN_NAMES")
|
193
|
+
set_column_mode(:FULL_COLUMN_NAMES)
|
136
194
|
|
137
195
|
when 'UNIQUE_ONLY'
|
138
196
|
# Expect 0 parameters
|
@@ -202,9 +260,17 @@ module Cosmos
|
|
202
260
|
if !@print_filenames_to_output
|
203
261
|
file.puts 'DONT_OUTPUT_FILENAMES'
|
204
262
|
end
|
205
|
-
if @
|
263
|
+
if @column_mode == :SHARE_ALL_COLUMNS
|
206
264
|
file.puts 'SHARE_COLUMNS'
|
207
265
|
end
|
266
|
+
if @column_mode == :SHARE_INDIV_COLUMNS
|
267
|
+
@shared_indiv_columns.each do |shared_column|
|
268
|
+
file.puts "SHARE_COLUMN #{shared_column}"
|
269
|
+
end
|
270
|
+
end
|
271
|
+
if @column_mode == :FULL_COLUMN_NAMES
|
272
|
+
file.puts 'FULL_COLUMN_NAMES'
|
273
|
+
end
|
208
274
|
if @unique_only
|
209
275
|
file.puts 'UNIQUE_ONLY'
|
210
276
|
end
|
@@ -312,13 +378,13 @@ module Cosmos
|
|
312
378
|
|
313
379
|
# Add each packet item to the row
|
314
380
|
packet_mapping.each do |column_index|
|
315
|
-
column_name, column_value_type, item_data_type = @columns[column_index]
|
381
|
+
column_name, column_value_type, item_data_type, target_name, packet_name = @columns[column_index]
|
316
382
|
|
317
383
|
# Lookup item data type on first use
|
318
384
|
unless item_data_type
|
319
385
|
_, item = System.telemetry.packet_and_item(packet.target_name, packet.packet_name, column_name)
|
320
386
|
item_data_type = item.data_type
|
321
|
-
@columns[column_index] = [column_name, column_value_type, item_data_type]
|
387
|
+
@columns[column_index] = [column_name, column_value_type, item_data_type, target_name, packet_name]
|
322
388
|
end
|
323
389
|
|
324
390
|
if item_data_type == :BLOCK
|
@@ -349,11 +415,15 @@ module Cosmos
|
|
349
415
|
|
350
416
|
if !@unique_only or changed
|
351
417
|
# Output the row
|
352
|
-
@
|
353
|
-
|
354
|
-
@output_file.print packet.packet_name
|
355
|
-
row.each_with_index do |value, index|
|
418
|
+
if @column_mode != :FULL_COLUMN_NAMES
|
419
|
+
@output_file.print packet.target_name
|
356
420
|
@output_file.print @delimiter
|
421
|
+
@output_file.print packet.packet_name
|
422
|
+
end
|
423
|
+
row.each_with_index do |value, index|
|
424
|
+
if @column_mode != :FULL_COLUMN_NAMES or index != 0
|
425
|
+
@output_file.print @delimiter
|
426
|
+
end
|
357
427
|
@output_file.print value if value
|
358
428
|
end
|
359
429
|
@output_file.puts ""
|
@@ -32,6 +32,7 @@ module Cosmos
|
|
32
32
|
DEFAULT_POINTS_SAVED = 1000000
|
33
33
|
DEFAULT_POINTS_PLOTTED = 1000
|
34
34
|
DEFAULT_REFRESH_RATE_HZ = 10.0
|
35
|
+
DEFAULT_CTS_TIMEOUT = 10.0
|
35
36
|
|
36
37
|
# Gives access to the array of tabs defined by the configuration file
|
37
38
|
attr_accessor :tabs
|
@@ -48,6 +49,9 @@ module Cosmos
|
|
48
49
|
# Global Refresh Rate Hz Setting
|
49
50
|
attr_accessor :refresh_rate_hz
|
50
51
|
|
52
|
+
# Global CTS Timeout Setting
|
53
|
+
attr_accessor :cts_timeout
|
54
|
+
|
51
55
|
# Plot types known by this tabbed plots definition
|
52
56
|
attr_accessor :plot_types
|
53
57
|
|
@@ -75,6 +79,7 @@ module Cosmos
|
|
75
79
|
@seconds_plotted = DEFAULT_SECONDS_PLOTTED
|
76
80
|
@points_plotted = DEFAULT_POINTS_PLOTTED
|
77
81
|
@refresh_rate_hz = DEFAULT_REFRESH_RATE_HZ
|
82
|
+
@cts_timeout = DEFAULT_CTS_TIMEOUT
|
78
83
|
@packet_count = 0
|
79
84
|
@configuration_errors = []
|
80
85
|
|
@@ -158,6 +163,14 @@ module Cosmos
|
|
158
163
|
@refresh_rate_hz = parameters[0].to_f
|
159
164
|
raise ArgumentError, "Invalid Refresh Rate Hz: #{@refresh_rate_hz}" if @refresh_rate_hz <= 0.0
|
160
165
|
|
166
|
+
when 'CTS_TIMEOUT'
|
167
|
+
# Expect 1 parameter
|
168
|
+
parser.verify_num_parameters(1, 1, "CTS_TIMEOUT <CTS Timeout in Seconds>")
|
169
|
+
|
170
|
+
# Update CTS Timeout
|
171
|
+
@cts_timeout = parameters[0].to_f
|
172
|
+
raise ArgumentError, "Invalid CTS Timeout: #{@cts_timeout}" if @cts_timeout <= 0.0
|
173
|
+
|
161
174
|
else
|
162
175
|
# Handle unknown keywords
|
163
176
|
raise ArgumentError, "A TAB must be defined before using keyword: #{keyword}"
|
@@ -189,6 +202,7 @@ module Cosmos
|
|
189
202
|
configuration << "POINTS_SAVED #{@points_saved}\n"
|
190
203
|
configuration << "POINTS_PLOTTED #{@points_plotted}\n"
|
191
204
|
configuration << "REFRESH_RATE_HZ #{@refresh_rate_hz}\n"
|
205
|
+
configuration << "CTS_TIMEOUT #{@cts_timeout}\n"
|
192
206
|
@tabs.each do |tab|
|
193
207
|
configuration << "\n"
|
194
208
|
configuration << tab.configuration_string
|
@@ -19,7 +19,7 @@ module Cosmos
|
|
19
19
|
|
20
20
|
# Create a new TabbedPlotsRealtimeThread
|
21
21
|
def initialize(tabbed_plots_config, connection_success_callback = nil, connection_failed_callback = nil, connection_lost_callback = nil, fatal_exception_callback = nil)
|
22
|
-
interface = TcpipClientInterface.new('localhost', nil, System.ports['CTS_PREIDENTIFIED'], nil,
|
22
|
+
interface = TcpipClientInterface.new('localhost', nil, System.ports['CTS_PREIDENTIFIED'], nil, tabbed_plots_config.cts_timeout, 'PREIDENTIFIED')
|
23
23
|
super(interface)
|
24
24
|
|
25
25
|
@queue = Queue.new
|
@@ -221,6 +221,10 @@ module Cosmos
|
|
221
221
|
# regular TlmViewer application
|
222
222
|
@single_screen = single_screen
|
223
223
|
|
224
|
+
# Read the application wide stylesheet if it exists
|
225
|
+
app_style = File.join(Cosmos::USERPATH, 'config', 'tools', 'application.css')
|
226
|
+
setStyleSheet(File.read(app_style)) if File.exist? app_style
|
227
|
+
|
224
228
|
@widgets = Widgets.new(self, mode)
|
225
229
|
@window = process(filename)
|
226
230
|
@@open_screens << self if @window
|
@@ -254,10 +258,15 @@ module Cosmos
|
|
254
258
|
if keyword
|
255
259
|
case keyword
|
256
260
|
when 'SCREEN'
|
257
|
-
parser.verify_num_parameters(3,
|
261
|
+
parser.verify_num_parameters(3, 4, "#{keyword} <Width or AUTO> <Height or AUTO> <Polling Period> <FIXED>")
|
258
262
|
@width = parameters[0].to_i
|
259
263
|
@height = parameters[1].to_i
|
260
264
|
@widgets.polling_period = parameters[2].to_f
|
265
|
+
if parameters.length == 4
|
266
|
+
@fixed = true
|
267
|
+
else
|
268
|
+
@fixed = false
|
269
|
+
end
|
261
270
|
|
262
271
|
setWindowTitle(@full_name)
|
263
272
|
top_widget = Qt::Widget.new()
|
@@ -329,6 +338,10 @@ module Cosmos
|
|
329
338
|
elsif @width > 0 and height <= 0
|
330
339
|
resize(@width, self.height)
|
331
340
|
end
|
341
|
+
if @fixed
|
342
|
+
setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint)
|
343
|
+
setFixedSize(self.width, self.height)
|
344
|
+
end
|
332
345
|
|
333
346
|
if @x_pos or @y_pos
|
334
347
|
x = @x_pos || 0
|
@@ -482,5 +495,4 @@ module Cosmos
|
|
482
495
|
end
|
483
496
|
|
484
497
|
end
|
485
|
-
|
486
|
-
end # module Cosmos
|
498
|
+
end
|
@@ -34,6 +34,10 @@ module Cosmos
|
|
34
34
|
def clear(display_name)
|
35
35
|
TlmViewer.instance.clear(display_name)
|
36
36
|
end
|
37
|
+
|
38
|
+
def clear_all(target = nil)
|
39
|
+
TlmViewer.instance.clear_all(target)
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
@@ -93,18 +97,11 @@ module Cosmos
|
|
93
97
|
setMinimumWidth(300)
|
94
98
|
@@instance = self
|
95
99
|
|
96
|
-
# Get Params from Config File
|
97
|
-
if options.config_file
|
98
|
-
filename = File.join(::Cosmos::USERPATH, 'config', 'tools', 'tlm_viewer', options.config_file)
|
99
|
-
else
|
100
|
-
filename = File.join(::Cosmos::USERPATH, 'config', 'tools', 'tlm_viewer', 'tlm_viewer.txt')
|
101
|
-
end
|
102
|
-
|
103
100
|
Splash.execute(self, true) do |splash|
|
104
101
|
ConfigParser.splash = splash
|
105
102
|
splash.message = "Starting TlmViewer"
|
106
103
|
System.telemetry
|
107
|
-
@tlm_viewer_config = self.class.load_config(
|
104
|
+
@tlm_viewer_config = self.class.load_config(options.config_file)
|
108
105
|
ConfigParser.splash = nil
|
109
106
|
end
|
110
107
|
|
@@ -132,7 +129,8 @@ module Cosmos
|
|
132
129
|
@json_drb.acl = acl
|
133
130
|
whitelist = [
|
134
131
|
'display',
|
135
|
-
'clear'
|
132
|
+
'clear',
|
133
|
+
'clear_all']
|
136
134
|
@json_drb.method_whitelist = whitelist
|
137
135
|
begin
|
138
136
|
@json_drb.start_service "localhost", port, self
|
@@ -483,10 +481,23 @@ module Cosmos
|
|
483
481
|
|
484
482
|
# Close the specified screen
|
485
483
|
def clear(screen_full_name)
|
486
|
-
|
487
|
-
|
484
|
+
close_screen(find_screen_info(screen_full_name))
|
485
|
+
end
|
486
|
+
|
487
|
+
# Close all screens
|
488
|
+
def clear_all(target_name = nil)
|
489
|
+
if target_name
|
490
|
+
screens = @tlm_viewer_config.screen_infos.values.select do |screen_info|
|
491
|
+
screen_info.target_name == target_name.upcase
|
492
|
+
end
|
493
|
+
raise "Unknown screen target: #{target_name.upcase}" if screens.length == 0
|
494
|
+
screens.each { |screen_info| close_screen(screen_info) }
|
495
|
+
else
|
496
|
+
Qt.execute_in_main_thread(true) { Screen.close_all_screens(self) }
|
497
|
+
end
|
498
|
+
end
|
488
499
|
|
489
|
-
|
500
|
+
def close_screen(screen_info)
|
490
501
|
Qt.execute_in_main_thread(true) do
|
491
502
|
begin
|
492
503
|
screen_info.screen.window.close if screen_info.screen
|
data/lib/cosmos/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
COSMOS_VERSION = '3.9.
|
3
|
+
COSMOS_VERSION = '3.9.2'
|
4
4
|
module Cosmos
|
5
5
|
module Version
|
6
6
|
MAJOR = '3'
|
7
7
|
MINOR = '9'
|
8
|
-
PATCH = '
|
9
|
-
BUILD = '
|
8
|
+
PATCH = '2'
|
9
|
+
BUILD = '82298a42b756edd3783b51c2d7d17535b6ab8f1a'
|
10
10
|
end
|
11
|
-
VERSION = '3.9.
|
11
|
+
VERSION = '3.9.2'
|
12
12
|
end
|
@@ -84,11 +84,25 @@ module Cosmos
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "complains about persistence_setting = nil" do
|
87
|
-
|
87
|
+
if 0.class == Integer
|
88
|
+
# Ruby version >= 2.4.0
|
89
|
+
expect { @l.persistence_setting = nil}.to raise_error(ArgumentError, "persistence_setting must be an Integer but is a NilClass")
|
90
|
+
else
|
91
|
+
# Ruby version < 2.4.0
|
92
|
+
expect { @l.persistence_setting = nil}.to raise_error(ArgumentError, "persistence_setting must be a Fixnum but is a NilClass")
|
93
|
+
end
|
88
94
|
end
|
89
95
|
|
90
|
-
|
91
|
-
|
96
|
+
if 0.class == Integer
|
97
|
+
# Ruby version >= 2.4.0
|
98
|
+
it "complains about persistence_setting that aren't Integer" do
|
99
|
+
expect { @l.persistence_setting = 5.5}.to raise_error(ArgumentError, "persistence_setting must be an Integer but is a Float")
|
100
|
+
end
|
101
|
+
else
|
102
|
+
# Ruby version < 2.4.0
|
103
|
+
it "complains about persistence_setting that aren't Fixnum" do
|
104
|
+
expect { @l.persistence_setting = 5.5}.to raise_error(ArgumentError, "persistence_setting must be a Fixnum but is a Float")
|
105
|
+
end
|
92
106
|
end
|
93
107
|
end
|
94
108
|
|
@@ -100,11 +114,24 @@ module Cosmos
|
|
100
114
|
end
|
101
115
|
|
102
116
|
it "complains about persistence_count = nil" do
|
103
|
-
|
117
|
+
if 0.class == Integer
|
118
|
+
# Ruby version >= 2.4.0
|
119
|
+
expect { @l.persistence_count = nil}.to raise_error(ArgumentError, "persistence_count must be an Integer but is a NilClass")
|
120
|
+
else
|
121
|
+
# Ruby version < 2.4.0
|
122
|
+
expect { @l.persistence_count = nil}.to raise_error(ArgumentError, "persistence_count must be a Fixnum but is a NilClass")
|
123
|
+
end
|
104
124
|
end
|
105
125
|
|
106
|
-
|
107
|
-
|
126
|
+
if 0.class == Integer
|
127
|
+
it "complains about persistence_count that aren't Integer" do
|
128
|
+
expect { @l.persistence_count = 5.5}.to raise_error(ArgumentError, "persistence_count must be an Integer but is a Float")
|
129
|
+
end
|
130
|
+
else
|
131
|
+
# Ruby version < 2.4.0
|
132
|
+
it "complains about persistence_count that aren't Fixnum" do
|
133
|
+
expect { @l.persistence_count = 5.5}.to raise_error(ArgumentError, "persistence_count must be a Fixnum but is a Float")
|
134
|
+
end
|
108
135
|
end
|
109
136
|
end
|
110
137
|
|
@@ -32,7 +32,7 @@ module Cosmos
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "complains about non String format_strings" do
|
35
|
-
expect { @pi.format_string = 5 }.to raise_error(ArgumentError, "#{@pi.name}: format_string must be a String but is a
|
35
|
+
expect { @pi.format_string = 5.1 }.to raise_error(ArgumentError, "#{@pi.name}: format_string must be a String but is a Float")
|
36
36
|
end
|
37
37
|
|
38
38
|
it "complains about badly formatted format_strings" do
|
@@ -130,7 +130,7 @@ module Cosmos
|
|
130
130
|
end
|
131
131
|
|
132
132
|
it "complains about description that aren't Strings" do
|
133
|
-
expect { @pi.description = 5}.to raise_error(ArgumentError, "#{@pi.name}: description must be a String but is a
|
133
|
+
expect { @pi.description = 5.1}.to raise_error(ArgumentError, "#{@pi.name}: description must be a String but is a Float")
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -147,7 +147,7 @@ module Cosmos
|
|
147
147
|
end
|
148
148
|
|
149
149
|
it "complains about units_full that aren't Strings" do
|
150
|
-
expect { @pi.units_full = 5}.to raise_error(ArgumentError, "#{@pi.name}: units_full must be a String but is a
|
150
|
+
expect { @pi.units_full = 5.1}.to raise_error(ArgumentError, "#{@pi.name}: units_full must be a String but is a Float")
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -164,7 +164,7 @@ module Cosmos
|
|
164
164
|
end
|
165
165
|
|
166
166
|
it "complains about units that aren't Strings" do
|
167
|
-
expect { @pi.units = 5}.to raise_error(ArgumentError, "#{@pi.name}: units must be a String but is a
|
167
|
+
expect { @pi.units = 5.1}.to raise_error(ArgumentError, "#{@pi.name}: units must be a String but is a Float")
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
@@ -193,8 +193,8 @@ module Cosmos
|
|
193
193
|
describe "check_default_and_range_data_types" do
|
194
194
|
it "complains about default not matching data_type" do
|
195
195
|
pi = PacketItem.new("test", 0, 8, :UINT, :BIG_ENDIAN, 16)
|
196
|
-
pi.default = 1
|
197
|
-
expect { pi.check_default_and_range_data_types }.to raise_error(ArgumentError, "TEST: default must be an Array but is a
|
196
|
+
pi.default = 1.1
|
197
|
+
expect { pi.check_default_and_range_data_types }.to raise_error(ArgumentError, "TEST: default must be an Array but is a Float")
|
198
198
|
pi = PacketItem.new("test", 0, 8, :UINT, :BIG_ENDIAN, 16)
|
199
199
|
pi.default = []
|
200
200
|
expect { pi.check_default_and_range_data_types }.to_not raise_error
|
@@ -214,8 +214,8 @@ module Cosmos
|
|
214
214
|
pi.default = 5.5
|
215
215
|
expect { pi.check_default_and_range_data_types }.to_not raise_error
|
216
216
|
pi = PacketItem.new("test", 0, 32, :STRING, :BIG_ENDIAN, nil)
|
217
|
-
pi.default = 5
|
218
|
-
expect { pi.check_default_and_range_data_types }.to raise_error(ArgumentError, "TEST: default must be a String but is a
|
217
|
+
pi.default = 5.1
|
218
|
+
expect { pi.check_default_and_range_data_types }.to raise_error(ArgumentError, "TEST: default must be a String but is a Float")
|
219
219
|
pi = PacketItem.new("test", 0, 32, :STRING, :BIG_ENDIAN, nil)
|
220
220
|
pi.default = ''
|
221
221
|
expect { pi.check_default_and_range_data_types }.to_not raise_error
|
@@ -258,7 +258,7 @@ module Cosmos
|
|
258
258
|
end
|
259
259
|
|
260
260
|
it "complains about ranges that aren't Ranges" do
|
261
|
-
expect { @pi.range = 5}.to raise_error(ArgumentError, "#{@pi.name}: range must be a Range but is a
|
261
|
+
expect { @pi.range = 5.1}.to raise_error(ArgumentError, "#{@pi.name}: range must be a Range but is a Float")
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|