cosmos 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +195 -0
- data/README.md +3 -3
- data/data/crc.txt +52 -52
- data/lib/cosmos.rb +1 -1
- data/lib/cosmos/core_ext/time.rb +11 -9
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +0 -2
- data/lib/cosmos/gui/dialogs/about_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +11 -5
- data/lib/cosmos/gui/dialogs/splash.rb +32 -10
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +2 -2
- data/lib/cosmos/gui/qt.rb +22 -22
- data/lib/cosmos/io/json_drb.rb +4 -4
- data/lib/cosmos/io/json_rpc.rb +21 -21
- data/lib/cosmos/packet_logs/packet_log_writer.rb +18 -20
- data/lib/cosmos/packets/commands.rb +8 -6
- data/lib/cosmos/packets/limits.rb +3 -2
- data/lib/cosmos/packets/packet.rb +14 -11
- data/lib/cosmos/packets/parsers/limits_parser.rb +1 -1
- data/lib/cosmos/packets/parsers/macro_parser.rb +4 -4
- data/lib/cosmos/packets/parsers/state_parser.rb +1 -1
- data/lib/cosmos/packets/structure.rb +2 -2
- data/lib/cosmos/packets/telemetry.rb +5 -4
- data/lib/cosmos/script/script.rb +6 -6
- data/lib/cosmos/streams/tcpip_socket_stream.rb +2 -1
- data/lib/cosmos/streams/template_stream_protocol.rb +1 -1
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +5 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +4 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +15 -11
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +0 -2
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1 -1
- data/lib/cosmos/tools/replay/replay.rb +2 -2
- data/lib/cosmos/tools/script_runner/script_audit.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +3 -7
- data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
- data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +2 -2
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +2 -1
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +3 -3
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -3
- data/lib/cosmos/top_level.rb +2 -6
- data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/win32_main.rb +11 -7
- data/spec/ccsds/ccsds_packet_spec.rb +28 -28
- data/spec/ccsds/ccsds_parser_spec.rb +27 -27
- data/spec/config/config_parser_spec.rb +88 -88
- data/spec/conversions/conversion_spec.rb +3 -3
- data/spec/conversions/generic_conversion_spec.rb +9 -9
- data/spec/conversions/new_packet_log_conversion_spec.rb +4 -4
- data/spec/conversions/polynomial_conversion_spec.rb +7 -7
- data/spec/conversions/processor_conversion_spec.rb +9 -9
- data/spec/conversions/received_count_conversion_spec.rb +7 -7
- data/spec/conversions/received_time_formatted_conversion_spec.rb +9 -9
- data/spec/conversions/received_time_seconds_conversion_spec.rb +9 -9
- data/spec/conversions/segmented_polynomial_conversion_spec.rb +11 -11
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +13 -13
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +13 -13
- data/spec/core_ext/array_spec.rb +76 -76
- data/spec/core_ext/class_spec.rb +3 -3
- data/spec/core_ext/cosmos_io_spec.rb +16 -16
- data/spec/core_ext/exception_spec.rb +19 -19
- data/spec/core_ext/file_spec.rb +16 -16
- data/spec/core_ext/hash_spec.rb +3 -3
- data/spec/core_ext/io_spec.rb +2 -2
- data/spec/core_ext/kernel_spec.rb +2 -2
- data/spec/core_ext/math_spec.rb +43 -43
- data/spec/core_ext/matrix_spec.rb +22 -22
- data/spec/core_ext/objectspace_spec.rb +6 -6
- data/spec/core_ext/range_spec.rb +2 -2
- data/spec/core_ext/socket_spec.rb +4 -4
- data/spec/core_ext/string_spec.rb +67 -67
- data/spec/core_ext/stringio_spec.rb +2 -2
- data/spec/core_ext/time_spec.rb +82 -82
- data/spec/gui/line_graph/line_clip_spec.rb +34 -34
- data/spec/interfaces/interface_spec.rb +46 -46
- data/spec/interfaces/linc_interface_spec.rb +26 -26
- data/spec/interfaces/serial_interface_spec.rb +16 -16
- data/spec/interfaces/simulated_target_interface_spec.rb +21 -21
- data/spec/interfaces/stream_interface_spec.rb +22 -22
- data/spec/interfaces/tcpip_client_interface_spec.rb +14 -14
- data/spec/interfaces/tcpip_server_interface_spec.rb +41 -41
- data/spec/interfaces/udp_interface_spec.rb +46 -46
- data/spec/io/buffered_file_spec.rb +50 -50
- data/spec/io/io_multiplexer_spec.rb +9 -9
- data/spec/io/json_drb_object_spec.rb +7 -7
- data/spec/io/json_drb_spec.rb +55 -55
- data/spec/io/json_rpc_spec.rb +68 -68
- data/spec/io/raw_logger_pair_spec.rb +28 -28
- data/spec/io/raw_logger_spec.rb +22 -22
- data/spec/io/serial_driver_spec.rb +3 -3
- data/spec/io/stderr_spec.rb +2 -2
- data/spec/io/stdout_spec.rb +2 -2
- data/spec/io/tcpip_server_spec.rb +62 -62
- data/spec/io/udp_sockets_spec.rb +19 -19
- data/spec/io/win32_serial_driver_spec.rb +10 -10
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +32 -32
- data/spec/packet_logs/packet_log_reader_spec.rb +138 -138
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +3 -3
- data/spec/packet_logs/packet_log_writer_spec.rb +26 -26
- data/spec/packets/binary_accessor_spec.rb +672 -672
- data/spec/packets/commands_spec.rb +123 -123
- data/spec/packets/limits_response_spec.rb +1 -1
- data/spec/packets/limits_spec.rb +69 -69
- data/spec/packets/packet_config_spec.rb +93 -93
- data/spec/packets/packet_item_limits_spec.rb +46 -46
- data/spec/packets/packet_item_spec.rb +108 -108
- data/spec/packets/packet_spec.rb +364 -348
- data/spec/packets/parsers/format_string_parser_spec.rb +13 -13
- data/spec/packets/parsers/limits_parser_spec.rb +8 -8
- data/spec/packets/parsers/limits_response_parser_spec.rb +9 -9
- data/spec/packets/parsers/macro_parser_spec.rb +34 -6
- data/spec/packets/parsers/packet_parser_spec.rb +6 -6
- data/spec/packets/parsers/processor_parser_spec.rb +7 -7
- data/spec/packets/parsers/state_parser_spec.rb +23 -23
- data/spec/packets/structure_item_spec.rb +62 -62
- data/spec/packets/structure_spec.rb +183 -183
- data/spec/packets/telemetry_spec.rb +174 -174
- data/spec/processors/new_packet_log_processor_spec.rb +4 -4
- data/spec/processors/processor_spec.rb +9 -9
- data/spec/processors/statistics_processor_spec.rb +21 -21
- data/spec/processors/watermark_processor_spec.rb +12 -12
- data/spec/script/script_spec.rb +158 -158
- data/spec/spec_helper.rb +44 -13
- data/spec/streams/burst_stream_protocol_spec.rb +8 -8
- data/spec/streams/fixed_stream_protocol_spec.rb +26 -26
- data/spec/streams/length_stream_protocol_spec.rb +27 -27
- data/spec/streams/preidentified_stream_protocol_spec.rb +25 -25
- data/spec/streams/serial_stream_spec.rb +19 -19
- data/spec/streams/stream_protocol_spec.rb +52 -52
- data/spec/streams/stream_spec.rb +1 -1
- data/spec/streams/tcpip_client_stream_spec.rb +7 -7
- data/spec/streams/tcpip_socket_stream_spec.rb +84 -49
- data/spec/streams/template_stream_protocol_spec.rb +17 -17
- data/spec/streams/terminated_stream_protocol_spec.rb +19 -19
- data/spec/system/system_spec.rb +95 -95
- data/spec/system/target_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/api_spec.rb +386 -386
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +3 -3
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +8 -8
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -85
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +11 -11
- data/spec/tools/cmd_tlm_server/connections_spec.rb +23 -23
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +17 -17
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +15 -15
- data/spec/tools/cmd_tlm_server/routers_spec.rb +36 -36
- data/spec/top_level/top_level_spec.rb +60 -60
- data/spec/utilities/crc_spec.rb +6 -6
- data/spec/utilities/csv_spec.rb +13 -13
- data/spec/utilities/logger_spec.rb +20 -20
- data/spec/utilities/message_log_spec.rb +13 -13
- data/spec/utilities/quaternion_spec.rb +30 -30
- data/spec/utilities/ruby_lex_utils_spec.rb +14 -14
- data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
- data/test/benchmarks/gsub_benchmark.rb +114 -0
- data/test/performance/PACKETS.bat +1 -0
- data/test/performance/Rakefile +77 -0
- data/test/performance/THREADS.bat +1 -0
- data/test/performance/config/data/attitude.bin +0 -0
- data/test/performance/config/data/crc.txt +206 -0
- data/test/performance/config/data/diamond.STL +58 -0
- data/test/performance/config/data/groundoff.gif +0 -0
- data/test/performance/config/data/groundon.gif +0 -0
- data/test/performance/config/data/hselectoff.gif +0 -0
- data/test/performance/config/data/hselecton.gif +0 -0
- data/test/performance/config/data/hswitchoff.gif +0 -0
- data/test/performance/config/data/hswitchon.gif +0 -0
- data/test/performance/config/data/meta_init.txt +4 -0
- data/test/performance/config/data/position.bin +0 -0
- data/test/performance/config/data/poweroff.gif +0 -0
- data/test/performance/config/data/poweron.gif +0 -0
- data/test/performance/config/data/satellite.gif +0 -0
- data/test/performance/config/data/tada.wav +0 -0
- data/test/performance/config/data/vswitchoff.gif +0 -0
- data/test/performance/config/data/vswitchon.gif +0 -0
- data/test/performance/config/system/system_packets.txt +39 -0
- data/test/performance/config/system/system_threads.txt +59 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
- data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
- data/test/performance/config/targets/COSMOS/target.txt +11 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +17 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +18 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/EXAMPLE/lib/example_interface.rb +22 -0
- data/test/performance/config/targets/EXAMPLE/target.txt +7 -0
- data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +34 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
- data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
- data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
- data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
- data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
- data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
- data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
- data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
- data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
- data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
- data/test/performance/config/tools/launcher/launcher_packets.txt +29 -0
- data/test/performance/config/tools/launcher/launcher_threads.txt +70 -0
- data/test/performance/config/tools/limits_monitor/README.txt +1 -0
- data/test/performance/config/tools/opengl_builder/README.txt +1 -0
- data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
- data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
- data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
- data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
- data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
- data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
- data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
- data/test/performance/lib/example_background_task.rb +57 -0
- data/test/performance/lib/example_target.rb +120 -0
- data/test/performance/lib/scpi_target.rb +74 -0
- data/test/performance/lib/user_version.rb +3 -0
- data/test/performance/outputs/handbooks/README.txt +1 -0
- data/test/performance/outputs/logs/README.txt +1 -0
- data/test/performance/outputs/saved_config/README.txt +1 -0
- data/test/performance/outputs/tables/README.txt +1 -0
- data/test/performance/outputs/tmp/README.txt +1 -0
- data/test/performance/procedures/checks.rb +11 -0
- data/test/performance/procedures/clear_util.rb +7 -0
- data/test/performance/procedures/collect.rb +18 -0
- data/test/performance/procedures/collect_util.rb +14 -0
- data/test/performance/procedures/cosmos_api_test.rb +293 -0
- data/test/performance/procedures/disconnect.rb +29 -0
- data/test/performance/procedures/example_test.rb +182 -0
- data/test/performance/procedures/plot_test.rb +8 -0
- data/test/performance/procedures/procedure.rb +3 -0
- data/test/performance/procedures/run_example_test.rb +3 -0
- data/test/performance/procedures/test.rb +51 -0
- data/test/performance/tools/CmdExtractor +14 -0
- data/test/performance/tools/CmdExtractor.bat +59 -0
- data/test/performance/tools/CmdSender +14 -0
- data/test/performance/tools/CmdSender.bat +59 -0
- data/test/performance/tools/CmdTlmServer +16 -0
- data/test/performance/tools/CmdTlmServer.bat +59 -0
- data/test/performance/tools/CmdTlmServerMemProf +20 -0
- data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
- data/test/performance/tools/DataViewer +14 -0
- data/test/performance/tools/DataViewer.bat +59 -0
- data/test/performance/tools/ExampleTarget +14 -0
- data/test/performance/tools/ExampleTarget.bat +59 -0
- data/test/performance/tools/HandbookCreator +14 -0
- data/test/performance/tools/HandbookCreator.bat +61 -0
- data/test/performance/tools/Launcher +14 -0
- data/test/performance/tools/Launcher.bat +59 -0
- data/test/performance/tools/LimitsMonitor +14 -0
- data/test/performance/tools/LimitsMonitor.bat +59 -0
- data/test/performance/tools/OpenGLBuilder +14 -0
- data/test/performance/tools/OpenGLBuilder.bat +59 -0
- data/test/performance/tools/PacketViewer +14 -0
- data/test/performance/tools/PacketViewer.bat +59 -0
- data/test/performance/tools/Replay +14 -0
- data/test/performance/tools/Replay.bat +59 -0
- data/test/performance/tools/ScpiTarget +14 -0
- data/test/performance/tools/ScpiTarget.bat +59 -0
- data/test/performance/tools/ScriptRunner +14 -0
- data/test/performance/tools/ScriptRunner.bat +59 -0
- data/test/performance/tools/TableManager +14 -0
- data/test/performance/tools/TableManager.bat +59 -0
- data/test/performance/tools/TestRunner +14 -0
- data/test/performance/tools/TestRunner.bat +59 -0
- data/test/performance/tools/TlmExtractor +14 -0
- data/test/performance/tools/TlmExtractor.bat +59 -0
- data/test/performance/tools/TlmGrapher +14 -0
- data/test/performance/tools/TlmGrapher.bat +59 -0
- data/test/performance/tools/TlmViewer +14 -0
- data/test/performance/tools/TlmViewer.bat +59 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/userpath.txt +1 -0
- metadata +197 -2
@@ -19,36 +19,36 @@ module Cosmos
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "initialize" do
|
22
|
-
it "
|
23
|
-
@parser.state.
|
22
|
+
it "sets the state to :READY" do
|
23
|
+
expect(@parser.state).to eql :READY
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
27
|
-
@parser.in_progress_data.
|
26
|
+
it "clears the in_progress_data" do
|
27
|
+
expect(@parser.in_progress_data).to eql ""
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "reset" do
|
32
|
-
it "
|
32
|
+
it "sets the state to :READY" do
|
33
33
|
@parser.reset
|
34
|
-
@parser.state.
|
34
|
+
expect(@parser.state).to eql :READY
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "clears the in_progress_data" do
|
38
38
|
@parser.reset
|
39
|
-
@parser.in_progress_data.
|
39
|
+
expect(@parser.in_progress_data).to eql ""
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe "unsegment_packet" do
|
44
|
-
it "
|
44
|
+
it "returns standalone CCSDS packets" do
|
45
45
|
pkt = CcsdsPacket.new
|
46
46
|
pkt.write('CCSDSSEQFLAGS', CcsdsPacket::STANDALONE)
|
47
47
|
pkt.write('CCSDSDATA',"\x01\x02\x03\x04")
|
48
|
-
@parser.unsegment_packet(pkt).
|
48
|
+
expect(@parser.unsegment_packet(pkt)).to eql pkt.buffer
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "combines two CCSDS packets" do
|
52
52
|
pkt1 = CcsdsPacket.new
|
53
53
|
pkt1.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
54
54
|
pkt1.write('CCSDSSEQCNT', 0)
|
@@ -57,11 +57,11 @@ module Cosmos
|
|
57
57
|
pkt2.write('CCSDSSEQFLAGS', CcsdsPacket::LAST)
|
58
58
|
pkt2.write('CCSDSSEQCNT', 1)
|
59
59
|
pkt2.write('CCSDSDATA',"\x05\x06\x07\x08")
|
60
|
-
@parser.unsegment_packet(pkt1).
|
61
|
-
@parser.unsegment_packet(pkt2).
|
60
|
+
expect(@parser.unsegment_packet(pkt1)).to eql nil
|
61
|
+
expect(@parser.unsegment_packet(pkt2)).to eql pkt1.buffer + pkt2.read("CCSDSDATA")
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "combines three CCSDS packets" do
|
65
65
|
pkt1 = CcsdsPacket.new
|
66
66
|
pkt1.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
67
67
|
pkt1.write('CCSDSSEQCNT', 0)
|
@@ -74,24 +74,24 @@ module Cosmos
|
|
74
74
|
pkt3.write('CCSDSSEQFLAGS', CcsdsPacket::LAST)
|
75
75
|
pkt3.write('CCSDSSEQCNT', 2)
|
76
76
|
pkt3.write('CCSDSDATA',"\x09\x0A\x0B\x0C")
|
77
|
-
@parser.unsegment_packet(pkt1).
|
78
|
-
@parser.unsegment_packet(pkt2).
|
79
|
-
@parser.unsegment_packet(pkt3).
|
77
|
+
expect(@parser.unsegment_packet(pkt1)).to eql nil
|
78
|
+
expect(@parser.unsegment_packet(pkt2)).to eql nil
|
79
|
+
expect(@parser.unsegment_packet(pkt3)).to eql pkt1.buffer + pkt2.read("CCSDSDATA") + pkt3.read("CCSDSDATA")
|
80
80
|
end
|
81
81
|
|
82
|
-
it "
|
82
|
+
it "complains with an initial continuation packet" do
|
83
83
|
pkt = CcsdsPacket.new
|
84
84
|
pkt.write('CCSDSSEQFLAGS', CcsdsPacket::CONTINUATION)
|
85
85
|
expect { @parser.unsegment_packet(pkt) }.to raise_error(CcsdsParser::CcsdsSegmentationError, "Unexpected continuation packet")
|
86
86
|
end
|
87
87
|
|
88
|
-
it "
|
88
|
+
it "complains with an initial last packet" do
|
89
89
|
pkt = CcsdsPacket.new
|
90
90
|
pkt.write('CCSDSSEQFLAGS', CcsdsPacket::LAST)
|
91
91
|
expect { @parser.unsegment_packet(pkt) }.to raise_error(CcsdsParser::CcsdsSegmentationError, "Unexpected last packet")
|
92
92
|
end
|
93
93
|
|
94
|
-
it "
|
94
|
+
it "complains with an out of order continuation sequence count" do
|
95
95
|
pkt1 = CcsdsPacket.new
|
96
96
|
pkt1.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
97
97
|
pkt1.write('CCSDSSEQCNT', 0)
|
@@ -100,11 +100,11 @@ module Cosmos
|
|
100
100
|
pkt2.write('CCSDSSEQFLAGS', CcsdsPacket::CONTINUATION)
|
101
101
|
pkt2.write('CCSDSSEQCNT', 2)
|
102
102
|
pkt2.write('CCSDSDATA',"\x05\x06\x07\x08")
|
103
|
-
@parser.unsegment_packet(pkt1).
|
103
|
+
expect(@parser.unsegment_packet(pkt1)).to eql nil
|
104
104
|
expect { @parser.unsegment_packet(pkt2) }.to raise_error(CcsdsParser::CcsdsSegmentationError, /Missing packet/)
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "complains with an out of order last sequence count" do
|
108
108
|
pkt1 = CcsdsPacket.new
|
109
109
|
pkt1.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
110
110
|
pkt1.write('CCSDSSEQCNT', 0)
|
@@ -113,11 +113,11 @@ module Cosmos
|
|
113
113
|
pkt2.write('CCSDSSEQFLAGS', CcsdsPacket::LAST)
|
114
114
|
pkt2.write('CCSDSSEQCNT', 2)
|
115
115
|
pkt2.write('CCSDSDATA',"\x05\x06\x07\x08")
|
116
|
-
@parser.unsegment_packet(pkt1).
|
116
|
+
expect(@parser.unsegment_packet(pkt1)).to eql nil
|
117
117
|
expect { @parser.unsegment_packet(pkt2) }.to raise_error(CcsdsParser::CcsdsSegmentationError, /Missing packet/)
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
120
|
+
it "complains with a first in the middle of processing" do
|
121
121
|
pkt1 = CcsdsPacket.new
|
122
122
|
pkt1.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
123
123
|
pkt1.write('CCSDSSEQCNT', 0)
|
@@ -126,11 +126,11 @@ module Cosmos
|
|
126
126
|
pkt2.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
127
127
|
pkt2.write('CCSDSSEQCNT', 1)
|
128
128
|
pkt2.write('CCSDSDATA',"\x05\x06\x07\x08")
|
129
|
-
@parser.unsegment_packet(pkt1).
|
129
|
+
expect(@parser.unsegment_packet(pkt1)).to eql nil
|
130
130
|
expect { @parser.unsegment_packet(pkt2) }.to raise_error(CcsdsParser::CcsdsSegmentationError, "Unexpected first packet")
|
131
131
|
end
|
132
132
|
|
133
|
-
it "
|
133
|
+
it "complains with a standalone in the middle of processing" do
|
134
134
|
pkt1 = CcsdsPacket.new
|
135
135
|
pkt1.write('CCSDSSEQFLAGS', CcsdsPacket::FIRST)
|
136
136
|
pkt1.write('CCSDSSEQCNT', 0)
|
@@ -138,7 +138,7 @@ module Cosmos
|
|
138
138
|
pkt2 = CcsdsPacket.new
|
139
139
|
pkt2.write('CCSDSSEQFLAGS', CcsdsPacket::STANDALONE)
|
140
140
|
pkt2.write('CCSDSDATA',"\x05\x06\x07\x08")
|
141
|
-
@parser.unsegment_packet(pkt1).
|
141
|
+
expect(@parser.unsegment_packet(pkt1)).to eql nil
|
142
142
|
expect { @parser.unsegment_packet(pkt2) }.to raise_error(CcsdsParser::CcsdsSegmentationError, "Unexpected standalone packet")
|
143
143
|
end
|
144
144
|
|
@@ -23,22 +23,22 @@ module Cosmos
|
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "parse_file" do
|
26
|
-
it "
|
26
|
+
it "yields keyword, parameters to the block" do
|
27
27
|
tf = Tempfile.new('unittest')
|
28
28
|
line = "KEYWORD PARAM1 PARAM2 'PARAM 3'"
|
29
29
|
tf.puts line
|
30
30
|
tf.close
|
31
31
|
|
32
32
|
@cp.parse_file(tf.path) do |keyword, params|
|
33
|
-
keyword.
|
34
|
-
params.
|
35
|
-
@cp.line.
|
36
|
-
@cp.line_number.
|
33
|
+
expect(keyword).to eql "KEYWORD"
|
34
|
+
expect(params).to include('PARAM1','PARAM2','PARAM 3')
|
35
|
+
expect(@cp.line).to eql line
|
36
|
+
expect(@cp.line_number).to eql 1
|
37
37
|
end
|
38
38
|
tf.unlink
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "handles Ruby string interpolation" do
|
42
42
|
tf = Tempfile.new('unittest')
|
43
43
|
tf.puts 'KEYWORD1 #{var} PARAM1'
|
44
44
|
tf.puts 'KEYWORD2 PARAM1 #Comment'
|
@@ -49,64 +49,64 @@ module Cosmos
|
|
49
49
|
results[keyword] = params
|
50
50
|
end
|
51
51
|
|
52
|
-
results.keys.
|
53
|
-
results["KEYWORD1"].
|
54
|
-
results["KEYWORD2"].
|
52
|
+
expect(results.keys).to eql %w(KEYWORD1 KEYWORD2)
|
53
|
+
expect(results["KEYWORD1"]).to eql %w(#{var} PARAM1)
|
54
|
+
expect(results["KEYWORD2"]).to eql %w(PARAM1)
|
55
55
|
tf.unlink
|
56
56
|
end
|
57
57
|
|
58
|
-
it "
|
58
|
+
it "optionallies not remove quotes" do
|
59
59
|
tf = Tempfile.new('unittest')
|
60
60
|
line = "KEYWORD PARAM1 PARAM2 'PARAM 3'"
|
61
61
|
tf.puts line
|
62
62
|
tf.close
|
63
63
|
|
64
64
|
@cp.parse_file(tf.path, false, false) do |keyword, params|
|
65
|
-
keyword.
|
66
|
-
params.
|
67
|
-
@cp.line.
|
68
|
-
@cp.line_number.
|
65
|
+
expect(keyword).to eql "KEYWORD"
|
66
|
+
expect(params).to include('PARAM1','PARAM2',"'PARAM 3'")
|
67
|
+
expect(@cp.line).to eql line
|
68
|
+
expect(@cp.line_number).to eql 1
|
69
69
|
end
|
70
70
|
tf.unlink
|
71
71
|
end
|
72
72
|
|
73
|
-
it "
|
73
|
+
it "handles inline line continuations" do
|
74
74
|
tf = Tempfile.new('unittest')
|
75
75
|
tf.puts "KEYWORD PARAM1 & PARAM2"
|
76
76
|
tf.close
|
77
77
|
|
78
78
|
@cp.parse_file(tf.path) do |keyword, params|
|
79
|
-
keyword.
|
80
|
-
params.
|
81
|
-
@cp.line.
|
82
|
-
@cp.line_number.
|
79
|
+
expect(keyword).to eql "KEYWORD"
|
80
|
+
expect(params).to eql %w(PARAM1 & PARAM2)
|
81
|
+
expect(@cp.line).to eql "KEYWORD PARAM1 & PARAM2"
|
82
|
+
expect(@cp.line_number).to eql 1
|
83
83
|
end
|
84
84
|
tf.unlink
|
85
85
|
end
|
86
86
|
|
87
|
-
it "
|
87
|
+
it "handles line continuations as EOL" do
|
88
88
|
tf = Tempfile.new('unittest')
|
89
89
|
tf.puts "KEYWORD PARAM1 &"
|
90
90
|
tf.puts " PARAM2 'PARAM 3'"
|
91
91
|
tf.close
|
92
92
|
|
93
93
|
@cp.parse_file(tf.path) do |keyword, params|
|
94
|
-
keyword.
|
95
|
-
params.
|
96
|
-
@cp.line.
|
97
|
-
@cp.line_number.
|
94
|
+
expect(keyword).to eql "KEYWORD"
|
95
|
+
expect(params).to include('PARAM1','PARAM2','PARAM 3')
|
96
|
+
expect(@cp.line).to eql "KEYWORD PARAM1 PARAM2 'PARAM 3'"
|
97
|
+
expect(@cp.line_number).to eql 2
|
98
98
|
end
|
99
99
|
|
100
100
|
@cp.parse_file(tf.path, false, false) do |keyword, params|
|
101
|
-
keyword.
|
102
|
-
params.
|
103
|
-
@cp.line.
|
104
|
-
@cp.line_number.
|
101
|
+
expect(keyword).to eql "KEYWORD"
|
102
|
+
expect(params).to include('PARAM1','PARAM2',"'PARAM 3'")
|
103
|
+
expect(@cp.line).to eql "KEYWORD PARAM1 PARAM2 'PARAM 3'"
|
104
|
+
expect(@cp.line_number).to eql 2
|
105
105
|
end
|
106
106
|
tf.unlink
|
107
107
|
end
|
108
108
|
|
109
|
-
it "
|
109
|
+
it "optionallies yield comment lines" do
|
110
110
|
tf = Tempfile.new('unittest')
|
111
111
|
tf.puts "KEYWORD1 PARAM1"
|
112
112
|
tf.puts "# This is a comment"
|
@@ -117,11 +117,11 @@ module Cosmos
|
|
117
117
|
@cp.parse_file(tf.path, true) do |keyword, params|
|
118
118
|
lines << @cp.line
|
119
119
|
end
|
120
|
-
lines.
|
120
|
+
expect(lines).to include("# This is a comment")
|
121
121
|
tf.unlink
|
122
122
|
end
|
123
123
|
|
124
|
-
it "
|
124
|
+
it "callbacks for messages" do
|
125
125
|
tf = Tempfile.new('unittest')
|
126
126
|
line = "KEYWORD PARAM1 PARAM2 'PARAM 3'"
|
127
127
|
tf.puts line
|
@@ -132,15 +132,15 @@ module Cosmos
|
|
132
132
|
|
133
133
|
ConfigParser.message_callback = msg_callback
|
134
134
|
@cp.parse_file(tf.path) do |keyword, params|
|
135
|
-
keyword.
|
136
|
-
params.
|
137
|
-
@cp.line.
|
138
|
-
@cp.line_number.
|
135
|
+
expect(keyword).to eql "KEYWORD"
|
136
|
+
expect(params).to include('PARAM1','PARAM2','PARAM 3')
|
137
|
+
expect(@cp.line).to eql line
|
138
|
+
expect(@cp.line_number).to eql 1
|
139
139
|
end
|
140
140
|
tf.unlink
|
141
141
|
end
|
142
142
|
|
143
|
-
it "
|
143
|
+
it "callbacks for percent done" do
|
144
144
|
tf = Tempfile.new('unittest')
|
145
145
|
# Callback is made at beginning, every 10 lines, and at the end
|
146
146
|
15.times { tf.puts "KEYWORD PARAM" }
|
@@ -160,27 +160,27 @@ module Cosmos
|
|
160
160
|
end
|
161
161
|
|
162
162
|
describe "verify_num_parameters" do
|
163
|
-
it "
|
163
|
+
it "verifies the minimum number of parameters" do
|
164
164
|
tf = Tempfile.new('unittest')
|
165
165
|
line = "KEYWORD"
|
166
166
|
tf.puts line
|
167
167
|
tf.close
|
168
168
|
|
169
169
|
@cp.parse_file(tf.path) do |keyword, params|
|
170
|
-
keyword.
|
170
|
+
expect(keyword).to eql "KEYWORD"
|
171
171
|
expect { @cp.verify_num_parameters(1, 1) }.to raise_error(ConfigParser::Error, "Not enough parameters for KEYWORD.")
|
172
172
|
end
|
173
173
|
tf.unlink
|
174
174
|
end
|
175
175
|
|
176
|
-
it "
|
176
|
+
it "verifies the maximum number of parameters" do
|
177
177
|
tf = Tempfile.new('unittest')
|
178
178
|
line = "KEYWORD PARAM1 PARAM2"
|
179
179
|
tf.puts line
|
180
180
|
tf.close
|
181
181
|
|
182
182
|
@cp.parse_file(tf.path) do |keyword, params|
|
183
|
-
keyword.
|
183
|
+
expect(keyword).to eql "KEYWORD"
|
184
184
|
expect { @cp.verify_num_parameters(1, 1) }.to raise_error(ConfigParser::Error, "Too many parameters for KEYWORD.")
|
185
185
|
end
|
186
186
|
tf.unlink
|
@@ -188,7 +188,7 @@ module Cosmos
|
|
188
188
|
end
|
189
189
|
|
190
190
|
describe "error" do
|
191
|
-
it "
|
191
|
+
it "returns an Error" do
|
192
192
|
tf = Tempfile.new('unittest')
|
193
193
|
line = "KEYWORD"
|
194
194
|
tf.puts line
|
@@ -196,30 +196,30 @@ module Cosmos
|
|
196
196
|
|
197
197
|
@cp.parse_file(tf.path) do |keyword, params|
|
198
198
|
error = @cp.error("Hello")
|
199
|
-
error.message.
|
200
|
-
error.keyword.
|
201
|
-
error.filename.
|
199
|
+
expect(error.message).to eql "Hello"
|
200
|
+
expect(error.keyword).to eql "KEYWORD"
|
201
|
+
expect(error.filename).to eql tf.path
|
202
202
|
end
|
203
203
|
tf.unlink
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
207
|
describe "self.handle_nil" do
|
208
|
-
it "
|
209
|
-
ConfigParser.handle_nil('NIL').
|
210
|
-
ConfigParser.handle_nil('NULL').
|
211
|
-
ConfigParser.handle_nil('nil').
|
212
|
-
ConfigParser.handle_nil('null').
|
213
|
-
ConfigParser.handle_nil('').
|
208
|
+
it "converts 'NIL' and 'NULL' to nil" do
|
209
|
+
expect(ConfigParser.handle_nil('NIL')).to be_nil
|
210
|
+
expect(ConfigParser.handle_nil('NULL')).to be_nil
|
211
|
+
expect(ConfigParser.handle_nil('nil')).to be_nil
|
212
|
+
expect(ConfigParser.handle_nil('null')).to be_nil
|
213
|
+
expect(ConfigParser.handle_nil('')).to be_nil
|
214
214
|
end
|
215
215
|
|
216
|
-
it "
|
217
|
-
ConfigParser.handle_nil(nil).
|
216
|
+
it "returns nil with nil" do
|
217
|
+
expect(ConfigParser.handle_nil(nil)).to be_nil
|
218
218
|
end
|
219
219
|
|
220
|
-
it "
|
221
|
-
ConfigParser.handle_nil("HI").
|
222
|
-
ConfigParser.handle_nil(5.0).
|
220
|
+
it "returns values that don't convert" do
|
221
|
+
expect(ConfigParser.handle_nil("HI")).to eql "HI"
|
222
|
+
expect(ConfigParser.handle_nil(5.0)).to eql 5.0
|
223
223
|
end
|
224
224
|
|
225
225
|
#it "should complain if it can't convert" do
|
@@ -229,21 +229,21 @@ module Cosmos
|
|
229
229
|
end
|
230
230
|
|
231
231
|
describe "self.handle_true_false" do
|
232
|
-
it "
|
232
|
+
it "converts 'TRUE' and 'FALSE'" do
|
233
233
|
expect(ConfigParser.handle_true_false('TRUE')).to be true
|
234
234
|
expect(ConfigParser.handle_true_false('FALSE')).to be false
|
235
235
|
expect(ConfigParser.handle_true_false('true')).to be true
|
236
236
|
expect(ConfigParser.handle_true_false('false')).to be false
|
237
237
|
end
|
238
238
|
|
239
|
-
it "
|
239
|
+
it "passes through true and false" do
|
240
240
|
expect(ConfigParser.handle_true_false(true)).to be true
|
241
241
|
expect(ConfigParser.handle_true_false(false)).to be false
|
242
242
|
end
|
243
243
|
|
244
|
-
it "
|
245
|
-
ConfigParser.handle_true_false("HI").
|
246
|
-
ConfigParser.handle_true_false(5.0).
|
244
|
+
it "returns values that don't convert" do
|
245
|
+
expect(ConfigParser.handle_true_false("HI")).to eql "HI"
|
246
|
+
expect(ConfigParser.handle_true_false(5.0)).to eql 5.0
|
247
247
|
end
|
248
248
|
|
249
249
|
#it "should complain if it can't convert" do
|
@@ -253,33 +253,33 @@ module Cosmos
|
|
253
253
|
end
|
254
254
|
|
255
255
|
describe "self.handle_true_false_nil" do
|
256
|
-
it "
|
257
|
-
ConfigParser.handle_true_false_nil('NIL').
|
258
|
-
ConfigParser.handle_true_false_nil('NULL').
|
259
|
-
ConfigParser.handle_true_false_nil('nil').
|
260
|
-
ConfigParser.handle_true_false_nil('null').
|
261
|
-
ConfigParser.handle_true_false_nil('').
|
256
|
+
it "converts 'NIL' and 'NULL' to nil" do
|
257
|
+
expect(ConfigParser.handle_true_false_nil('NIL')).to be_nil
|
258
|
+
expect(ConfigParser.handle_true_false_nil('NULL')).to be_nil
|
259
|
+
expect(ConfigParser.handle_true_false_nil('nil')).to be_nil
|
260
|
+
expect(ConfigParser.handle_true_false_nil('null')).to be_nil
|
261
|
+
expect(ConfigParser.handle_true_false_nil('')).to be_nil
|
262
262
|
end
|
263
263
|
|
264
|
-
it "
|
265
|
-
ConfigParser.handle_true_false_nil(nil).
|
264
|
+
it "returns nil with nil" do
|
265
|
+
expect(ConfigParser.handle_true_false_nil(nil)).to be_nil
|
266
266
|
end
|
267
267
|
|
268
|
-
it "
|
268
|
+
it "converts 'TRUE' and 'FALSE'" do
|
269
269
|
expect(ConfigParser.handle_true_false_nil('TRUE')).to be true
|
270
270
|
expect(ConfigParser.handle_true_false_nil('FALSE')).to be false
|
271
271
|
expect(ConfigParser.handle_true_false_nil('true')).to be true
|
272
272
|
expect(ConfigParser.handle_true_false_nil('false')).to be false
|
273
273
|
end
|
274
274
|
|
275
|
-
it "
|
275
|
+
it "passes through true and false" do
|
276
276
|
expect(ConfigParser.handle_true_false_nil(true)).to be true
|
277
277
|
expect(ConfigParser.handle_true_false_nil(false)).to be false
|
278
278
|
end
|
279
279
|
|
280
|
-
it "
|
281
|
-
ConfigParser.handle_true_false("HI").
|
282
|
-
ConfigParser.handle_true_false(5.0).
|
280
|
+
it "returns values that don't convert" do
|
281
|
+
expect(ConfigParser.handle_true_false("HI")).to eql "HI"
|
282
|
+
expect(ConfigParser.handle_true_false(5.0)).to eql 5.0
|
283
283
|
end
|
284
284
|
|
285
285
|
#it "should complain if it can't convert" do
|
@@ -289,31 +289,31 @@ module Cosmos
|
|
289
289
|
end
|
290
290
|
|
291
291
|
describe "self.handle_defined_constants" do
|
292
|
-
it "
|
292
|
+
it "converts string constants to numbers" do
|
293
293
|
[8,16,32,64].each do |val|
|
294
294
|
# Unsigned
|
295
|
-
ConfigParser.handle_defined_constants("MIN_UINT#{val}").
|
296
|
-
ConfigParser.handle_defined_constants("MAX_UINT#{val}").
|
295
|
+
expect(ConfigParser.handle_defined_constants("MIN_UINT#{val}")).to eql 0
|
296
|
+
expect(ConfigParser.handle_defined_constants("MAX_UINT#{val}")).to eql (2**val - 1)
|
297
297
|
# Signed
|
298
|
-
ConfigParser.handle_defined_constants("MIN_INT#{val}").
|
299
|
-
ConfigParser.handle_defined_constants("MAX_INT#{val}").
|
298
|
+
expect(ConfigParser.handle_defined_constants("MIN_INT#{val}")).to eql -((2**val) / 2)
|
299
|
+
expect(ConfigParser.handle_defined_constants("MAX_INT#{val}")).to eql ((2**val) / 2 - 1)
|
300
300
|
end
|
301
301
|
# Float
|
302
|
-
ConfigParser.handle_defined_constants("MIN_FLOAT32").
|
303
|
-
ConfigParser.handle_defined_constants("MAX_FLOAT32").
|
304
|
-
ConfigParser.handle_defined_constants("MIN_FLOAT64").
|
305
|
-
ConfigParser.handle_defined_constants("MAX_FLOAT64").
|
306
|
-
ConfigParser.handle_defined_constants("POS_INFINITY").
|
307
|
-
ConfigParser.handle_defined_constants("NEG_INFINITY").
|
302
|
+
expect(ConfigParser.handle_defined_constants("MIN_FLOAT32")).to be <= -3.4 * 10**38
|
303
|
+
expect(ConfigParser.handle_defined_constants("MAX_FLOAT32")).to be >= 3.4 * 10**38
|
304
|
+
expect(ConfigParser.handle_defined_constants("MIN_FLOAT64")).to eql -Float::MAX
|
305
|
+
expect(ConfigParser.handle_defined_constants("MAX_FLOAT64")).to eql Float::MAX
|
306
|
+
expect(ConfigParser.handle_defined_constants("POS_INFINITY")).to eql Float::INFINITY
|
307
|
+
expect(ConfigParser.handle_defined_constants("NEG_INFINITY")).to eql -Float::INFINITY
|
308
308
|
end
|
309
309
|
|
310
|
-
it "
|
310
|
+
it "complains about undefined strings" do
|
311
311
|
expect { ConfigParser.handle_defined_constants("TRUE") }.to raise_error(ArgumentError, "Could not convert constant: TRUE")
|
312
312
|
end
|
313
313
|
|
314
|
-
it "
|
315
|
-
ConfigParser.handle_defined_constants(0).
|
316
|
-
ConfigParser.handle_defined_constants(0.0).
|
314
|
+
it "passes through numbers" do
|
315
|
+
expect(ConfigParser.handle_defined_constants(0)).to eql 0
|
316
|
+
expect(ConfigParser.handle_defined_constants(0.0)).to eql 0.0
|
317
317
|
end
|
318
318
|
end
|
319
319
|
|