cosmos 3.2.1 → 3.3.0

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.
Files changed (364) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +195 -0
  3. data/README.md +3 -3
  4. data/data/crc.txt +52 -52
  5. data/lib/cosmos.rb +1 -1
  6. data/lib/cosmos/core_ext/time.rb +11 -9
  7. data/lib/cosmos/gui/choosers/telemetry_chooser.rb +0 -2
  8. data/lib/cosmos/gui/dialogs/about_dialog.rb +2 -2
  9. data/lib/cosmos/gui/dialogs/exception_dialog.rb +2 -2
  10. data/lib/cosmos/gui/dialogs/progress_dialog.rb +11 -5
  11. data/lib/cosmos/gui/dialogs/splash.rb +32 -10
  12. data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
  13. data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +2 -2
  14. data/lib/cosmos/gui/qt.rb +22 -22
  15. data/lib/cosmos/io/json_drb.rb +4 -4
  16. data/lib/cosmos/io/json_rpc.rb +21 -21
  17. data/lib/cosmos/packet_logs/packet_log_writer.rb +18 -20
  18. data/lib/cosmos/packets/commands.rb +8 -6
  19. data/lib/cosmos/packets/limits.rb +3 -2
  20. data/lib/cosmos/packets/packet.rb +14 -11
  21. data/lib/cosmos/packets/parsers/limits_parser.rb +1 -1
  22. data/lib/cosmos/packets/parsers/macro_parser.rb +4 -4
  23. data/lib/cosmos/packets/parsers/state_parser.rb +1 -1
  24. data/lib/cosmos/packets/structure.rb +2 -2
  25. data/lib/cosmos/packets/telemetry.rb +5 -4
  26. data/lib/cosmos/script/script.rb +6 -6
  27. data/lib/cosmos/streams/tcpip_socket_stream.rb +2 -1
  28. data/lib/cosmos/streams/template_stream_protocol.rb +1 -1
  29. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +1 -1
  30. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +5 -8
  31. data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +4 -3
  32. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -3
  33. data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +15 -11
  34. data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
  35. data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +2 -2
  36. data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +2 -2
  37. data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +0 -2
  38. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1 -1
  39. data/lib/cosmos/tools/replay/replay.rb +2 -2
  40. data/lib/cosmos/tools/script_runner/script_audit.rb +1 -1
  41. data/lib/cosmos/tools/script_runner/script_runner.rb +1 -1
  42. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +3 -7
  43. data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
  44. data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
  45. data/lib/cosmos/tools/test_runner/test_runner.rb +2 -2
  46. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +2 -1
  47. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
  48. data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +1 -0
  49. data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +1 -0
  50. data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +1 -0
  51. data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +3 -3
  52. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -3
  53. data/lib/cosmos/top_level.rb +2 -6
  54. data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
  55. data/lib/cosmos/version.rb +5 -5
  56. data/lib/cosmos/win32/win32_main.rb +11 -7
  57. data/spec/ccsds/ccsds_packet_spec.rb +28 -28
  58. data/spec/ccsds/ccsds_parser_spec.rb +27 -27
  59. data/spec/config/config_parser_spec.rb +88 -88
  60. data/spec/conversions/conversion_spec.rb +3 -3
  61. data/spec/conversions/generic_conversion_spec.rb +9 -9
  62. data/spec/conversions/new_packet_log_conversion_spec.rb +4 -4
  63. data/spec/conversions/polynomial_conversion_spec.rb +7 -7
  64. data/spec/conversions/processor_conversion_spec.rb +9 -9
  65. data/spec/conversions/received_count_conversion_spec.rb +7 -7
  66. data/spec/conversions/received_time_formatted_conversion_spec.rb +9 -9
  67. data/spec/conversions/received_time_seconds_conversion_spec.rb +9 -9
  68. data/spec/conversions/segmented_polynomial_conversion_spec.rb +11 -11
  69. data/spec/conversions/unix_time_formatted_conversion_spec.rb +13 -13
  70. data/spec/conversions/unix_time_seconds_conversion_spec.rb +13 -13
  71. data/spec/core_ext/array_spec.rb +76 -76
  72. data/spec/core_ext/class_spec.rb +3 -3
  73. data/spec/core_ext/cosmos_io_spec.rb +16 -16
  74. data/spec/core_ext/exception_spec.rb +19 -19
  75. data/spec/core_ext/file_spec.rb +16 -16
  76. data/spec/core_ext/hash_spec.rb +3 -3
  77. data/spec/core_ext/io_spec.rb +2 -2
  78. data/spec/core_ext/kernel_spec.rb +2 -2
  79. data/spec/core_ext/math_spec.rb +43 -43
  80. data/spec/core_ext/matrix_spec.rb +22 -22
  81. data/spec/core_ext/objectspace_spec.rb +6 -6
  82. data/spec/core_ext/range_spec.rb +2 -2
  83. data/spec/core_ext/socket_spec.rb +4 -4
  84. data/spec/core_ext/string_spec.rb +67 -67
  85. data/spec/core_ext/stringio_spec.rb +2 -2
  86. data/spec/core_ext/time_spec.rb +82 -82
  87. data/spec/gui/line_graph/line_clip_spec.rb +34 -34
  88. data/spec/interfaces/interface_spec.rb +46 -46
  89. data/spec/interfaces/linc_interface_spec.rb +26 -26
  90. data/spec/interfaces/serial_interface_spec.rb +16 -16
  91. data/spec/interfaces/simulated_target_interface_spec.rb +21 -21
  92. data/spec/interfaces/stream_interface_spec.rb +22 -22
  93. data/spec/interfaces/tcpip_client_interface_spec.rb +14 -14
  94. data/spec/interfaces/tcpip_server_interface_spec.rb +41 -41
  95. data/spec/interfaces/udp_interface_spec.rb +46 -46
  96. data/spec/io/buffered_file_spec.rb +50 -50
  97. data/spec/io/io_multiplexer_spec.rb +9 -9
  98. data/spec/io/json_drb_object_spec.rb +7 -7
  99. data/spec/io/json_drb_spec.rb +55 -55
  100. data/spec/io/json_rpc_spec.rb +68 -68
  101. data/spec/io/raw_logger_pair_spec.rb +28 -28
  102. data/spec/io/raw_logger_spec.rb +22 -22
  103. data/spec/io/serial_driver_spec.rb +3 -3
  104. data/spec/io/stderr_spec.rb +2 -2
  105. data/spec/io/stdout_spec.rb +2 -2
  106. data/spec/io/tcpip_server_spec.rb +62 -62
  107. data/spec/io/udp_sockets_spec.rb +19 -19
  108. data/spec/io/win32_serial_driver_spec.rb +10 -10
  109. data/spec/packet_logs/meta_packet_log_writer_spec.rb +32 -32
  110. data/spec/packet_logs/packet_log_reader_spec.rb +138 -138
  111. data/spec/packet_logs/packet_log_writer_pair_spec.rb +3 -3
  112. data/spec/packet_logs/packet_log_writer_spec.rb +26 -26
  113. data/spec/packets/binary_accessor_spec.rb +672 -672
  114. data/spec/packets/commands_spec.rb +123 -123
  115. data/spec/packets/limits_response_spec.rb +1 -1
  116. data/spec/packets/limits_spec.rb +69 -69
  117. data/spec/packets/packet_config_spec.rb +93 -93
  118. data/spec/packets/packet_item_limits_spec.rb +46 -46
  119. data/spec/packets/packet_item_spec.rb +108 -108
  120. data/spec/packets/packet_spec.rb +364 -348
  121. data/spec/packets/parsers/format_string_parser_spec.rb +13 -13
  122. data/spec/packets/parsers/limits_parser_spec.rb +8 -8
  123. data/spec/packets/parsers/limits_response_parser_spec.rb +9 -9
  124. data/spec/packets/parsers/macro_parser_spec.rb +34 -6
  125. data/spec/packets/parsers/packet_parser_spec.rb +6 -6
  126. data/spec/packets/parsers/processor_parser_spec.rb +7 -7
  127. data/spec/packets/parsers/state_parser_spec.rb +23 -23
  128. data/spec/packets/structure_item_spec.rb +62 -62
  129. data/spec/packets/structure_spec.rb +183 -183
  130. data/spec/packets/telemetry_spec.rb +174 -174
  131. data/spec/processors/new_packet_log_processor_spec.rb +4 -4
  132. data/spec/processors/processor_spec.rb +9 -9
  133. data/spec/processors/statistics_processor_spec.rb +21 -21
  134. data/spec/processors/watermark_processor_spec.rb +12 -12
  135. data/spec/script/script_spec.rb +158 -158
  136. data/spec/spec_helper.rb +44 -13
  137. data/spec/streams/burst_stream_protocol_spec.rb +8 -8
  138. data/spec/streams/fixed_stream_protocol_spec.rb +26 -26
  139. data/spec/streams/length_stream_protocol_spec.rb +27 -27
  140. data/spec/streams/preidentified_stream_protocol_spec.rb +25 -25
  141. data/spec/streams/serial_stream_spec.rb +19 -19
  142. data/spec/streams/stream_protocol_spec.rb +52 -52
  143. data/spec/streams/stream_spec.rb +1 -1
  144. data/spec/streams/tcpip_client_stream_spec.rb +7 -7
  145. data/spec/streams/tcpip_socket_stream_spec.rb +84 -49
  146. data/spec/streams/template_stream_protocol_spec.rb +17 -17
  147. data/spec/streams/terminated_stream_protocol_spec.rb +19 -19
  148. data/spec/system/system_spec.rb +95 -95
  149. data/spec/system/target_spec.rb +32 -32
  150. data/spec/tools/cmd_tlm_server/api_spec.rb +386 -386
  151. data/spec/tools/cmd_tlm_server/background_task_spec.rb +3 -3
  152. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +8 -8
  153. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +57 -57
  154. data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -85
  155. data/spec/tools/cmd_tlm_server/commanding_spec.rb +11 -11
  156. data/spec/tools/cmd_tlm_server/connections_spec.rb +23 -23
  157. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +57 -57
  158. data/spec/tools/cmd_tlm_server/interfaces_spec.rb +32 -32
  159. data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +17 -17
  160. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +15 -15
  161. data/spec/tools/cmd_tlm_server/routers_spec.rb +36 -36
  162. data/spec/top_level/top_level_spec.rb +60 -60
  163. data/spec/utilities/crc_spec.rb +6 -6
  164. data/spec/utilities/csv_spec.rb +13 -13
  165. data/spec/utilities/logger_spec.rb +20 -20
  166. data/spec/utilities/message_log_spec.rb +13 -13
  167. data/spec/utilities/quaternion_spec.rb +30 -30
  168. data/spec/utilities/ruby_lex_utils_spec.rb +14 -14
  169. data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
  170. data/test/benchmarks/gsub_benchmark.rb +114 -0
  171. data/test/performance/PACKETS.bat +1 -0
  172. data/test/performance/Rakefile +77 -0
  173. data/test/performance/THREADS.bat +1 -0
  174. data/test/performance/config/data/attitude.bin +0 -0
  175. data/test/performance/config/data/crc.txt +206 -0
  176. data/test/performance/config/data/diamond.STL +58 -0
  177. data/test/performance/config/data/groundoff.gif +0 -0
  178. data/test/performance/config/data/groundon.gif +0 -0
  179. data/test/performance/config/data/hselectoff.gif +0 -0
  180. data/test/performance/config/data/hselecton.gif +0 -0
  181. data/test/performance/config/data/hswitchoff.gif +0 -0
  182. data/test/performance/config/data/hswitchon.gif +0 -0
  183. data/test/performance/config/data/meta_init.txt +4 -0
  184. data/test/performance/config/data/position.bin +0 -0
  185. data/test/performance/config/data/poweroff.gif +0 -0
  186. data/test/performance/config/data/poweron.gif +0 -0
  187. data/test/performance/config/data/satellite.gif +0 -0
  188. data/test/performance/config/data/tada.wav +0 -0
  189. data/test/performance/config/data/vswitchoff.gif +0 -0
  190. data/test/performance/config/data/vswitchon.gif +0 -0
  191. data/test/performance/config/system/system_packets.txt +39 -0
  192. data/test/performance/config/system/system_threads.txt +59 -0
  193. data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
  194. data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
  195. data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
  196. data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
  197. data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
  198. data/test/performance/config/targets/COSMOS/target.txt +11 -0
  199. data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +17 -0
  200. data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +18 -0
  201. data/test/performance/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -0
  202. data/test/performance/config/targets/EXAMPLE/lib/example_interface.rb +22 -0
  203. data/test/performance/config/targets/EXAMPLE/target.txt +7 -0
  204. data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
  205. data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +34 -0
  206. data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
  207. data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
  208. data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
  209. data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
  210. data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
  211. data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
  212. data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
  213. data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
  214. data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
  215. data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
  216. data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
  217. data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
  218. data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
  219. data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
  220. data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
  221. data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
  222. data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
  223. data/test/performance/config/tools/launcher/launcher_packets.txt +29 -0
  224. data/test/performance/config/tools/launcher/launcher_threads.txt +70 -0
  225. data/test/performance/config/tools/limits_monitor/README.txt +1 -0
  226. data/test/performance/config/tools/opengl_builder/README.txt +1 -0
  227. data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
  228. data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
  229. data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
  230. data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
  231. data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
  232. data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
  233. data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
  234. data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
  235. data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
  236. data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
  237. data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
  238. data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
  239. data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
  240. data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
  241. data/test/performance/lib/example_background_task.rb +57 -0
  242. data/test/performance/lib/example_target.rb +120 -0
  243. data/test/performance/lib/scpi_target.rb +74 -0
  244. data/test/performance/lib/user_version.rb +3 -0
  245. data/test/performance/outputs/handbooks/README.txt +1 -0
  246. data/test/performance/outputs/logs/README.txt +1 -0
  247. data/test/performance/outputs/saved_config/README.txt +1 -0
  248. data/test/performance/outputs/tables/README.txt +1 -0
  249. data/test/performance/outputs/tmp/README.txt +1 -0
  250. data/test/performance/procedures/checks.rb +11 -0
  251. data/test/performance/procedures/clear_util.rb +7 -0
  252. data/test/performance/procedures/collect.rb +18 -0
  253. data/test/performance/procedures/collect_util.rb +14 -0
  254. data/test/performance/procedures/cosmos_api_test.rb +293 -0
  255. data/test/performance/procedures/disconnect.rb +29 -0
  256. data/test/performance/procedures/example_test.rb +182 -0
  257. data/test/performance/procedures/plot_test.rb +8 -0
  258. data/test/performance/procedures/procedure.rb +3 -0
  259. data/test/performance/procedures/run_example_test.rb +3 -0
  260. data/test/performance/procedures/test.rb +51 -0
  261. data/test/performance/tools/CmdExtractor +14 -0
  262. data/test/performance/tools/CmdExtractor.bat +59 -0
  263. data/test/performance/tools/CmdSender +14 -0
  264. data/test/performance/tools/CmdSender.bat +59 -0
  265. data/test/performance/tools/CmdTlmServer +16 -0
  266. data/test/performance/tools/CmdTlmServer.bat +59 -0
  267. data/test/performance/tools/CmdTlmServerMemProf +20 -0
  268. data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
  269. data/test/performance/tools/DataViewer +14 -0
  270. data/test/performance/tools/DataViewer.bat +59 -0
  271. data/test/performance/tools/ExampleTarget +14 -0
  272. data/test/performance/tools/ExampleTarget.bat +59 -0
  273. data/test/performance/tools/HandbookCreator +14 -0
  274. data/test/performance/tools/HandbookCreator.bat +61 -0
  275. data/test/performance/tools/Launcher +14 -0
  276. data/test/performance/tools/Launcher.bat +59 -0
  277. data/test/performance/tools/LimitsMonitor +14 -0
  278. data/test/performance/tools/LimitsMonitor.bat +59 -0
  279. data/test/performance/tools/OpenGLBuilder +14 -0
  280. data/test/performance/tools/OpenGLBuilder.bat +59 -0
  281. data/test/performance/tools/PacketViewer +14 -0
  282. data/test/performance/tools/PacketViewer.bat +59 -0
  283. data/test/performance/tools/Replay +14 -0
  284. data/test/performance/tools/Replay.bat +59 -0
  285. data/test/performance/tools/ScpiTarget +14 -0
  286. data/test/performance/tools/ScpiTarget.bat +59 -0
  287. data/test/performance/tools/ScriptRunner +14 -0
  288. data/test/performance/tools/ScriptRunner.bat +59 -0
  289. data/test/performance/tools/TableManager +14 -0
  290. data/test/performance/tools/TableManager.bat +59 -0
  291. data/test/performance/tools/TestRunner +14 -0
  292. data/test/performance/tools/TestRunner.bat +59 -0
  293. data/test/performance/tools/TlmExtractor +14 -0
  294. data/test/performance/tools/TlmExtractor.bat +59 -0
  295. data/test/performance/tools/TlmGrapher +14 -0
  296. data/test/performance/tools/TlmGrapher.bat +59 -0
  297. data/test/performance/tools/TlmViewer +14 -0
  298. data/test/performance/tools/TlmViewer.bat +59 -0
  299. data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
  300. data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
  301. data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
  302. data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
  303. data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
  304. data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
  305. data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
  306. data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
  307. data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
  308. data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
  309. data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
  310. data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
  311. data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
  312. data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
  313. data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
  314. data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
  315. data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
  316. data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
  317. data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
  318. data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
  319. data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
  320. data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
  321. data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
  322. data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
  323. data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
  324. data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
  325. data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
  326. data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
  327. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
  328. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
  329. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
  330. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
  331. data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
  332. data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
  333. data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
  334. data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
  335. data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
  336. data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
  337. data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
  338. data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
  339. data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
  340. data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
  341. data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
  342. data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
  343. data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
  344. data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
  345. data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
  346. data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
  347. data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
  348. data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
  349. data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
  350. data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
  351. data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
  352. data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
  353. data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
  354. data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
  355. data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
  356. data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
  357. data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
  358. data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
  359. data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
  360. data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
  361. data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
  362. data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
  363. data/test/performance/userpath.txt +1 -0
  364. metadata +197 -2
@@ -18,23 +18,23 @@ module Cosmos
18
18
  describe Packet do
19
19
 
20
20
  describe "buffer=" do
21
- it "should set the buffer" do
21
+ it "sets the buffer" do
22
22
  p = Packet.new("tgt", "pkt")
23
23
  p.buffer = "\x00\x01\x02\x03"
24
- p.buffer.should eql "\x00\x01\x02\x03"
24
+ expect(p.buffer).to eql "\x00\x01\x02\x03"
25
25
  end
26
26
 
27
- it "should complain if the given buffer is too big" do
27
+ it "complains if the given buffer is too big" do
28
28
  capture_io do |stdout|
29
29
  p = Packet.new("tgt", "pkt")
30
30
  p.append_item("test1", 16, :UINT)
31
31
 
32
32
  p.buffer = "\x00\x00\x00"
33
- stdout.string.should match(/TGT PKT received with actual packet length of 3 but defined length of 2/)
33
+ expect(stdout.string).to match(/TGT PKT received with actual packet length of 3 but defined length of 2/)
34
34
  end
35
35
  end
36
36
 
37
- it "should run processors if present" do
37
+ it "runs processors if present" do
38
38
  p = Packet.new("tgt", "pkt")
39
39
  p.processors['processor'] = double("call", :call => true)
40
40
  p.buffer = "\x00\x01\x02\x03"
@@ -42,50 +42,50 @@ module Cosmos
42
42
  end
43
43
 
44
44
  describe "target_name=" do
45
- it "should set the target_name to an uppercase String" do
45
+ it "sets the target_name to an uppercase String" do
46
46
  p = Packet.new("tgt", "pkt")
47
- p.target_name.should eql "TGT"
47
+ expect(p.target_name).to eql "TGT"
48
48
  end
49
49
 
50
- it "should set target_name to nil" do
50
+ it "sets target_name to nil" do
51
51
  p = Packet.new(nil,"pkt")
52
- p.target_name.should be_nil
52
+ expect(p.target_name).to be_nil
53
53
  end
54
54
 
55
- it "should complain about non String target_names" do
55
+ it "complains about non String target_names" do
56
56
  expect { Packet.new(5, "pkt") }.to raise_error(ArgumentError, "target_name must be a String but is a Fixnum")
57
57
  end
58
58
  end
59
59
 
60
60
  describe "packet_name=" do
61
- it "should set the packet_name to an uppercase String" do
61
+ it "sets the packet_name to an uppercase String" do
62
62
  p = Packet.new("tgt", "pkt")
63
- p.packet_name.should eql "PKT"
63
+ expect(p.packet_name).to eql "PKT"
64
64
  end
65
65
 
66
- it "should set packet_name to nil" do
66
+ it "sets packet_name to nil" do
67
67
  p = Packet.new("tgt",nil)
68
- p.packet_name.should be_nil
68
+ expect(p.packet_name).to be_nil
69
69
  end
70
70
 
71
- it "should complain about non String packet_names" do
71
+ it "complains about non String packet_names" do
72
72
  expect { Packet.new("tgt", 5) }.to raise_error(ArgumentError, "packet_name must be a String but is a Fixnum")
73
73
  end
74
74
  end
75
75
 
76
76
  describe "description=" do
77
- it "should set the description to a String" do
77
+ it "sets the description to a String" do
78
78
  p = Packet.new("tgt", "pkt", :BIG_ENDIAN, "This is a description")
79
- p.description.should eql "This is a description"
79
+ expect(p.description).to eql "This is a description"
80
80
  end
81
81
 
82
- it "should set description to nil" do
82
+ it "sets description to nil" do
83
83
  p = Packet.new("tgt","pkt")
84
84
  p.description = nil
85
- p.description.should be_nil
85
+ expect(p.description).to be_nil
86
86
  end
87
87
 
88
- it "should complain about non String descriptions" do
88
+ it "complains about non String descriptions" do
89
89
  p = Packet.new("tgt","pkt")
90
90
  expect { p.description = 5 }.to raise_error(ArgumentError, "description must be a String but is a Fixnum")
91
91
  end
@@ -99,143 +99,143 @@ module Cosmos
99
99
  expect(p.received_time).to eql t
100
100
  end
101
101
 
102
- it "should set received_time to nil" do
102
+ it "sets received_time to nil" do
103
103
  p = Packet.new("tgt","pkt")
104
104
  p.received_time = nil
105
- p.received_time.should be_nil
105
+ expect(p.received_time).to be_nil
106
106
  end
107
107
 
108
- it "should complain about non Time received_times" do
108
+ it "complains about non Time received_times" do
109
109
  p = Packet.new("tgt","pkt")
110
110
  expect {p.received_time = "1pm" }.to raise_error(ArgumentError, "received_time must be a Time but is a String")
111
111
  end
112
112
  end
113
113
 
114
114
  describe "received_time=" do
115
- it "should set the received_time to a Time" do
115
+ it "sets the received_time to a Time" do
116
116
  p = Packet.new("tgt", "pkt")
117
117
  t = Time.now
118
118
  p.received_time = t
119
- p.received_time.should eql t
119
+ expect(p.received_time).to eql t
120
120
  end
121
121
 
122
- it "should set received_time to nil" do
122
+ it "sets received_time to nil" do
123
123
  p = Packet.new("tgt","pkt")
124
124
  p.received_time = nil
125
- p.received_time.should be_nil
125
+ expect(p.received_time).to be_nil
126
126
  end
127
127
 
128
- it "should complain about non Time received_times" do
128
+ it "complains about non Time received_times" do
129
129
  p = Packet.new("tgt","pkt")
130
130
  expect {p.received_time = "1pm" }.to raise_error(ArgumentError, "received_time must be a Time but is a String")
131
131
  end
132
132
  end
133
133
 
134
134
  describe "received_count=" do
135
- it "should set the received_count to a Fixnum" do
135
+ it "sets the received_count to a Fixnum" do
136
136
  p = Packet.new("tgt", "pkt")
137
137
  p.received_count = 10
138
- p.received_count.should eql 10
138
+ expect(p.received_count).to eql 10
139
139
  end
140
140
 
141
- it "should complain about nil received_count" do
141
+ it "complains about nil received_count" do
142
142
  p = Packet.new("tgt","pkt")
143
143
  expect {p.received_count = nil }.to raise_error(ArgumentError, "received_count must be a Fixnum but is a NilClass")
144
144
  end
145
145
 
146
- it "should complain about non Fixnum received_counts" do
146
+ it "complains about non Fixnum received_counts" do
147
147
  p = Packet.new("tgt","pkt")
148
148
  expect {p.received_count = "5" }.to raise_error(ArgumentError, "received_count must be a Fixnum but is a String")
149
149
  end
150
150
  end
151
151
 
152
152
  describe "hazardous_description=" do
153
- it "should set the hazardous_description to a String" do
153
+ it "sets the hazardous_description to a String" do
154
154
  p = Packet.new("tgt", "pkt")
155
155
  p.hazardous_description = "This is a description"
156
- p.hazardous_description.should eql "This is a description"
156
+ expect(p.hazardous_description).to eql "This is a description"
157
157
  end
158
158
 
159
- it "should set hazardous_description to nil" do
159
+ it "sets hazardous_description to nil" do
160
160
  p = Packet.new("tgt","pkt")
161
161
  p.hazardous_description = nil
162
- p.hazardous_description.should be_nil
162
+ expect(p.hazardous_description).to be_nil
163
163
  end
164
164
 
165
- it "should complain about non String hazardous_descriptions" do
165
+ it "complains about non String hazardous_descriptions" do
166
166
  p = Packet.new("tgt","pkt")
167
167
  expect {p.hazardous_description = 5 }.to raise_error(ArgumentError, "hazardous_description must be a String but is a Fixnum")
168
168
  end
169
169
  end
170
170
 
171
171
  describe "given_values=" do
172
- it "should set the given_values to a Hash" do
172
+ it "sets the given_values to a Hash" do
173
173
  p = Packet.new("tgt", "pkt")
174
174
  gv = {}
175
175
  p.given_values = gv
176
- p.given_values.should eql gv
176
+ expect(p.given_values).to eql gv
177
177
  end
178
178
 
179
- it "should set given_values to nil" do
179
+ it "sets given_values to nil" do
180
180
  p = Packet.new("tgt","pkt")
181
181
  p.given_values = nil
182
- p.given_values.should be_nil
182
+ expect(p.given_values).to be_nil
183
183
  end
184
184
 
185
- it "should complain about non Hash given_valuess" do
185
+ it "complains about non Hash given_valuess" do
186
186
  p = Packet.new("tgt","pkt")
187
187
  expect {p.given_values = [] }.to raise_error(ArgumentError, "given_values must be a Hash but is a Array")
188
188
  end
189
189
  end
190
190
 
191
191
  describe "meta" do
192
- it "should allow adding items to the meta hash" do
192
+ it "allows adding items to the meta hash" do
193
193
  p = Packet.new("tgt","pkt")
194
194
  p.meta['TYPE'] = 'float32'
195
- p.meta['TYPE'].should eql 'float32'
195
+ expect(p.meta['TYPE']).to eql 'float32'
196
196
  end
197
197
  end
198
198
 
199
199
  describe "limits_change_callback=" do
200
- it "should set the limits_change_callback to something that responds to call" do
200
+ it "sets the limits_change_callback to something that responds to call" do
201
201
  p = Packet.new("tgt", "pkt")
202
202
  callback = Object.new
203
203
  allow(callback).to receive(:call)
204
204
  expect { p.limits_change_callback = callback }.to_not raise_error
205
205
  end
206
206
 
207
- it "should set limits_change_callback to nil" do
207
+ it "sets limits_change_callback to nil" do
208
208
  p = Packet.new("tgt","pkt")
209
209
  expect { p.limits_change_callback = nil }.to_not raise_error
210
210
  end
211
211
 
212
- it "should complain about non #call limits_change_callbacks" do
212
+ it "complains about non #call limits_change_callbacks" do
213
213
  p = Packet.new("tgt","pkt")
214
214
  expect {p.limits_change_callback = "" }.to raise_error(ArgumentError, "limits_change_callback must respond to call")
215
215
  end
216
216
  end
217
217
 
218
218
  describe "define_item" do
219
- it "should take a format_string, read_conversion, write_conversion, and id_value" do
219
+ it "takes a format_string, read_conversion, write_conversion, and id_value" do
220
220
  p = Packet.new("tgt","pkt")
221
221
  rc = GenericConversion.new("value / 2")
222
222
  wc = GenericConversion.new("value * 2")
223
223
  p.define_item("item",0,32,:FLOAT,nil,:BIG_ENDIAN,:ERROR,"%5.1f",rc,wc,5)
224
224
  i = p.get_item("ITEM")
225
- i.format_string.should eql "%5.1f"
226
- i.read_conversion.to_s.should eql rc.to_s
227
- i.write_conversion.to_s.should eql wc.to_s
228
- i.id_value.should eql 5.0
225
+ expect(i.format_string).to eql "%5.1f"
226
+ expect(i.read_conversion.to_s).to eql rc.to_s
227
+ expect(i.write_conversion.to_s).to eql wc.to_s
228
+ expect(i.id_value).to eql 5.0
229
229
  end
230
230
 
231
- it "should initialize format_string, read_conversion, write_conversion, and id_value to nil" do
231
+ it "initializes format_string, read_conversion, write_conversion, and id_value to nil" do
232
232
  p = Packet.new("tgt","pkt")
233
233
  p.define_item("item",0,32,:FLOAT)
234
234
  i = p.get_item("ITEM")
235
- i.format_string.should be_nil
236
- i.read_conversion.should be_nil
237
- i.write_conversion.should be_nil
238
- i.id_value.should be_nil
235
+ expect(i.format_string).to be_nil
236
+ expect(i.read_conversion).to be_nil
237
+ expect(i.write_conversion).to be_nil
238
+ expect(i.id_value).to be_nil
239
239
  end
240
240
  end
241
241
 
@@ -252,14 +252,14 @@ module Cosmos
252
252
  pi.id_value = 5
253
253
  p.define(pi)
254
254
  i = p.get_item("ITEM1")
255
- i.format_string.should eql "%5.1f"
256
- i.read_conversion.to_s.should eql rc.to_s
257
- i.write_conversion.to_s.should eql wc.to_s
258
- i.id_value.should eql 5.0
255
+ expect(i.format_string).to eql "%5.1f"
256
+ expect(i.read_conversion.to_s).to eql rc.to_s
257
+ expect(i.write_conversion.to_s).to eql wc.to_s
258
+ expect(i.id_value).to eql 5.0
259
259
  expect(p.id_items.length).to eq 1
260
260
  expect(p.id_items[0].name).to eq 'ITEM1'
261
261
  expect(p.limits_items[0].name).to eq 'ITEM1'
262
- p.defined_length.should eql 4
262
+ expect(p.defined_length).to eql 4
263
263
  end
264
264
 
265
265
  it "allows PacketItems to be defined on top of each other" do
@@ -268,34 +268,34 @@ module Cosmos
268
268
  p.define(pi)
269
269
  pi = PacketItem.new("item2",0,32,:UINT,:BIG_ENDIAN)
270
270
  p.define(pi)
271
- p.defined_length.should eql 4
271
+ expect(p.defined_length).to eql 4
272
272
  buffer = "\x01\x02\x03\x04"
273
- p.read_item(p.get_item("item1"), :RAW, buffer).should eql 1
274
- p.read_item(p.get_item("item2"), :RAW, buffer).should eql 0x1020304
273
+ expect(p.read_item(p.get_item("item1"), :RAW, buffer)).to eql 1
274
+ expect(p.read_item(p.get_item("item2"), :RAW, buffer)).to eql 0x1020304
275
275
  end
276
276
  end
277
277
 
278
278
  describe "append_item" do
279
- it "should take a format_string, read_conversion, write_conversion, and id_value" do
279
+ it "takes a format_string, read_conversion, write_conversion, and id_value" do
280
280
  p = Packet.new("tgt","pkt")
281
281
  rc = GenericConversion.new("value / 2")
282
282
  wc = GenericConversion.new("value * 2")
283
283
  p.append_item("item",32,:FLOAT,nil,:BIG_ENDIAN,:ERROR,"%5.1f",rc,wc,5)
284
284
  i = p.get_item("ITEM")
285
- i.format_string.should eql "%5.1f"
286
- i.read_conversion.to_s.should eql rc.to_s
287
- i.write_conversion.to_s.should eql wc.to_s
288
- i.id_value.should eql 5.0
285
+ expect(i.format_string).to eql "%5.1f"
286
+ expect(i.read_conversion.to_s).to eql rc.to_s
287
+ expect(i.write_conversion.to_s).to eql wc.to_s
288
+ expect(i.id_value).to eql 5.0
289
289
  end
290
290
 
291
- it "should initialize format_string, read_conversion, write_conversion, and id_value to nil" do
291
+ it "initializes format_string, read_conversion, write_conversion, and id_value to nil" do
292
292
  p = Packet.new("tgt","pkt")
293
293
  p.append_item("item",32,:FLOAT)
294
294
  i = p.get_item("ITEM")
295
- i.format_string.should be_nil
296
- i.read_conversion.should be_nil
297
- i.write_conversion.should be_nil
298
- i.id_value.should be_nil
295
+ expect(i.format_string).to be_nil
296
+ expect(i.read_conversion).to be_nil
297
+ expect(i.write_conversion).to be_nil
298
+ expect(i.id_value).to be_nil
299
299
  end
300
300
  end
301
301
 
@@ -312,14 +312,14 @@ module Cosmos
312
312
  pi.id_value = 5
313
313
  p.append(pi)
314
314
  i = p.get_item("ITEM1")
315
- i.format_string.should eql "%5.1f"
316
- i.read_conversion.to_s.should eql rc.to_s
317
- i.write_conversion.to_s.should eql wc.to_s
318
- i.id_value.should eql 5.0
315
+ expect(i.format_string).to eql "%5.1f"
316
+ expect(i.read_conversion.to_s).to eql rc.to_s
317
+ expect(i.write_conversion.to_s).to eql wc.to_s
318
+ expect(i.id_value).to eql 5.0
319
319
  expect(p.id_items.length).to eq 1
320
320
  expect(p.id_items[0].name).to eq 'ITEM1'
321
321
  expect(p.limits_items[0].name).to eq 'ITEM1'
322
- p.defined_length.should eql 4
322
+ expect(p.defined_length).to eql 4
323
323
 
324
324
  pi = PacketItem.new("item2",0,32,:FLOAT,:BIG_ENDIAN,nil,:ERROR)
325
325
  p.append(pi)
@@ -330,12 +330,12 @@ module Cosmos
330
330
  expect(i.write_conversion).to be nil
331
331
  expect(i.id_value).to be nil
332
332
  expect(p.id_items.length).to eq 1
333
- p.defined_length.should eql 8
333
+ expect(p.defined_length).to eql 8
334
334
  end
335
335
  end
336
336
 
337
337
  describe "get_item" do
338
- it "should complain if an item doesn't exist" do
338
+ it "complains if an item doesn't exist" do
339
339
  p = Packet.new("tgt","pkt")
340
340
  expect { p.get_item("test") }.to raise_error(RuntimeError, "Packet item 'TGT PKT TEST' does not exist")
341
341
  end
@@ -346,109 +346,109 @@ module Cosmos
346
346
  @p = Packet.new("tgt","pkt")
347
347
  end
348
348
 
349
- it "should complain about unknown value_type" do
349
+ it "complains about unknown value_type" do
350
350
  @p.append_item("item",32,:UINT)
351
351
  i = @p.get_item("ITEM")
352
352
  expect { @p.read("ITEM", :MINE, "\x01\x02\x03\x04") }.to raise_error(ArgumentError, "Unknown value type on read: MINE")
353
353
  expect { @p.read_item(i, :MINE, "\x01\x02\x03\x04") }.to raise_error(ArgumentError, "Unknown value type on read: MINE")
354
354
  end
355
355
 
356
- it "should read the RAW value" do
356
+ it "reads the RAW value" do
357
357
  @p.append_item("item",32,:UINT)
358
358
  i = @p.get_item("ITEM")
359
- @p.read("ITEM", :RAW, "\x01\x02\x03\x04").should eql 0x01020304
360
- @p.read_item(i, :RAW, "\x01\x02\x03\x04").should eql 0x01020304
359
+ expect(@p.read("ITEM", :RAW, "\x01\x02\x03\x04")).to eql 0x01020304
360
+ expect(@p.read_item(i, :RAW, "\x01\x02\x03\x04")).to eql 0x01020304
361
361
  end
362
362
 
363
- it "should read the CONVERTED value" do
363
+ it "reads the CONVERTED value" do
364
364
  @p.append_item("item",8,:UINT)
365
365
  i = @p.get_item("ITEM")
366
- @p.read("ITEM", :CONVERTED, "\x02").should eql 2
367
- @p.read_item(i, :CONVERTED, "\x02").should eql 2
366
+ expect(@p.read("ITEM", :CONVERTED, "\x02")).to eql 2
367
+ expect(@p.read_item(i, :CONVERTED, "\x02")).to eql 2
368
368
  i.read_conversion = GenericConversion.new("value / 2")
369
- @p.read("ITEM", :CONVERTED, "\x02").should eql 1
370
- @p.read_item(i, :CONVERTED, "\x02").should eql 1
369
+ expect(@p.read("ITEM", :CONVERTED, "\x02")).to eql 1
370
+ expect(@p.read_item(i, :CONVERTED, "\x02")).to eql 1
371
371
  end
372
372
 
373
- it "should read the CONVERTED value with states" do
373
+ it "reads the CONVERTED value with states" do
374
374
  @p.append_item("item",8,:UINT)
375
375
  i = @p.get_item("ITEM")
376
376
  i.states = {"TRUE"=>1, "FALSE"=>2}
377
- @p.read("ITEM", :CONVERTED, "\x00").should eql 0
378
- @p.read_item(i, :CONVERTED, "\x00").should eql 0
379
- @p.read("ITEM", :CONVERTED, "\x01").should eql "TRUE"
380
- @p.read_item(i, :CONVERTED, "\x01").should eql "TRUE"
377
+ expect(@p.read("ITEM", :CONVERTED, "\x00")).to eql 0
378
+ expect(@p.read_item(i, :CONVERTED, "\x00")).to eql 0
379
+ expect(@p.read("ITEM", :CONVERTED, "\x01")).to eql "TRUE"
380
+ expect(@p.read_item(i, :CONVERTED, "\x01")).to eql "TRUE"
381
381
  i.read_conversion = GenericConversion.new("value / 2")
382
- @p.read("ITEM", :CONVERTED, "\x04").should eql "FALSE"
383
- @p.read_item(i, :CONVERTED, "\x04").should eql "FALSE"
382
+ expect(@p.read("ITEM", :CONVERTED, "\x04")).to eql "FALSE"
383
+ expect(@p.read_item(i, :CONVERTED, "\x04")).to eql "FALSE"
384
384
  end
385
385
 
386
- it "should read the FORMATTED value" do
386
+ it "reads the FORMATTED value" do
387
387
  @p.append_item("item",8,:UINT)
388
388
  i = @p.get_item("ITEM")
389
- @p.read("ITEM", :FORMATTED, "\x02").should eql "2"
390
- @p.read_item(i, :FORMATTED, "\x02").should eql "2"
389
+ expect(@p.read("ITEM", :FORMATTED, "\x02")).to eql "2"
390
+ expect(@p.read_item(i, :FORMATTED, "\x02")).to eql "2"
391
391
  i.format_string = "0x%x"
392
- @p.read("ITEM", :FORMATTED, "\x02").should eql "0x2"
393
- @p.read_item(i, :FORMATTED, "\x02").should eql "0x2"
392
+ expect(@p.read("ITEM", :FORMATTED, "\x02")).to eql "0x2"
393
+ expect(@p.read_item(i, :FORMATTED, "\x02")).to eql "0x2"
394
394
  i.states = {"TRUE"=>1, "FALSE"=>2}
395
- @p.read("ITEM", :FORMATTED, "\x01").should eql "TRUE"
396
- @p.read_item(i, :FORMATTED, "\x01").should eql "TRUE"
397
- @p.read("ITEM", :FORMATTED, "\x02").should eql "FALSE"
398
- @p.read_item(i, :FORMATTED, "\x02").should eql "FALSE"
399
- @p.read("ITEM", :FORMATTED, "\x04").should eql "0x4"
400
- @p.read_item(i, :FORMATTED, "\x04").should eql "0x4"
395
+ expect(@p.read("ITEM", :FORMATTED, "\x01")).to eql "TRUE"
396
+ expect(@p.read_item(i, :FORMATTED, "\x01")).to eql "TRUE"
397
+ expect(@p.read("ITEM", :FORMATTED, "\x02")).to eql "FALSE"
398
+ expect(@p.read_item(i, :FORMATTED, "\x02")).to eql "FALSE"
399
+ expect(@p.read("ITEM", :FORMATTED, "\x04")).to eql "0x4"
400
+ expect(@p.read_item(i, :FORMATTED, "\x04")).to eql "0x4"
401
401
  i.read_conversion = GenericConversion.new("value / 2")
402
- @p.read("ITEM", :FORMATTED, "\x04").should eql "FALSE"
403
- @p.read_item(i, :FORMATTED, "\x04").should eql "FALSE"
402
+ expect(@p.read("ITEM", :FORMATTED, "\x04")).to eql "FALSE"
403
+ expect(@p.read_item(i, :FORMATTED, "\x04")).to eql "FALSE"
404
404
  end
405
405
 
406
- it "should read the WITH_UNITS value" do
406
+ it "reads the WITH_UNITS value" do
407
407
  @p.append_item("item",8,:UINT)
408
408
  i = @p.get_item("ITEM")
409
409
  i.units = "V"
410
- @p.read("ITEM", :WITH_UNITS, "\x02").should eql "2 V"
411
- @p.read_item(i, :WITH_UNITS, "\x02").should eql "2 V"
410
+ expect(@p.read("ITEM", :WITH_UNITS, "\x02")).to eql "2 V"
411
+ expect(@p.read_item(i, :WITH_UNITS, "\x02")).to eql "2 V"
412
412
  i.format_string = "0x%x"
413
- @p.read("ITEM", :WITH_UNITS, "\x02").should eql "0x2 V"
414
- @p.read_item(i, :WITH_UNITS, "\x02").should eql "0x2 V"
413
+ expect(@p.read("ITEM", :WITH_UNITS, "\x02")).to eql "0x2 V"
414
+ expect(@p.read_item(i, :WITH_UNITS, "\x02")).to eql "0x2 V"
415
415
  i.states = {"TRUE"=>1, "FALSE"=>2}
416
- @p.read("ITEM", :WITH_UNITS, "\x01").should eql "TRUE"
417
- @p.read_item(i, :WITH_UNITS, "\x01").should eql "TRUE"
418
- @p.read("ITEM", :WITH_UNITS, "\x02").should eql "FALSE"
419
- @p.read_item(i, :WITH_UNITS, "\x02").should eql "FALSE"
420
- @p.read("ITEM", :WITH_UNITS, "\x04").should eql "0x4 V"
421
- @p.read_item(i, :WITH_UNITS, "\x04").should eql "0x4 V"
416
+ expect(@p.read("ITEM", :WITH_UNITS, "\x01")).to eql "TRUE"
417
+ expect(@p.read_item(i, :WITH_UNITS, "\x01")).to eql "TRUE"
418
+ expect(@p.read("ITEM", :WITH_UNITS, "\x02")).to eql "FALSE"
419
+ expect(@p.read_item(i, :WITH_UNITS, "\x02")).to eql "FALSE"
420
+ expect(@p.read("ITEM", :WITH_UNITS, "\x04")).to eql "0x4 V"
421
+ expect(@p.read_item(i, :WITH_UNITS, "\x04")).to eql "0x4 V"
422
422
  i.read_conversion = GenericConversion.new("value / 2")
423
- @p.read("ITEM", :WITH_UNITS, "\x04").should eql "FALSE"
424
- @p.read_item(i, :WITH_UNITS, "\x04").should eql "FALSE"
423
+ expect(@p.read("ITEM", :WITH_UNITS, "\x04")).to eql "FALSE"
424
+ expect(@p.read_item(i, :WITH_UNITS, "\x04")).to eql "FALSE"
425
425
  end
426
426
 
427
- it "should read the WITH_UNITS array value" do
427
+ it "reads the WITH_UNITS array value" do
428
428
  @p.append_item("item",8,:UINT, 16)
429
429
  i = @p.get_item("ITEM")
430
430
  i.units = "V"
431
- @p.read("ITEM", :WITH_UNITS, "\x01\x02").should eql ["1 V", "2 V"]
432
- @p.read_item(i, :WITH_UNITS, "\x01\x02").should eql ["1 V", "2 V"]
431
+ expect(@p.read("ITEM", :WITH_UNITS, "\x01\x02")).to eql ["1 V", "2 V"]
432
+ expect(@p.read_item(i, :WITH_UNITS, "\x01\x02")).to eql ["1 V", "2 V"]
433
433
  i.format_string = "0x%x"
434
- @p.read("ITEM", :WITH_UNITS, "\x01\x02").should eql ["0x1 V", "0x2 V"]
435
- @p.read_item(i, :WITH_UNITS, "\x01\x02").should eql ["0x1 V", "0x2 V"]
434
+ expect(@p.read("ITEM", :WITH_UNITS, "\x01\x02")).to eql ["0x1 V", "0x2 V"]
435
+ expect(@p.read_item(i, :WITH_UNITS, "\x01\x02")).to eql ["0x1 V", "0x2 V"]
436
436
  i.states = {"TRUE"=>1, "FALSE"=>2}
437
- @p.read("ITEM", :WITH_UNITS, "\x01\x02").should eql ["TRUE", "FALSE"]
438
- @p.read_item(i, :WITH_UNITS, "\x01\x02").should eql ["TRUE", "FALSE"]
439
- @p.read("ITEM", :WITH_UNITS, "\x00\x01").should eql ["0x0 V", "TRUE"]
440
- @p.read_item(i, :WITH_UNITS, "\x00\x01").should eql ["0x0 V", "TRUE"]
441
- @p.read("ITEM", :WITH_UNITS, "\x02\x03").should eql ["FALSE", "0x3 V"]
442
- @p.read_item(i, :WITH_UNITS, "\x02\x03").should eql ["FALSE", "0x3 V"]
443
- @p.read("ITEM", :WITH_UNITS, "\x04").should eql ["0x4 V"]
444
- @p.read_item(i, :WITH_UNITS, "\x04").should eql ["0x4 V"]
445
- @p.read("ITEM", :WITH_UNITS, "\x04").should eql ["0x4 V"]
446
- @p.read_item(i, :WITH_UNITS, "\x04").should eql ["0x4 V"]
437
+ expect(@p.read("ITEM", :WITH_UNITS, "\x01\x02")).to eql ["TRUE", "FALSE"]
438
+ expect(@p.read_item(i, :WITH_UNITS, "\x01\x02")).to eql ["TRUE", "FALSE"]
439
+ expect(@p.read("ITEM", :WITH_UNITS, "\x00\x01")).to eql ["0x0 V", "TRUE"]
440
+ expect(@p.read_item(i, :WITH_UNITS, "\x00\x01")).to eql ["0x0 V", "TRUE"]
441
+ expect(@p.read("ITEM", :WITH_UNITS, "\x02\x03")).to eql ["FALSE", "0x3 V"]
442
+ expect(@p.read_item(i, :WITH_UNITS, "\x02\x03")).to eql ["FALSE", "0x3 V"]
443
+ expect(@p.read("ITEM", :WITH_UNITS, "\x04")).to eql ["0x4 V"]
444
+ expect(@p.read_item(i, :WITH_UNITS, "\x04")).to eql ["0x4 V"]
445
+ expect(@p.read("ITEM", :WITH_UNITS, "\x04")).to eql ["0x4 V"]
446
+ expect(@p.read_item(i, :WITH_UNITS, "\x04")).to eql ["0x4 V"]
447
447
  i.read_conversion = GenericConversion.new("value / 2")
448
- @p.read("ITEM", :WITH_UNITS, "\x02\x04").should eql ["TRUE","FALSE"]
449
- @p.read_item(i, :WITH_UNITS, "\x02\x04").should eql ["TRUE","FALSE"]
450
- @p.read("ITEM", :WITH_UNITS, "\x08").should eql ["0x4 V"]
451
- @p.read_item(i, :WITH_UNITS, "\x08").should eql ["0x4 V"]
448
+ expect(@p.read("ITEM", :WITH_UNITS, "\x02\x04")).to eql ["TRUE","FALSE"]
449
+ expect(@p.read_item(i, :WITH_UNITS, "\x02\x04")).to eql ["TRUE","FALSE"]
450
+ expect(@p.read("ITEM", :WITH_UNITS, "\x08")).to eql ["0x4 V"]
451
+ expect(@p.read_item(i, :WITH_UNITS, "\x08")).to eql ["0x4 V"]
452
452
  end
453
453
  end
454
454
 
@@ -458,20 +458,20 @@ module Cosmos
458
458
  @buffer = "\x00\x00\x00\x00"
459
459
  end
460
460
 
461
- it "should complain about unknown value_type" do
461
+ it "complains about unknown value_type" do
462
462
  @p.append_item("item",32,:UINT)
463
463
  i = @p.get_item("ITEM")
464
464
  expect { @p.write("ITEM", 0, :MINE) }.to raise_error(ArgumentError, "Unknown value type on write: MINE")
465
465
  expect { @p.write_item(i, 0, :MINE) }.to raise_error(ArgumentError, "Unknown value type on write: MINE")
466
466
  end
467
467
 
468
- it "should write the RAW value" do
468
+ it "writes the RAW value" do
469
469
  @p.append_item("item",32,:UINT)
470
470
  i = @p.get_item("ITEM")
471
471
  @p.write("ITEM", 0x01020304, :RAW, @buffer)
472
- @buffer.should eql "\x01\x02\x03\x04"
472
+ expect(@buffer).to eql "\x01\x02\x03\x04"
473
473
  @p.write_item(i, 0x05060708, :RAW, @buffer)
474
- @buffer.should eql "\x05\x06\x07\x08"
474
+ expect(@buffer).to eql "\x05\x06\x07\x08"
475
475
  end
476
476
 
477
477
  it "clears the read cache" do
@@ -485,56 +485,56 @@ module Cosmos
485
485
  cache = @p.instance_variable_get(:@read_conversion_cache)
486
486
  expect(cache[i]).to be 2
487
487
  @p.write("ITEM", 0x08, :RAW)
488
- @p.buffer.should eql "\x08"
488
+ expect(@p.buffer).to eql "\x08"
489
489
  expect(cache[i]).to be nil
490
490
  expect(@p.read("ITEM")).to be 4
491
491
  expect(cache[i]).to be 4
492
492
  end
493
493
 
494
- it "should write the CONVERTED value" do
494
+ it "writes the CONVERTED value" do
495
495
  @p.append_item("item",8,:UINT)
496
496
  i = @p.get_item("ITEM")
497
497
  @p.write("ITEM", 1, :CONVERTED, @buffer)
498
- @buffer.should eql "\x01\x00\x00\x00"
498
+ expect(@buffer).to eql "\x01\x00\x00\x00"
499
499
  @p.write_item(i, 2, :CONVERTED, @buffer)
500
- @buffer.should eql "\x02\x00\x00\x00"
500
+ expect(@buffer).to eql "\x02\x00\x00\x00"
501
501
  i.write_conversion = GenericConversion.new("value / 2")
502
502
  @p.write("ITEM", 1, :CONVERTED, @buffer)
503
- @buffer.should eql "\x00\x00\x00\x00"
503
+ expect(@buffer).to eql "\x00\x00\x00\x00"
504
504
  @p.write_item(i, 2, :CONVERTED, @buffer)
505
- @buffer.should eql "\x01\x00\x00\x00"
505
+ expect(@buffer).to eql "\x01\x00\x00\x00"
506
506
  end
507
507
 
508
- it "should write the CONVERTED value with states" do
508
+ it "writes the CONVERTED value with states" do
509
509
  @p.append_item("item",8,:UINT)
510
510
  i = @p.get_item("ITEM")
511
511
  i.states = {"TRUE"=>1, "FALSE"=>2}
512
512
  @p.write("ITEM", 3, :CONVERTED, @buffer)
513
- @buffer.should eql "\x03\x00\x00\x00"
513
+ expect(@buffer).to eql "\x03\x00\x00\x00"
514
514
  @p.write_item(i, 4, :CONVERTED, @buffer)
515
- @buffer.should eql "\x04\x00\x00\x00"
515
+ expect(@buffer).to eql "\x04\x00\x00\x00"
516
516
  @p.write("ITEM", "TRUE", :CONVERTED, @buffer)
517
- @buffer.should eql "\x01\x00\x00\x00"
517
+ expect(@buffer).to eql "\x01\x00\x00\x00"
518
518
  @p.write_item(i, "FALSE", :CONVERTED, @buffer)
519
- @buffer.should eql "\x02\x00\x00\x00"
519
+ expect(@buffer).to eql "\x02\x00\x00\x00"
520
520
  expect { @p.write_item(i, "BLAH", :CONVERTED, @buffer) }.to raise_error(RuntimeError, "Unknown state BLAH for ITEM")
521
521
  i.write_conversion = GenericConversion.new("value / 2")
522
522
  @p.write("ITEM", 4, :CONVERTED, @buffer)
523
- @buffer.should eql "\x02\x00\x00\x00"
523
+ expect(@buffer).to eql "\x02\x00\x00\x00"
524
524
  @p.write("ITEM", "TRUE", :CONVERTED, @buffer)
525
- @buffer.should eql "\x00\x00\x00\x00"
525
+ expect(@buffer).to eql "\x00\x00\x00\x00"
526
526
  @p.write_item(i, "FALSE", :CONVERTED, @buffer)
527
- @buffer.should eql "\x01\x00\x00\x00"
527
+ expect(@buffer).to eql "\x01\x00\x00\x00"
528
528
  end
529
529
 
530
- it "should complain about the FORMATTED value_type" do
530
+ it "complains about the FORMATTED value_type" do
531
531
  @p.append_item("item",8,:UINT)
532
532
  i = @p.get_item("ITEM")
533
533
  expect { @p.write("ITEM", 3, :FORMATTED, @buffer) }.to raise_error(ArgumentError, "Invalid value type on write: FORMATTED")
534
534
  expect { @p.write_item(i, 3, :FORMATTED, @buffer) }.to raise_error(ArgumentError, "Invalid value type on write: FORMATTED")
535
535
  end
536
536
 
537
- it "should complain about the WITH_UNITS value_type" do
537
+ it "complains about the WITH_UNITS value_type" do
538
538
  @p.append_item("item",8,:UINT)
539
539
  i = @p.get_item("ITEM")
540
540
  expect { @p.write("ITEM", 3, :WITH_UNITS, @buffer) }.to raise_error(ArgumentError, "Invalid value type on write: WITH_UNITS")
@@ -543,7 +543,7 @@ module Cosmos
543
543
  end
544
544
 
545
545
  describe "read_all" do
546
- it "should default to read all CONVERTED items" do
546
+ it "defaults to read all CONVERTED items" do
547
547
  p = Packet.new("tgt","pkt")
548
548
  p.append_item("test1", 8, :UINT, 16)
549
549
  p.append_item("test2", 16, :UINT)
@@ -556,22 +556,23 @@ module Cosmos
556
556
  buffer = "\x01\x02\x03\x04\x04\x06\x08\x0A"
557
557
  p.buffer = buffer
558
558
  vals = p.read_all
559
- vals[0][0].should eql "TEST1"
560
- vals[1][0].should eql "TEST2"
561
- vals[2][0].should eql "TEST3"
562
- vals[0][1].should eql [1,2]
563
- vals[1][1].should eql "TRUE"
564
- vals[2][1].should eql 0x02030405
559
+ expect(vals[0][0]).to eql "TEST1"
560
+ expect(vals[1][0]).to eql "TEST2"
561
+ expect(vals[2][0]).to eql "TEST3"
562
+ expect(vals[0][1]).to eql [1,2]
563
+ expect(vals[1][1]).to eql "TRUE"
564
+ expect(vals[2][1]).to eql 0x02030405
565
565
  end
566
566
  end
567
567
 
568
568
  describe "read_all_with_limits_states" do
569
- it "should return an array of items with their limit states" do
569
+ it "returns an array of items with their limit states" do
570
570
  p = Packet.new("tgt","pkt")
571
571
  p.append_item("test1", 8, :UINT)
572
572
  i = p.get_item("TEST1")
573
573
  i.states = {"TRUE"=>1,"FALSE"=>0}
574
574
  i.state_colors = {"TRUE"=>:GREEN,"FALSE"=>:RED}
575
+ p.update_limits_items_cache(i)
575
576
  p.write("TEST1",0)
576
577
  p.enable_limits("TEST1")
577
578
  p.append_item("test2", 16, :UINT)
@@ -579,21 +580,21 @@ module Cosmos
579
580
  i.limits.values = {:DEFAULT=>[1,2,4,5]}
580
581
  p.write("TEST2",3)
581
582
  p.enable_limits("TEST2")
582
- p.update_limits_items_cache
583
+ p.update_limits_items_cache(i)
583
584
  p.check_limits
584
585
 
585
586
  vals = p.read_all_with_limits_states
586
- vals[0][0].should eql "TEST1"
587
- vals[1][0].should eql "TEST2"
588
- vals[0][1].should eql "FALSE"
589
- vals[1][1].should eql 3
590
- vals[0][2].should eql :RED
591
- vals[1][2].should eql :GREEN
587
+ expect(vals[0][0]).to eql "TEST1"
588
+ expect(vals[1][0]).to eql "TEST2"
589
+ expect(vals[0][1]).to eql "FALSE"
590
+ expect(vals[1][1]).to eql 3
591
+ expect(vals[0][2]).to eql :RED
592
+ expect(vals[1][2]).to eql :GREEN
592
593
  end
593
594
  end
594
595
 
595
596
  describe "formatted" do
596
- it "should print out all the items and CONVERTED values" do
597
+ it "prints out all the items and CONVERTED values" do
597
598
  p = Packet.new("tgt","pkt")
598
599
  p.append_item("test1", 8, :UINT, 16)
599
600
  p.write("test1", [1,2])
@@ -605,21 +606,21 @@ module Cosmos
605
606
  i = p.get_item("TEST3")
606
607
  i.read_conversion = GenericConversion.new("value / 2")
607
608
  p.write("test3", 0x0406080A)
608
- p.formatted.should include("TEST1: [1, 2]")
609
- p.formatted.should include("TEST2: TRUE")
610
- p.formatted.should include("TEST3: #{0x02030405}")
609
+ expect(p.formatted).to include("TEST1: [1, 2]")
610
+ expect(p.formatted).to include("TEST2: TRUE")
611
+ expect(p.formatted).to include("TEST3: #{0x02030405}")
611
612
  end
612
613
  end
613
614
 
614
615
  describe "check_bit_offsets" do
615
- it "should complain about overlapping items" do
616
+ it "complains about overlapping items" do
616
617
  p = Packet.new("tgt1","pkt1")
617
618
  p.define_item("item1",0,8,:UINT)
618
619
  p.define_item("item2",0,8,:UINT)
619
620
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset 0 for packet TGT1 PKT1 items ITEM2 and ITEM1"
620
621
  end
621
622
 
622
- it "should not complain with non-overlapping negative offsets" do
623
+ it "does not complain with non-overlapping negative offsets" do
623
624
  p = Packet.new("tgt1","pkt1")
624
625
  p.define_item("item1",0,8,:UINT)
625
626
  p.define_item("item2",8,-16,:BLOCK)
@@ -627,7 +628,7 @@ module Cosmos
627
628
  expect(p.check_bit_offsets[0]).to be_nil
628
629
  end
629
630
 
630
- it "should complain with overlapping negative offsets" do
631
+ it "complains with overlapping negative offsets" do
631
632
  p = Packet.new("tgt1","pkt1")
632
633
  p.define_item("item1",0,8,:UINT)
633
634
  p.define_item("item2",8,-16,:BLOCK)
@@ -635,21 +636,21 @@ module Cosmos
635
636
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset -17 for packet TGT1 PKT1 items ITEM3 and ITEM2"
636
637
  end
637
638
 
638
- it "should complain about intersecting items" do
639
+ it "complains about intersecting items" do
639
640
  p = Packet.new("tgt1","pkt1")
640
641
  p.define_item("item1",0,32,:UINT)
641
642
  p.define_item("item2",16,32,:UINT)
642
643
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset 16 for packet TGT1 PKT1 items ITEM2 and ITEM1"
643
644
  end
644
645
 
645
- it "should complain about array overlapping items" do
646
+ it "complains about array overlapping items" do
646
647
  p = Packet.new("tgt1","pkt1")
647
648
  p.define_item("item1",0,8,:UINT,32)
648
649
  p.define_item("item2",0,8,:UINT,32)
649
650
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset 0 for packet TGT1 PKT1 items ITEM2 and ITEM1"
650
651
  end
651
652
 
652
- it "should not complain with array non-overlapping negative offsets" do
653
+ it "does not complain with array non-overlapping negative offsets" do
653
654
  p = Packet.new("tgt1","pkt1")
654
655
  p.define_item("item1",0,8,:UINT)
655
656
  p.define_item("item2",8,8,:INT,-16)
@@ -657,7 +658,7 @@ module Cosmos
657
658
  expect(p.check_bit_offsets[0]).to be_nil
658
659
  end
659
660
 
660
- it "should complain with array overlapping negative offsets" do
661
+ it "complains with array overlapping negative offsets" do
661
662
  p = Packet.new("tgt1","pkt1")
662
663
  p.define_item("item1",0,8,:UINT)
663
664
  p.define_item("item2",8,8,:INT,-16)
@@ -665,14 +666,14 @@ module Cosmos
665
666
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset -17 for packet TGT1 PKT1 items ITEM3 and ITEM2"
666
667
  end
667
668
 
668
- it "should complain about array intersecting items" do
669
+ it "complains about array intersecting items" do
669
670
  p = Packet.new("tgt1","pkt1")
670
671
  p.define_item("item1",0,8,:UINT,32)
671
672
  p.define_item("item2",16,8,:UINT,32)
672
673
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset 16 for packet TGT1 PKT1 items ITEM2 and ITEM1"
673
674
  end
674
675
 
675
- it "should not complain about nonoverlapping big endian bitfields" do
676
+ it "does not complain about nonoverlapping big endian bitfields" do
676
677
  p = Packet.new("tgt1","pkt1")
677
678
  p.define_item("item1",0,12,:UINT,nil,:BIG_ENDIAN)
678
679
  p.define_item("item2",12,4,:UINT,nil,:BIG_ENDIAN)
@@ -680,7 +681,7 @@ module Cosmos
680
681
  expect(p.check_bit_offsets[0]).to be_nil
681
682
  end
682
683
 
683
- it "should complain about overlapping big endian bitfields" do
684
+ it "complains about overlapping big endian bitfields" do
684
685
  p = Packet.new("tgt1","pkt1")
685
686
  p.define_item("item1",0,12,:UINT,nil,:BIG_ENDIAN)
686
687
  p.define_item("item2",10,6,:UINT,nil,:BIG_ENDIAN)
@@ -688,7 +689,7 @@ module Cosmos
688
689
  expect(p.check_bit_offsets[0]).to eql "Bit definition overlap at bit offset 10 for packet TGT1 PKT1 items ITEM2 and ITEM1"
689
690
  end
690
691
 
691
- it "should not complain about nonoverlapping little endian bitfields" do
692
+ it "does not complain about nonoverlapping little endian bitfields" do
692
693
  p = Packet.new("tgt1","pkt1")
693
694
  # bit offset in LITTLE_ENDIAN refers to MSB
694
695
  p.define_item("item1",12,12,:UINT,nil,:LITTLE_ENDIAN)
@@ -696,7 +697,7 @@ module Cosmos
696
697
  expect(p.check_bit_offsets[0]).to be_nil
697
698
  end
698
699
 
699
- it "should complain about overlapping little endian bitfields" do
700
+ it "complains about overlapping little endian bitfields" do
700
701
  p = Packet.new("tgt1","pkt1")
701
702
  # bit offset in LITTLE_ENDIAN refers to MSB
702
703
  p.define_item("item1",12,12,:UINT,nil,:LITTLE_ENDIAN)
@@ -719,43 +720,43 @@ module Cosmos
719
720
  end
720
721
 
721
722
  describe "identify?" do
722
- it "should identify a buffer based on id_items" do
723
+ it "identifies a buffer based on id_items" do
723
724
  p = Packet.new("tgt","pkt")
724
725
  p.append_item("item1",8,:UINT)
725
726
  p.append_item("item2",16,:UINT,nil,:BIG_ENDIAN,:ERROR,nil,nil,nil,5)
726
727
  p.append_item("item3",32,:UINT)
727
- p.identify?("\x00\x00\x05\x01\x02\x03\x04").should be_truthy
728
- p.identify?("\x00\x00\x04\x01\x02\x03\x04").should be_falsey
729
- p.identify?("\x00").should be_falsey
728
+ expect(p.identify?("\x00\x00\x05\x01\x02\x03\x04")).to be_truthy
729
+ expect(p.identify?("\x00\x00\x04\x01\x02\x03\x04")).to be_falsey
730
+ expect(p.identify?("\x00")).to be_falsey
730
731
  end
731
732
 
732
- it "should identify if the buffer is too short" do
733
+ it "identifies if the buffer is too short" do
733
734
  p = Packet.new("tgt","pkt")
734
735
  p.append_item("item1",8,:UINT)
735
736
  p.append_item("item2",16,:UINT,nil,:BIG_ENDIAN,:ERROR,nil,nil,nil,5)
736
737
  p.append_item("item3",32,:UINT)
737
- p.identify?("\x00\x00\x05\x01\x02\x03").should be_truthy
738
+ expect(p.identify?("\x00\x00\x05\x01\x02\x03")).to be_truthy
738
739
  end
739
740
 
740
- it "should identify if the buffer is too long" do
741
+ it "identifies if the buffer is too long" do
741
742
  p = Packet.new("tgt","pkt")
742
743
  p.append_item("item1",8,:UINT)
743
744
  p.append_item("item2",16,:UINT,nil,:BIG_ENDIAN,:ERROR,nil,nil,nil,5)
744
745
  p.append_item("item3",32,:UINT)
745
- p.identify?("\x00\x00\x05\x01\x02\x03\x04\x05").should be_truthy
746
+ expect(p.identify?("\x00\x00\x05\x01\x02\x03\x04\x05")).to be_truthy
746
747
  end
747
748
  end
748
749
 
749
750
  describe "identified?" do
750
- it "should return true if the target name and packet name are set" do
751
- Packet.new('TGT',nil).identified?.should be_falsey
752
- Packet.new(nil,'PKT').identified?.should be_falsey
753
- Packet.new('TGT','PKT').identified?.should be_truthy
751
+ it "returns true if the target name and packet name are set" do
752
+ expect(Packet.new('TGT',nil).identified?).to be_falsey
753
+ expect(Packet.new(nil,'PKT').identified?).to be_falsey
754
+ expect(Packet.new('TGT','PKT').identified?).to be_truthy
754
755
  end
755
756
  end
756
757
 
757
758
  describe "restore_defaults" do
758
- it "should write all the items back to their default values" do
759
+ it "writes all the items back to their default values" do
759
760
  p = Packet.new("tgt","pkt")
760
761
  p.append_item("test1", 8, :UINT, 16)
761
762
  i = p.get_item("TEST1")
@@ -771,56 +772,59 @@ module Cosmos
771
772
  i.default = 0x02030405
772
773
  i.write_conversion = GenericConversion.new("value * 2")
773
774
  p.write("test3", 0x01020304)
774
- p.buffer.should eql "\x01\x02\x03\x04\x02\x04\x06\x08"
775
+ expect(p.buffer).to eql "\x01\x02\x03\x04\x02\x04\x06\x08"
775
776
  p.restore_defaults
776
- p.buffer.should eql "\x03\x04\x01\x02\x04\x06\x08\x0A"
777
+ expect(p.buffer).to eql "\x03\x04\x01\x02\x04\x06\x08\x0A"
777
778
  end
778
779
  end
779
780
 
780
781
  describe "enable_limits" do
781
- it "should enable limits on each packet item" do
782
+ it "enables limits on each packet item" do
782
783
  p = Packet.new("tgt","pkt")
783
784
  p.append_item("test1", 8, :UINT, 16)
784
785
  p.append_item("test2", 16, :UINT)
785
- p.get_item("TEST1").limits.enabled.should be_falsey
786
- p.get_item("TEST2").limits.enabled.should be_falsey
786
+ expect(p.get_item("TEST1").limits.enabled).to be_falsey
787
+ expect(p.get_item("TEST2").limits.enabled).to be_falsey
787
788
  p.enable_limits("TEST1")
788
- p.get_item("TEST1").limits.enabled.should be_truthy
789
- p.get_item("TEST2").limits.enabled.should be_falsey
789
+ expect(p.get_item("TEST1").limits.enabled).to be_truthy
790
+ expect(p.get_item("TEST2").limits.enabled).to be_falsey
790
791
  p.enable_limits("TEST2")
791
- p.get_item("TEST1").limits.enabled.should be_truthy
792
- p.get_item("TEST2").limits.enabled.should be_truthy
792
+ expect(p.get_item("TEST1").limits.enabled).to be_truthy
793
+ expect(p.get_item("TEST2").limits.enabled).to be_truthy
793
794
  end
794
795
  end
795
796
 
796
797
  describe "disable_limits" do
797
- it "should disable limits on each packet item" do
798
+ it "disables limits on each packet item" do
798
799
  p = Packet.new("tgt","pkt")
799
800
  p.append_item("test1", 8, :UINT)
800
801
  p.append_item("test2", 16, :UINT)
801
802
  p.enable_limits("TEST1")
802
803
  p.enable_limits("TEST2")
803
- p.get_item("TEST1").limits.enabled.should be_truthy
804
- p.get_item("TEST2").limits.enabled.should be_truthy
804
+ expect(p.get_item("TEST1").limits.enabled).to be_truthy
805
+ expect(p.get_item("TEST2").limits.enabled).to be_truthy
805
806
  p.disable_limits("TEST1")
806
- p.get_item("TEST1").limits.enabled.should be_falsey
807
- p.get_item("TEST2").limits.enabled.should be_truthy
807
+ expect(p.get_item("TEST1").limits.enabled).to be_falsey
808
+ expect(p.get_item("TEST2").limits.enabled).to be_truthy
808
809
  p.disable_limits("TEST2")
809
- p.get_item("TEST1").limits.enabled.should be_falsey
810
- p.get_item("TEST2").limits.enabled.should be_falsey
810
+ expect(p.get_item("TEST1").limits.enabled).to be_falsey
811
+ expect(p.get_item("TEST2").limits.enabled).to be_falsey
811
812
  end
812
813
 
813
- it "should call the limits_change_callback for all non STALE items" do
814
+ it "calls the limits_change_callback for all non STALE items" do
814
815
  p = Packet.new("tgt","pkt")
815
816
  p.append_item("test1", 8, :UINT)
816
- p.get_item("TEST1").limits.values = {:DEFAULT=>[1,2,4,5]}
817
+ i = p.get_item("TEST1")
818
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
819
+ p.update_limits_items_cache(i)
817
820
  p.append_item("test2", 16, :UINT)
818
- p.get_item("TEST2").limits.values = {:DEFAULT=>[1,2,4,5]}
821
+ i = p.get_item("TEST2")
822
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
823
+ p.update_limits_items_cache(i)
819
824
  p.write("TEST1",3)
820
825
  p.write("TEST2",3)
821
826
  p.enable_limits("TEST1")
822
827
  p.enable_limits("TEST2")
823
- p.update_limits_items_cache
824
828
 
825
829
  callback = double("callback", :call => true)
826
830
  p.limits_change_callback = callback
@@ -829,70 +833,76 @@ module Cosmos
829
833
  p.check_limits
830
834
  p.disable_limits("TEST1")
831
835
  p.disable_limits("TEST2")
832
- p.get_item("TEST1").limits.enabled.should be_falsey
833
- p.get_item("TEST2").limits.enabled.should be_falsey
836
+ expect(p.get_item("TEST1").limits.enabled).to be_falsey
837
+ expect(p.get_item("TEST2").limits.enabled).to be_falsey
834
838
  end
835
839
  end
836
840
 
837
841
  describe "limits_items" do
838
- it "should return all items with limits" do
842
+ it "returns all items with limits" do
839
843
  p = Packet.new("tgt","pkt")
840
844
  p.append_item("test1", 8, :UINT)
841
845
  p.enable_limits("TEST1")
842
846
  p.append_item("test2", 16, :UINT)
843
847
  p.enable_limits("TEST2")
844
- p.limits_items.should eql []
848
+ expect(p.limits_items).to eql []
845
849
 
846
850
  test1 = p.get_item("TEST1")
847
851
  test1.limits.values = {:DEFAULT=>[1,2,4,5]}
848
- p.update_limits_items_cache
849
- p.limits_items.should eql [test1]
852
+ p.update_limits_items_cache(test1)
853
+ expect(p.limits_items).to eql [test1]
850
854
  test2 = p.get_item("TEST2")
851
855
  test2.limits.values = {:DEFAULT=>[1,2,4,5]}
852
- p.update_limits_items_cache
853
- p.limits_items.should eql [test1, test2]
856
+ p.update_limits_items_cache(test2)
857
+ expect(p.limits_items).to eql [test1, test2]
854
858
  end
855
859
  end
856
860
 
857
861
  describe "out_of_limits" do
858
- it "should return an array indicating all items out of limits" do
862
+ it "returns an array indicating all items out of limits" do
859
863
  p = Packet.new("tgt","pkt")
860
864
  p.append_item("test1", 8, :UINT)
861
- p.get_item("TEST1").limits.values = {:DEFAULT=>[1,2,4,5]}
865
+ i = p.get_item("TEST1")
866
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
867
+ p.update_limits_items_cache(i)
862
868
  p.enable_limits("TEST1")
863
869
  p.write("TEST1",3)
864
870
  p.append_item("test2", 16, :UINT)
865
- p.get_item("TEST2").limits.values = {:DEFAULT=>[1,2,4,5]}
871
+ i = p.get_item("TEST2")
872
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
873
+ p.update_limits_items_cache(i)
866
874
  p.write("TEST2",3)
867
875
  p.enable_limits("TEST2")
868
- p.update_limits_items_cache
869
876
  p.check_limits
870
- p.out_of_limits.should eql []
877
+ expect(p.out_of_limits).to eql []
871
878
 
872
879
  p.write("TEST1",6)
873
880
  p.check_limits
874
- p.out_of_limits.should eql [["TGT","PKT","TEST1",:RED_HIGH]]
881
+ expect(p.out_of_limits).to eql [["TGT","PKT","TEST1",:RED_HIGH]]
875
882
  p.write("TEST2",2)
876
883
  p.check_limits
877
- p.out_of_limits.should eql [["TGT","PKT","TEST1",:RED_HIGH],["TGT","PKT","TEST2",:YELLOW_LOW]]
884
+ expect(p.out_of_limits).to eql [["TGT","PKT","TEST1",:RED_HIGH],["TGT","PKT","TEST2",:YELLOW_LOW]]
878
885
  end
879
886
  end
880
887
 
881
888
  describe "set_all_limits_states" do
882
- it "should set all limits states to the given state" do
889
+ it "sets all limits states to the given state" do
883
890
  p = Packet.new("tgt","pkt")
884
891
  p.append_item("test1", 8, :UINT)
885
- p.get_item("TEST1").limits.values = {:DEFAULT=>[1,2,4,5]}
892
+ i = p.get_item("TEST1")
893
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
894
+ p.update_limits_items_cache(i)
886
895
  p.enable_limits("TEST1")
887
896
  p.append_item("test2", 16, :UINT)
888
- p.get_item("TEST2").limits.values = {:DEFAULT=>[1,2,4,5]}
897
+ i = p.get_item("TEST2")
898
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
899
+ p.update_limits_items_cache(i)
889
900
  p.enable_limits("TEST2")
890
- p.update_limits_items_cache
891
- p.out_of_limits.should eql []
901
+ expect(p.out_of_limits).to eql []
892
902
 
893
903
  PacketItemLimits::OUT_OF_LIMITS_STATES.each do |state|
894
904
  p.set_all_limits_states(state)
895
- p.out_of_limits.should eql [["TGT","PKT","TEST1",state],["TGT","PKT","TEST2",state]]
905
+ expect(p.out_of_limits).to eql [["TGT","PKT","TEST1",state],["TGT","PKT","TEST2",state]]
896
906
  end
897
907
  end
898
908
  end
@@ -905,15 +915,15 @@ module Cosmos
905
915
  @p.append_item("test3", 32, :FLOAT)
906
916
  end
907
917
 
908
- it "should set clear the stale flag" do
909
- @p.stale.should be_truthy
918
+ it "sets clear the stale flag" do
919
+ expect(@p.stale).to be_truthy
910
920
  @p.check_limits
911
- @p.stale.should be_falsey
921
+ expect(@p.stale).to be_falsey
912
922
  end
913
923
 
914
- it "should not call the limits_change_callback if limits are disabled" do
915
- @p.get_item("TEST1").limits.enabled.should be_falsey
916
- @p.get_item("TEST2").limits.enabled.should be_falsey
924
+ it "does not call the limits_change_callback if limits are disabled" do
925
+ expect(@p.get_item("TEST1").limits.enabled).to be_falsey
926
+ expect(@p.get_item("TEST2").limits.enabled).to be_falsey
917
927
  callback = double("callback")
918
928
  allow(callback).to receive(:call)
919
929
  @p.limits_change_callback = callback
@@ -922,20 +932,21 @@ module Cosmos
922
932
  end
923
933
 
924
934
  context "with states" do
925
- it "should call the limits_change_callback" do
935
+ it "calls the limits_change_callback" do
926
936
  test1 = @p.get_item("TEST1")
927
- test1.limits.enabled.should be_falsey
937
+ expect(test1.limits.enabled).to be_falsey
928
938
  test1.states = {"TRUE"=>1,"FALSE"=>0}
929
939
  test1.state_colors = {"TRUE"=>:GREEN,"FALSE"=>:RED}
940
+ @p.update_limits_items_cache(test1)
930
941
  @p.write("TEST1", 0)
931
942
  @p.enable_limits("TEST1")
932
943
  test2 = @p.get_item("TEST2")
933
- test2.limits.enabled.should be_falsey
944
+ expect(test2.limits.enabled).to be_falsey
934
945
  test2.states = {"TRUE"=>1,"FALSE"=>0}
935
946
  test2.state_colors = {"TRUE"=>:RED,"FALSE"=>:GREEN}
936
947
  @p.write("TEST2", 0)
937
948
  @p.enable_limits("TEST2")
938
- @p.update_limits_items_cache
949
+ @p.update_limits_items_cache(test2)
939
950
 
940
951
  # Mock the callback so we can see if it is called properly
941
952
  callback = double("callback", :call => true)
@@ -961,68 +972,70 @@ module Cosmos
961
972
  context "with values" do
962
973
  before(:each) do
963
974
  @test1 = @p.get_item("TEST1")
964
- @test1.limits.enabled.should be_falsey
975
+ expect(@test1.limits.enabled).to be_falsey
965
976
  @test1.limits.values = {:DEFAULT=>[1,2,4,5]} # red yellow
977
+ @p.update_limits_items_cache(@test1)
966
978
  @p.enable_limits("TEST1")
967
979
 
968
980
  @test2 = @p.get_item("TEST2")
969
- @test2.limits.enabled.should be_falsey
981
+ expect(@test2.limits.enabled).to be_falsey
970
982
  @test2.limits.values = {:DEFAULT=>[1,2,6,7,3,5]} # red yellow and blue
983
+ @p.update_limits_items_cache(@test2)
971
984
  @p.enable_limits("TEST2")
972
985
 
973
986
  @test3 = @p.get_item("TEST3")
974
- @test3.limits.enabled.should be_falsey
987
+ expect(@test3.limits.enabled).to be_falsey
975
988
  @test3.limits.values = {:DEFAULT=>[1,1.5,2.5,3]} # red yellow
989
+ @p.update_limits_items_cache(@test3)
976
990
  @p.enable_limits("TEST3")
977
- @p.update_limits_items_cache
978
991
 
979
992
  # Mock the callback so we can see if it is called properly
980
993
  @callback = double("callback", :call => true)
981
994
  @p.limits_change_callback = @callback
982
995
  end
983
996
 
984
- it "should detect initial low states" do
997
+ it "detects initial low states" do
985
998
  @p.write("TEST1", 0)
986
999
  @p.write("TEST2", 3)
987
1000
  @p.write("TEST3", 1.25)
988
1001
  @p.check_limits
989
- @p.get_item("TEST1").limits.state.should eql :RED_LOW
990
- @p.get_item("TEST2").limits.state.should eql :GREEN_LOW
991
- @p.get_item("TEST3").limits.state.should eql :YELLOW_LOW
1002
+ expect(@p.get_item("TEST1").limits.state).to eql :RED_LOW
1003
+ expect(@p.get_item("TEST2").limits.state).to eql :GREEN_LOW
1004
+ expect(@p.get_item("TEST3").limits.state).to eql :YELLOW_LOW
992
1005
  end
993
1006
 
994
- it "should detect initial high states" do
1007
+ it "detects initial high states" do
995
1008
  @p.write("TEST1", 6)
996
1009
  @p.write("TEST2", 5)
997
1010
  @p.write("TEST3", 2.75)
998
1011
  @p.check_limits
999
- @p.get_item("TEST1").limits.state.should eql :RED_HIGH
1000
- @p.get_item("TEST2").limits.state.should eql :GREEN_HIGH
1001
- @p.get_item("TEST3").limits.state.should eql :YELLOW_HIGH
1012
+ expect(@p.get_item("TEST1").limits.state).to eql :RED_HIGH
1013
+ expect(@p.get_item("TEST2").limits.state).to eql :GREEN_HIGH
1014
+ expect(@p.get_item("TEST3").limits.state).to eql :YELLOW_HIGH
1002
1015
  end
1003
1016
 
1004
- it "should detect initial middle states" do
1017
+ it "detects initial middle states" do
1005
1018
  @p.write("TEST1", 3)
1006
1019
  @p.write("TEST2", 4)
1007
1020
  @p.write("TEST3", 2.0)
1008
1021
  @p.check_limits
1009
- @p.get_item("TEST1").limits.state.should eql :GREEN
1010
- @p.get_item("TEST2").limits.state.should eql :BLUE
1011
- @p.get_item("TEST3").limits.state.should eql :GREEN
1022
+ expect(@p.get_item("TEST1").limits.state).to eql :GREEN
1023
+ expect(@p.get_item("TEST2").limits.state).to eql :BLUE
1024
+ expect(@p.get_item("TEST3").limits.state).to eql :GREEN
1012
1025
  end
1013
1026
 
1014
- it "should clear persistence when initial state is nil" do
1027
+ it "clears persistence when initial state is nil" do
1015
1028
  @p.get_item("TEST1").limits.persistence_count = 2
1016
1029
  @p.get_item("TEST2").limits.persistence_count = 3
1017
1030
  @p.get_item("TEST3").limits.persistence_count = 4
1018
1031
  @p.check_limits
1019
- @p.get_item("TEST1").limits.persistence_count.should eql 0
1020
- @p.get_item("TEST2").limits.persistence_count.should eql 0
1021
- @p.get_item("TEST3").limits.persistence_count.should eql 0
1032
+ expect(@p.get_item("TEST1").limits.persistence_count).to eql 0
1033
+ expect(@p.get_item("TEST2").limits.persistence_count).to eql 0
1034
+ expect(@p.get_item("TEST3").limits.persistence_count).to eql 0
1022
1035
  end
1023
1036
 
1024
1037
  context "when calling the limits_change_callback" do
1025
- it "should initially call only for out of limits" do
1038
+ it "initiallies call only for out of limits" do
1026
1039
  @p.write("TEST1", 0)
1027
1040
  @p.write("TEST2", 4)
1028
1041
  @p.write("TEST3", 1.25)
@@ -1034,7 +1047,7 @@ module Cosmos
1034
1047
  @p.check_limits
1035
1048
  end
1036
1049
 
1037
- it "should call when limits change states" do
1050
+ it "calls when limits change states" do
1038
1051
  @p.write("TEST1", 0)
1039
1052
  @p.write("TEST2", 4)
1040
1053
  @p.write("TEST3", 1.25)
@@ -1046,7 +1059,7 @@ module Cosmos
1046
1059
  @p.check_limits
1047
1060
  end
1048
1061
 
1049
- it "should call only when persistence is achieved" do
1062
+ it "calls only when persistence is achieved" do
1050
1063
  # First establish the green state when coming from nil
1051
1064
  @p.get_item("TEST1").limits.persistence_setting = 1
1052
1065
  @p.get_item("TEST2").limits.persistence_setting = 1
@@ -1058,9 +1071,9 @@ module Cosmos
1058
1071
  expect(@callback).to receive(:call).with(@p, @test2,nil,4,true)
1059
1072
  expect(@callback).to receive(:call).with(@p, @test3,nil,2.0,true)
1060
1073
  @p.check_limits
1061
- @test1.limits.state.should eql :GREEN
1062
- @test2.limits.state.should eql :BLUE
1063
- @test3.limits.state.should eql :GREEN
1074
+ expect(@test1.limits.state).to eql :GREEN
1075
+ expect(@test2.limits.state).to eql :BLUE
1076
+ expect(@test3.limits.state).to eql :GREEN
1064
1077
 
1065
1078
  # Now test the persistence setting by going out of limits
1066
1079
  @p.get_item("TEST1").limits.persistence_setting = 2
@@ -1071,75 +1084,75 @@ module Cosmos
1071
1084
  @p.write("TEST2", 8)
1072
1085
  @p.write("TEST3", 1.25)
1073
1086
  @p.check_limits
1074
- @test1.limits.state.should eql :GREEN
1075
- @test2.limits.state.should eql :BLUE
1076
- @test3.limits.state.should eql :GREEN
1087
+ expect(@test1.limits.state).to eql :GREEN
1088
+ expect(@test2.limits.state).to eql :BLUE
1089
+ expect(@test3.limits.state).to eql :GREEN
1077
1090
 
1078
1091
  @p.write("TEST1", 0)
1079
1092
  @p.write("TEST2", 8)
1080
1093
  @p.write("TEST3", 1.25)
1081
1094
  expect(@callback).to receive(:call).with(@p, @test1,:GREEN,0,true)
1082
1095
  @p.check_limits
1083
- @test1.limits.state.should eql :RED_LOW
1084
- @test2.limits.state.should eql :BLUE
1085
- @test3.limits.state.should eql :GREEN
1096
+ expect(@test1.limits.state).to eql :RED_LOW
1097
+ expect(@test2.limits.state).to eql :BLUE
1098
+ expect(@test3.limits.state).to eql :GREEN
1086
1099
 
1087
1100
  @p.write("TEST1", 0)
1088
1101
  @p.write("TEST2", 8)
1089
1102
  @p.write("TEST3", 1.25)
1090
1103
  expect(@callback).to receive(:call).with(@p, @test2,:BLUE,8,true)
1091
1104
  @p.check_limits
1092
- @test1.limits.state.should eql :RED_LOW
1093
- @test2.limits.state.should eql :RED_HIGH
1094
- @test3.limits.state.should eql :GREEN
1105
+ expect(@test1.limits.state).to eql :RED_LOW
1106
+ expect(@test2.limits.state).to eql :RED_HIGH
1107
+ expect(@test3.limits.state).to eql :GREEN
1095
1108
 
1096
1109
  @p.write("TEST1", 0)
1097
1110
  @p.write("TEST2", 8)
1098
1111
  @p.write("TEST3", 1.25)
1099
1112
  expect(@callback).to receive(:call).with(@p, @test3,:GREEN,1.25,true)
1100
1113
  @p.check_limits
1101
- @test1.limits.state.should eql :RED_LOW
1102
- @test2.limits.state.should eql :RED_HIGH
1103
- @test3.limits.state.should eql :YELLOW_LOW
1114
+ expect(@test1.limits.state).to eql :RED_LOW
1115
+ expect(@test2.limits.state).to eql :RED_HIGH
1116
+ expect(@test3.limits.state).to eql :YELLOW_LOW
1104
1117
 
1105
1118
  # Now go back to good on everything and verify persistence still applies
1106
1119
  @p.write("TEST1", 3)
1107
1120
  @p.write("TEST2", 4)
1108
1121
  @p.write("TEST3", 2.0)
1109
1122
  @p.check_limits
1110
- @test1.limits.state.should eql :RED_LOW
1111
- @test2.limits.state.should eql :RED_HIGH
1112
- @test3.limits.state.should eql :YELLOW_LOW
1123
+ expect(@test1.limits.state).to eql :RED_LOW
1124
+ expect(@test2.limits.state).to eql :RED_HIGH
1125
+ expect(@test3.limits.state).to eql :YELLOW_LOW
1113
1126
 
1114
1127
  @p.write("TEST1", 3)
1115
1128
  @p.write("TEST2", 4)
1116
1129
  @p.write("TEST3", 2.0)
1117
1130
  expect(@callback).to receive(:call).with(@p, @test1,:RED_LOW,3,true)
1118
1131
  @p.check_limits
1119
- @test1.limits.state.should eql :GREEN
1120
- @test2.limits.state.should eql :RED_HIGH
1121
- @test3.limits.state.should eql :YELLOW_LOW
1132
+ expect(@test1.limits.state).to eql :GREEN
1133
+ expect(@test2.limits.state).to eql :RED_HIGH
1134
+ expect(@test3.limits.state).to eql :YELLOW_LOW
1122
1135
 
1123
1136
  @p.write("TEST1", 3)
1124
1137
  @p.write("TEST2", 4)
1125
1138
  @p.write("TEST3", 2.0)
1126
1139
  expect(@callback).to receive(:call).with(@p, @test2,:RED_HIGH,4,true)
1127
1140
  @p.check_limits
1128
- @test1.limits.state.should eql :GREEN
1129
- @test2.limits.state.should eql :BLUE
1130
- @test3.limits.state.should eql :YELLOW_LOW
1141
+ expect(@test1.limits.state).to eql :GREEN
1142
+ expect(@test2.limits.state).to eql :BLUE
1143
+ expect(@test3.limits.state).to eql :YELLOW_LOW
1131
1144
 
1132
1145
  @p.write("TEST1", 3)
1133
1146
  @p.write("TEST2", 4)
1134
1147
  @p.write("TEST3", 2.0)
1135
1148
  expect(@callback).to receive(:call).with(@p, @test3,:YELLOW_LOW,2.0,true)
1136
1149
  @p.check_limits
1137
- @test1.limits.state.should eql :GREEN
1138
- @test2.limits.state.should eql :BLUE
1139
- @test3.limits.state.should eql :GREEN
1150
+ expect(@test1.limits.state).to eql :GREEN
1151
+ expect(@test2.limits.state).to eql :BLUE
1152
+ expect(@test3.limits.state).to eql :GREEN
1140
1153
  end
1141
1154
 
1142
- it "should not call when state changes before persistence is achieved" do
1155
+ it "does not call when state changes before persistence is achieved" do
1143
1156
  # First establish the green state when coming from nil
1144
1157
  @p.get_item("TEST1").limits.persistence_setting = 1
1145
1158
  @p.get_item("TEST2").limits.persistence_setting = 1
@@ -1151,9 +1164,9 @@ module Cosmos
1151
1164
  expect(@callback).to receive(:call).with(@p, @test2,nil,4,true)
1152
1165
  expect(@callback).to receive(:call).with(@p, @test3,nil,2.0,true)
1153
1166
  @p.check_limits
1154
- @test1.limits.state.should eql :GREEN
1155
- @test2.limits.state.should eql :BLUE
1156
- @test3.limits.state.should eql :GREEN
1167
+ expect(@test1.limits.state).to eql :GREEN
1168
+ expect(@test2.limits.state).to eql :BLUE
1169
+ expect(@test3.limits.state).to eql :GREEN
1157
1170
 
1158
1171
  # Set all persistence the same
1159
1172
  @p.get_item("TEST1").limits.persistence_setting = 3
@@ -1166,27 +1179,27 @@ module Cosmos
1166
1179
  @p.write("TEST3", 1.25)
1167
1180
  expect(@callback).to_not receive(:call)
1168
1181
  @p.check_limits
1169
- @test1.limits.state.should eql :GREEN
1170
- @test2.limits.state.should eql :BLUE
1171
- @test3.limits.state.should eql :GREEN
1182
+ expect(@test1.limits.state).to eql :GREEN
1183
+ expect(@test2.limits.state).to eql :BLUE
1184
+ expect(@test3.limits.state).to eql :GREEN
1172
1185
 
1173
1186
  @p.write("TEST1", 0)
1174
1187
  @p.write("TEST2", 8)
1175
1188
  @p.write("TEST3", 1.25)
1176
1189
  expect(@callback).to_not receive(:call)
1177
1190
  @p.check_limits
1178
- @test1.limits.state.should eql :GREEN
1179
- @test2.limits.state.should eql :BLUE
1180
- @test3.limits.state.should eql :GREEN
1191
+ expect(@test1.limits.state).to eql :GREEN
1192
+ expect(@test2.limits.state).to eql :BLUE
1193
+ expect(@test3.limits.state).to eql :GREEN
1181
1194
 
1182
1195
  # Set the values back to good
1183
1196
  @p.write("TEST1", 3)
1184
1197
  @p.write("TEST2", 4)
1185
1198
  @p.write("TEST3", 2.0)
1186
1199
  @p.check_limits
1187
- @test1.limits.state.should eql :GREEN
1188
- @test2.limits.state.should eql :BLUE
1189
- @test3.limits.state.should eql :GREEN
1200
+ expect(@test1.limits.state).to eql :GREEN
1201
+ expect(@test2.limits.state).to eql :BLUE
1202
+ expect(@test3.limits.state).to eql :GREEN
1190
1203
 
1191
1204
  # Write bad values twice
1192
1205
  @p.write("TEST1", 0)
@@ -1194,61 +1207,64 @@ module Cosmos
1194
1207
  @p.write("TEST3", 1.25)
1195
1208
  expect(@callback).to_not receive(:call)
1196
1209
  @p.check_limits
1197
- @test1.limits.state.should eql :GREEN
1198
- @test2.limits.state.should eql :BLUE
1199
- @test3.limits.state.should eql :GREEN
1210
+ expect(@test1.limits.state).to eql :GREEN
1211
+ expect(@test2.limits.state).to eql :BLUE
1212
+ expect(@test3.limits.state).to eql :GREEN
1200
1213
 
1201
1214
  @p.write("TEST1", 0)
1202
1215
  @p.write("TEST2", 8)
1203
1216
  @p.write("TEST3", 1.25)
1204
1217
  expect(@callback).to_not receive(:call)
1205
1218
  @p.check_limits
1206
- @test1.limits.state.should eql :GREEN
1207
- @test2.limits.state.should eql :BLUE
1208
- @test3.limits.state.should eql :GREEN
1219
+ expect(@test1.limits.state).to eql :GREEN
1220
+ expect(@test2.limits.state).to eql :BLUE
1221
+ expect(@test3.limits.state).to eql :GREEN
1209
1222
 
1210
1223
  # Set the values back to good
1211
1224
  @p.write("TEST1", 3)
1212
1225
  @p.write("TEST2", 4)
1213
1226
  @p.write("TEST3", 2.0)
1214
1227
  @p.check_limits
1215
- @test1.limits.state.should eql :GREEN
1216
- @test2.limits.state.should eql :BLUE
1217
- @test3.limits.state.should eql :GREEN
1228
+ expect(@test1.limits.state).to eql :GREEN
1229
+ expect(@test2.limits.state).to eql :BLUE
1230
+ expect(@test3.limits.state).to eql :GREEN
1218
1231
  end
1219
1232
  end
1220
1233
  end
1221
1234
  end
1222
1235
 
1223
1236
  describe "stale" do
1224
- it "should set all limits states to stale" do
1237
+ it "sets all limits states to stale" do
1225
1238
  p = Packet.new("tgt","pkt")
1226
1239
  p.append_item("test1", 8, :UINT)
1227
- p.get_item("TEST1").limits.values = {:DEFAULT=>[1,2,4,5]}
1240
+ i = p.get_item("TEST1")
1241
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
1242
+ p.update_limits_items_cache(i)
1228
1243
  p.enable_limits("TEST1")
1229
1244
  p.append_item("test2", 16, :UINT)
1230
- p.get_item("TEST2").limits.values = {:DEFAULT=>[1,2,4,5]}
1245
+ i = p.get_item("TEST2")
1246
+ i.limits.values = {:DEFAULT=>[1,2,4,5]}
1247
+ p.update_limits_items_cache(i)
1231
1248
  p.enable_limits("TEST2")
1232
- p.update_limits_items_cache
1233
- p.out_of_limits.should eql []
1249
+ expect(p.out_of_limits).to eql []
1234
1250
 
1235
- p.stale.should be_truthy
1236
- p.get_item("TEST1").limits.state.should eql :STALE
1237
- p.get_item("TEST2").limits.state.should eql :STALE
1251
+ expect(p.stale).to be_truthy
1252
+ expect(p.get_item("TEST1").limits.state).to eql :STALE
1253
+ expect(p.get_item("TEST2").limits.state).to eql :STALE
1238
1254
  # Update the limits
1239
1255
  p.check_limits
1240
- p.stale.should be_falsey
1241
- p.get_item("TEST1").limits.state.should_not eql :STALE
1242
- p.get_item("TEST2").limits.state.should_not eql :STALE
1256
+ expect(p.stale).to be_falsey
1257
+ expect(p.get_item("TEST1").limits.state).not_to eql :STALE
1258
+ expect(p.get_item("TEST2").limits.state).not_to eql :STALE
1243
1259
  # set them all back to stale
1244
1260
  p.set_stale
1245
- p.get_item("TEST1").limits.state.should eql :STALE
1246
- p.get_item("TEST2").limits.state.should eql :STALE
1261
+ expect(p.get_item("TEST1").limits.state).to eql :STALE
1262
+ expect(p.get_item("TEST2").limits.state).to eql :STALE
1247
1263
  end
1248
1264
  end
1249
1265
 
1250
1266
  describe "clone" do
1251
- it "should duplicate the packet" do
1267
+ it "duplicates the packet" do
1252
1268
  p = Packet.new("tgt","pkt")
1253
1269
  p.processors['processor'] = Processor.new
1254
1270
  p.processors['processor'].name = "TestProcessor"
@@ -1256,8 +1272,8 @@ module Cosmos
1256
1272
  # No comparison operator
1257
1273
  # expect(p).to eql p2
1258
1274
  expect(p).to_not be p2
1259
- p2.target_name.should eql "TGT"
1260
- p2.packet_name.should eql "PKT"
1275
+ expect(p2.target_name).to eql "TGT"
1276
+ expect(p2.packet_name).to eql "PKT"
1261
1277
  # No comparison operator
1262
1278
  # expect(p2.processors['processor']).to eql p.processors['processor']
1263
1279
  expect(p2.processors['processor']).to_not be p.processors['processor']
@@ -1272,8 +1288,8 @@ module Cosmos
1272
1288
  p.received_time = Time.now
1273
1289
  p.received_count = 50
1274
1290
  p.reset
1275
- p.received_time.should eql nil
1276
- p.received_count.should eql 0
1291
+ expect(p.received_time).to eql nil
1292
+ expect(p.received_count).to eql 0
1277
1293
  end
1278
1294
 
1279
1295
  it "clears the read conversion cache" do