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
data/spec/core_ext/array_spec.rb
CHANGED
@@ -14,172 +14,172 @@ require 'cosmos/core_ext/array'
|
|
14
14
|
describe Array do
|
15
15
|
|
16
16
|
describe "inspect" do
|
17
|
-
it "
|
18
|
-
Array.new([1,2,3,4,5,6,7,8,9,10]).inspect.
|
19
|
-
Array.new([1,2,3,4,5,6,7,8,9,10,11]).inspect.
|
17
|
+
it "limits the number of items to 10" do
|
18
|
+
expect(Array.new([1,2,3,4,5,6,7,8,9,10]).inspect).to eql "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
|
19
|
+
expect(Array.new([1,2,3,4,5,6,7,8,9,10,11]).inspect).to match /#<Array:\d+>/
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "clone_to_f" do
|
24
|
-
it "
|
25
|
-
Array.new([1,2,3,4,5]).clone_to_f.
|
24
|
+
it "clones the array and convert all the values to floats" do
|
25
|
+
expect(Array.new([1,2,3,4,5]).clone_to_f).to eql [1.0,2.0,3.0,4.0,5.0]
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "nearest_index" do
|
30
|
-
it "
|
30
|
+
it "raises error if empty" do
|
31
31
|
expect { Array.new.nearest_index(nil) }.to raise_error
|
32
32
|
end
|
33
33
|
|
34
34
|
def find_sorted_value(array, sorted)
|
35
|
-
array.nearest_index(-1, sorted).
|
35
|
+
expect(array.nearest_index(-1, sorted)).to eql 0
|
36
36
|
(0..10).each do |val|
|
37
|
-
array.nearest_index(val,sorted).
|
37
|
+
expect(array.nearest_index(val,sorted)).to eql val
|
38
38
|
# Ensure we always round up
|
39
39
|
if val < 10
|
40
|
-
array.nearest_index(val+0.1,sorted).
|
41
|
-
array.nearest_index(val+0.5,sorted).
|
42
|
-
array.nearest_index(val+0.9,sorted).
|
40
|
+
expect(array.nearest_index(val+0.1,sorted)).to eql val
|
41
|
+
expect(array.nearest_index(val+0.5,sorted)).to eql val + 1
|
42
|
+
expect(array.nearest_index(val+0.9,sorted)).to eql val + 1
|
43
43
|
end
|
44
44
|
end
|
45
|
-
array.nearest_index(5.5,sorted).
|
46
|
-
array.nearest_index(11, sorted).
|
45
|
+
expect(array.nearest_index(5.5,sorted)).to eql 6
|
46
|
+
expect(array.nearest_index(11, sorted)).to eql 10
|
47
47
|
end
|
48
48
|
|
49
49
|
context "with sorted data" do
|
50
50
|
context "with sorted = true" do
|
51
|
-
it "
|
51
|
+
it "finds the nearest index" do
|
52
52
|
array = Array.new([0,1,2,3,4,5,6,7,8,9,10])
|
53
53
|
find_sorted_value(array, true)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
context "with sorted = false" do
|
58
|
-
it "
|
58
|
+
it "finds the nearest index" do
|
59
59
|
array = Array.new([0,1,2,3,4,5,6,7,8,9,10])
|
60
60
|
find_sorted_value(array, false)
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "finds the nearest index with duplicates" do
|
64
64
|
index1 = Array.new([0,1,1,1,1,2,2,3]).nearest_index(1,false)
|
65
65
|
index2 = Array.new([0,1,1,1,1,2,2]).nearest_index(1,false)
|
66
|
-
index1.
|
66
|
+
expect(index1).to eql index2
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
context "with unsorted data" do
|
72
|
-
it "
|
72
|
+
it "finds the nearest index to a value" do
|
73
73
|
array = Array.new([10,1,9,2,8,3,7,4,6,5,0])
|
74
|
-
array.nearest_index(-1, false).
|
75
|
-
array.nearest_index(11, false).
|
74
|
+
expect(array.nearest_index(-1, false)).to eql 10
|
75
|
+
expect(array.nearest_index(11, false)).to eql 0
|
76
76
|
# Ensure we round up
|
77
|
-
array.nearest_index(0.5, false).
|
78
|
-
array.nearest_index(1.5, false).
|
79
|
-
array.nearest_index(2.5, false).
|
80
|
-
array.nearest_index(3.5, false).
|
81
|
-
array.nearest_index(4.5, false).
|
82
|
-
array.nearest_index(5.5, false).
|
83
|
-
array.nearest_index(6.5, false).
|
84
|
-
array.nearest_index(7.5, false).
|
85
|
-
array.nearest_index(8.5, false).
|
86
|
-
array.nearest_index(9.5, false).
|
77
|
+
expect(array.nearest_index(0.5, false)).to eql 1
|
78
|
+
expect(array.nearest_index(1.5, false)).to eql 3
|
79
|
+
expect(array.nearest_index(2.5, false)).to eql 5
|
80
|
+
expect(array.nearest_index(3.5, false)).to eql 7
|
81
|
+
expect(array.nearest_index(4.5, false)).to eql 9
|
82
|
+
expect(array.nearest_index(5.5, false)).to eql 8
|
83
|
+
expect(array.nearest_index(6.5, false)).to eql 6
|
84
|
+
expect(array.nearest_index(7.5, false)).to eql 4
|
85
|
+
expect(array.nearest_index(8.5, false)).to eql 2
|
86
|
+
expect(array.nearest_index(9.5, false)).to eql 0
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
describe "index_lt_eq" do
|
92
|
-
it "
|
93
|
-
Array.new([0,1,1,1,1,2,2,3]).index_lt_eq(1).
|
94
|
-
Array.new([0,1,1,2,3]).index_lt_eq(1).
|
95
|
-
Array.new([0,1,1,2,3]).index_lt_eq(0.5).
|
92
|
+
it "finds the nearest index less than or equal to" do
|
93
|
+
expect(Array.new([0,1,1,1,1,2,2,3]).index_lt_eq(1)).to eql 1
|
94
|
+
expect(Array.new([0,1,1,2,3]).index_lt_eq(1)).to eql 1
|
95
|
+
expect(Array.new([0,1,1,2,3]).index_lt_eq(0.5)).to eql 0
|
96
96
|
end
|
97
97
|
|
98
|
-
it "
|
99
|
-
Array.new([1,2,3,4]).index_lt_eq(0).
|
98
|
+
it "returns the first index if can't find one" do
|
99
|
+
expect(Array.new([1,2,3,4]).index_lt_eq(0)).to eql 0
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
describe "index_gt_eq" do
|
104
|
-
it "
|
105
|
-
Array.new([0,1,1,1,1,2,2,3]).index_gt_eq(1).
|
106
|
-
Array.new([0,0.1,1,1,1,2,2]).index_gt_eq(1).
|
107
|
-
Array.new([0,0.1,0.5,1,1]).index_gt_eq(0.7).
|
104
|
+
it "finds the nearest index greater than or equal to" do
|
105
|
+
expect(Array.new([0,1,1,1,1,2,2,3]).index_gt_eq(1)).to eql 4
|
106
|
+
expect(Array.new([0,0.1,1,1,1,2,2]).index_gt_eq(1)).to eql 4
|
107
|
+
expect(Array.new([0,0.1,0.5,1,1]).index_gt_eq(0.7)).to eql 3
|
108
108
|
end
|
109
109
|
|
110
|
-
it "
|
111
|
-
Array.new([1,2,3,4]).index_gt_eq(5).
|
110
|
+
it "returns the last index if can't find one" do
|
111
|
+
expect(Array.new([1,2,3,4]).index_gt_eq(5)).to eql 3
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
describe "range_containing" do
|
116
|
-
it "
|
116
|
+
it "complains if start < end" do
|
117
117
|
expect { Array.new().range_containing(2,1) }.to raise_error(RuntimeError, "end_value: 1 must be greater than start_value: 2")
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
121
|
-
Array.new([0,1,1,2,2,3]).range_containing(1,2).
|
122
|
-
Array.new([0,1,1,2,2,3]).range_containing(1,1).
|
120
|
+
it "finds the range of values containing both" do
|
121
|
+
expect(Array.new([0,1,1,2,2,3]).range_containing(1,2)).to eql (1..4)
|
122
|
+
expect(Array.new([0,1,1,2,2,3]).range_containing(1,1)).to eql (1..2)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
126
|
describe "sum" do
|
127
|
-
it "
|
128
|
-
Array.new([0,1,2,3,4]).sum.
|
127
|
+
it "sums up the array elements" do
|
128
|
+
expect(Array.new([0,1,2,3,4]).sum).to eql 10
|
129
129
|
# The float causes the entire result to be a Float
|
130
|
-
Array.new([0,1,2,3,4.0]).sum.
|
130
|
+
expect(Array.new([0,1,2,3,4.0]).sum).to eql 10.0
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
134
|
describe "mean" do
|
135
|
-
it "
|
136
|
-
Array.new([0,1,2,3,4]).mean.
|
135
|
+
it "calculates the mean" do
|
136
|
+
expect(Array.new([0,1,2,3,4]).mean).to eql 2.0
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
140
|
describe "squared" do
|
141
|
-
it "
|
141
|
+
it "squares each element in the array" do
|
142
142
|
array = Array.new([0,1,2,3,4])
|
143
|
-
array.squared.
|
143
|
+
expect(array.squared).to eql [0,1,4,9,16]
|
144
144
|
# It should not affect the original
|
145
|
-
array.
|
145
|
+
expect(array).to eql [0,1,2,3,4]
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "max_with_index" do
|
150
|
-
it "
|
151
|
-
Array.new([0,1,8,3,4]).max_with_index.
|
152
|
-
Array.new([-1,-8,-3,-4]).max_with_index.
|
153
|
-
Array.new([0,1,2,2,0]).max_with_index.
|
150
|
+
it "finds the first maximum value and its index" do
|
151
|
+
expect(Array.new([0,1,8,3,4]).max_with_index).to eql [8,2]
|
152
|
+
expect(Array.new([-1,-8,-3,-4]).max_with_index).to eql [-1,0]
|
153
|
+
expect(Array.new([0,1,2,2,0]).max_with_index).to eql [2,2]
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
157
|
describe "min_with_index" do
|
158
|
-
it "
|
159
|
-
Array.new([8,9,2,5,6]).min_with_index.
|
160
|
-
Array.new([-1,-8,-3,-4]).min_with_index.
|
161
|
-
Array.new([0,1,2,2,0]).min_with_index.
|
158
|
+
it "finds the first maximum value and its index" do
|
159
|
+
expect(Array.new([8,9,2,5,6]).min_with_index).to eql [2,2]
|
160
|
+
expect(Array.new([-1,-8,-3,-4]).min_with_index).to eql [-8,1]
|
161
|
+
expect(Array.new([0,1,2,2,0]).min_with_index).to eql [0,0]
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
165
|
describe "histogram" do
|
166
|
-
it "
|
166
|
+
it "groups elements" do
|
167
167
|
myData1 = [1, 7, 4, 3, 4, 2, 7, 0, 8, 3, 4]
|
168
168
|
myData2 = [1, 2, 3]
|
169
169
|
myData3 = [2, 4, 8]
|
170
|
-
myData1.histogram(9, true).length.
|
171
|
-
myData1.histogram(1, true).length.
|
172
|
-
myData1.histogram(9, true)[0][2].
|
173
|
-
myData1.histogram(9, true)[4][2].
|
174
|
-
myData1.histogram(3, true)[0][2].
|
175
|
-
myData2.histogram(5, true).length.
|
176
|
-
myData2.histogram(50, true).length.
|
177
|
-
myData2.histogram(5, true)[4][2].
|
178
|
-
myData2.histogram(5, true)[1][2].
|
179
|
-
myData3.histogram(7, true).length.
|
180
|
-
myData3.histogram(25, true).length.
|
181
|
-
myData3.histogram(7, true)[2][2].
|
182
|
-
myData3.histogram(25, true)[20][2].
|
170
|
+
expect(myData1.histogram(9, true).length).to eql 9
|
171
|
+
expect(myData1.histogram(1, true).length).to eql 1
|
172
|
+
expect(myData1.histogram(9, true)[0][2]).to eql 1
|
173
|
+
expect(myData1.histogram(9, true)[4][2]).to eql 3
|
174
|
+
expect(myData1.histogram(3, true)[0][2]).to eql 3
|
175
|
+
expect(myData2.histogram(5, true).length).to eql 5
|
176
|
+
expect(myData2.histogram(50, true).length).to eql 50
|
177
|
+
expect(myData2.histogram(5, true)[4][2]).to eql 0
|
178
|
+
expect(myData2.histogram(5, true)[1][2]).to eql 1
|
179
|
+
expect(myData3.histogram(7, true).length).to eql 7
|
180
|
+
expect(myData3.histogram(25, true).length).to eql 25
|
181
|
+
expect(myData3.histogram(7, true)[2][2]).to eql 1
|
182
|
+
expect(myData3.histogram(25, true)[20][2]).to eql 0
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
data/spec/core_ext/class_spec.rb
CHANGED
@@ -14,7 +14,7 @@ require 'cosmos/core_ext/class'
|
|
14
14
|
describe Class do
|
15
15
|
|
16
16
|
describe "instance_attr_reader" do
|
17
|
-
it "
|
17
|
+
it "adds instance attribute readers for class variables" do
|
18
18
|
class MyClass
|
19
19
|
instance_attr_reader :test
|
20
20
|
@@instance = nil
|
@@ -29,8 +29,8 @@ describe Class do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
my = MyClass.new
|
32
|
-
MyClass.test.
|
33
|
-
my.test.
|
32
|
+
expect(MyClass.test).to eql "Test"
|
33
|
+
expect(my.test).to eql "Test"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -18,60 +18,60 @@ end
|
|
18
18
|
describe StringIO do
|
19
19
|
|
20
20
|
describe "read_length_bytes" do
|
21
|
-
it "
|
21
|
+
it "returns nil if length field is not 1, 2 or 4" do
|
22
22
|
io = StringIO.new
|
23
23
|
io.write "\x01\x01\x01\x01\x01\x01\x01\x01"
|
24
24
|
io.rewind
|
25
|
-
io.read_length_bytes(0).
|
25
|
+
expect(io.read_length_bytes(0)).to be_nil
|
26
26
|
io.rewind
|
27
|
-
io.read_length_bytes(3).
|
27
|
+
expect(io.read_length_bytes(3)).to be_nil
|
28
28
|
io.rewind
|
29
|
-
io.read_length_bytes(8).
|
29
|
+
expect(io.read_length_bytes(8)).to be_nil
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "returns nil if there aren't enough bytes to read the length field" do
|
33
33
|
io = StringIO.new
|
34
34
|
io.write ""
|
35
35
|
io.rewind
|
36
|
-
io.read_length_bytes(1).
|
36
|
+
expect(io.read_length_bytes(1)).to be_nil
|
37
37
|
|
38
38
|
io = StringIO.new
|
39
39
|
io.write "\x01"
|
40
40
|
io.rewind
|
41
|
-
io.read_length_bytes(2).
|
41
|
+
expect(io.read_length_bytes(2)).to be_nil
|
42
42
|
|
43
43
|
io = StringIO.new
|
44
44
|
io.write "\x01\x01"
|
45
45
|
io.rewind
|
46
|
-
io.read_length_bytes(4).
|
46
|
+
expect(io.read_length_bytes(4)).to be_nil
|
47
47
|
end
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "returns nil if there aren't enough bytes to read the string" do
|
50
50
|
io = StringIO.new
|
51
51
|
io.write "\x02\x01"
|
52
52
|
io.rewind
|
53
|
-
io.read_length_bytes(1).
|
53
|
+
expect(io.read_length_bytes(1)).to be_nil
|
54
54
|
end
|
55
55
|
|
56
|
-
it "
|
56
|
+
it "reads the bytes with length field size 1" do
|
57
57
|
io = StringIO.new
|
58
58
|
io.write "\x02\x01\x02"
|
59
59
|
io.rewind
|
60
|
-
io.read_length_bytes(1).
|
60
|
+
expect(io.read_length_bytes(1)).to eql "\x01\x02"
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "reads the bytes with length field size 2" do
|
64
64
|
io = StringIO.new
|
65
65
|
io.write "\x00\x03\x01\x02\x03"
|
66
66
|
io.rewind
|
67
|
-
io.read_length_bytes(2).
|
67
|
+
expect(io.read_length_bytes(2)).to eql "\x01\x02\x03"
|
68
68
|
end
|
69
69
|
|
70
|
-
it "
|
70
|
+
it "reads the bytes with length field size 4" do
|
71
71
|
io = StringIO.new
|
72
72
|
io.write "\x00\x00\x00\x03\x01\x02\x03"
|
73
73
|
io.rewind
|
74
|
-
io.read_length_bytes(4).
|
74
|
+
expect(io.read_length_bytes(4)).to eql "\x01\x02\x03"
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -14,47 +14,47 @@ require 'cosmos/core_ext/exception'
|
|
14
14
|
describe Exception do
|
15
15
|
|
16
16
|
describe "formatted" do
|
17
|
-
it "
|
17
|
+
it "formats an Exception" do
|
18
18
|
begin
|
19
19
|
raise "My message"
|
20
20
|
rescue => err
|
21
|
-
err.formatted.
|
22
|
-
err.formatted.
|
21
|
+
expect(err.formatted).to match /RuntimeError : My message/
|
22
|
+
expect(err.formatted).to match /#{File.expand_path(__FILE__)}/
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "formats an Exception without RuntimeError class" do
|
27
27
|
begin
|
28
28
|
raise "My message"
|
29
29
|
rescue => err
|
30
|
-
err.formatted(true).
|
31
|
-
err.formatted(true).
|
32
|
-
err.formatted(true).
|
30
|
+
expect(err.formatted(true)).not_to match /RuntimeError/
|
31
|
+
expect(err.formatted(true)).to match /My message/
|
32
|
+
expect(err.formatted(true)).to match /#{File.expand_path(__FILE__)}/
|
33
33
|
end
|
34
34
|
|
35
35
|
# If it's not a RuntimeError then we should still see the class
|
36
36
|
begin
|
37
37
|
raise ArgumentError.new("My message")
|
38
38
|
rescue => err
|
39
|
-
err.formatted(true).
|
40
|
-
err.formatted(true).
|
41
|
-
err.formatted(true).
|
39
|
+
expect(err.formatted(true)).to match /ArgumentError/
|
40
|
+
expect(err.formatted(true)).to match /My message/
|
41
|
+
expect(err.formatted(true)).to match /#{File.expand_path(__FILE__)}/
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
45
|
+
it "formats an Exception without stack trace" do
|
46
46
|
begin
|
47
47
|
raise "My message"
|
48
48
|
rescue => err
|
49
|
-
err.formatted(false, false).
|
50
|
-
err.formatted(false, false).
|
49
|
+
expect(err.formatted(false, false)).to match /RuntimeError : My message/
|
50
|
+
expect(err.formatted(false, false)).not_to match /#{File.expand_path(__FILE__)}/
|
51
51
|
end
|
52
52
|
|
53
53
|
begin
|
54
54
|
raise "My message"
|
55
55
|
rescue => err
|
56
|
-
err.formatted(true, false).
|
57
|
-
err.formatted(true, false).
|
56
|
+
expect(err.formatted(true, false)).to match /My message/
|
57
|
+
expect(err.formatted(true, false)).not_to match /#{File.expand_path(__FILE__)}/
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -65,8 +65,8 @@ describe Exception do
|
|
65
65
|
line = __LINE__; raise "My message"
|
66
66
|
rescue => err
|
67
67
|
file, line = err.source
|
68
|
-
file.
|
69
|
-
line.
|
68
|
+
expect(file).to eql __FILE__
|
69
|
+
expect(line).to eql line
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -83,8 +83,8 @@ describe Exception do
|
|
83
83
|
file_name = "C:#{__FILE__}"
|
84
84
|
end
|
85
85
|
file, line = err.source
|
86
|
-
file.
|
87
|
-
line.
|
86
|
+
expect(file).to eql file_name
|
87
|
+
expect(line).to eql line
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
data/spec/core_ext/file_spec.rb
CHANGED
@@ -15,7 +15,7 @@ require 'tempfile'
|
|
15
15
|
describe File do
|
16
16
|
|
17
17
|
describe "is_ascii?" do
|
18
|
-
it "
|
18
|
+
it "returns true if a file only contains printable ASCII characters" do
|
19
19
|
tf = Tempfile.new('unittest')
|
20
20
|
(32..126).each do |val|
|
21
21
|
tf.puts(val.chr)
|
@@ -25,7 +25,7 @@ describe File do
|
|
25
25
|
tf.unlink
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "returns false if a file contains non-ASCII characters" do
|
29
29
|
tf = Tempfile.new('unittest')
|
30
30
|
(0..255).each do |val|
|
31
31
|
tf.puts(val.chr)
|
@@ -37,36 +37,36 @@ describe File do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "build_timestamped_filename" do
|
40
|
-
it "
|
40
|
+
it "formats the time" do
|
41
41
|
time = Time.now
|
42
42
|
timestamp = sprintf("%04u_%02u_%02u_%02u_%02u_%02u", time.year, time.month, time.mday, time.hour, time.min, time.sec)
|
43
|
-
File.build_timestamped_filename(nil,".txt",time).
|
43
|
+
expect(File.build_timestamped_filename(nil,".txt",time)).to match timestamp
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
47
|
-
File.build_timestamped_filename([]).
|
46
|
+
it "allows empty tags" do
|
47
|
+
expect(File.build_timestamped_filename([])).to match /\d\d\.txt/
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
51
|
-
File.build_timestamped_filename(nil).
|
50
|
+
it "allows nil tags" do
|
51
|
+
expect(File.build_timestamped_filename(nil)).to match /\d\d\.txt/
|
52
52
|
end
|
53
53
|
|
54
|
-
it "
|
55
|
-
File.build_timestamped_filename(['this','is','a','test']).
|
54
|
+
it "includes the tags" do
|
55
|
+
expect(File.build_timestamped_filename(['this','is','a','test'])).to match 'this_is_a_test'
|
56
56
|
end
|
57
57
|
|
58
|
-
it "
|
59
|
-
File.build_timestamped_filename(nil,".bin").
|
58
|
+
it "changes the extension" do
|
59
|
+
expect(File.build_timestamped_filename(nil,".bin")).to match ".bin"
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe "find_in_search_path" do
|
64
|
-
it "
|
65
|
-
File.find_in_search_path("cosmos.rb").
|
64
|
+
it "returns the path to the file" do
|
65
|
+
expect(File.find_in_search_path("cosmos.rb")).to match "/lib/cosmos.rb"
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
69
|
-
File.find_in_search_path("blah_blah_blah.rb").
|
68
|
+
it "returns nil if the file can't be found" do
|
69
|
+
expect(File.find_in_search_path("blah_blah_blah.rb")).to be_nil
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|