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
@@ -21,29 +21,29 @@ module Cosmos
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "initialize" do
|
24
|
-
it "
|
24
|
+
it "initializes the instance variables" do
|
25
25
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "is not writeable if no write port given" do
|
29
29
|
i = TcpipServerInterface.new('nil','8889','nil','5','burst')
|
30
|
-
i.name.
|
31
|
-
i.write_allowed
|
32
|
-
i.write_raw_allowed
|
33
|
-
i.read_allowed
|
30
|
+
expect(i.name).to eql "Cosmos::TcpipServerInterface"
|
31
|
+
expect(i.write_allowed?).to be_falsey
|
32
|
+
expect(i.write_raw_allowed?).to be_falsey
|
33
|
+
expect(i.read_allowed?).to be_truthy
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "is not readable if no read port given" do
|
37
37
|
i = TcpipServerInterface.new('8888','nil','5','nil','burst')
|
38
|
-
i.name.
|
39
|
-
i.write_allowed
|
40
|
-
i.write_raw_allowed
|
41
|
-
i.read_allowed
|
38
|
+
expect(i.name).to eql "Cosmos::TcpipServerInterface"
|
39
|
+
expect(i.write_allowed?).to be_truthy
|
40
|
+
expect(i.write_raw_allowed?).to be_truthy
|
41
|
+
expect(i.read_allowed?).to be_falsey
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "connect, connected?, disconnect, bytes_read, bytes_written, num_clients, read_queue_size, write_queue_size" do
|
46
|
-
it "
|
46
|
+
it "calls forward to the TcpipServer" do
|
47
47
|
expect(@stream).to receive(:connected?).and_return(false, true, false)
|
48
48
|
expect(@stream).to receive(:connect)
|
49
49
|
expect(@stream).to receive(:disconnect)
|
@@ -56,62 +56,62 @@ module Cosmos
|
|
56
56
|
expect(@stream).to receive(:write_queue_size).and_return(50)
|
57
57
|
expect(@stream).to receive(:raw_logger_pair=) { nil }
|
58
58
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
59
|
-
i.connected
|
59
|
+
expect(i.connected?).to be_falsey
|
60
60
|
i.connect
|
61
|
-
i.connected
|
61
|
+
expect(i.connected?).to be_truthy
|
62
62
|
i.disconnect
|
63
|
-
i.connected
|
63
|
+
expect(i.connected?).to be_falsey
|
64
64
|
i.bytes_read = 1000
|
65
65
|
i.bytes_written = 2000
|
66
|
-
i.bytes_read.
|
67
|
-
i.bytes_written.
|
68
|
-
i.num_clients.
|
69
|
-
i.read_queue_size.
|
70
|
-
i.write_queue_size.
|
66
|
+
expect(i.bytes_read).to eql 10
|
67
|
+
expect(i.bytes_written).to eql 20
|
68
|
+
expect(i.num_clients).to eql 30
|
69
|
+
expect(i.read_queue_size).to eql 40
|
70
|
+
expect(i.write_queue_size).to eql 50
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "read" do
|
75
|
-
it "
|
75
|
+
it "counts the packets received" do
|
76
76
|
allow(@stream).to receive(:read) { Packet.new('','') }
|
77
77
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
78
|
-
i.read_count.
|
78
|
+
expect(i.read_count).to eql 0
|
79
79
|
i.read
|
80
|
-
i.read_count.
|
80
|
+
expect(i.read_count).to eql 1
|
81
81
|
i.read
|
82
|
-
i.read_count.
|
82
|
+
expect(i.read_count).to eql 2
|
83
83
|
end
|
84
84
|
|
85
|
-
it "
|
85
|
+
it "does not count nil packets" do
|
86
86
|
allow(@stream).to receive(:read) { nil }
|
87
87
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
88
|
-
i.read_count.
|
88
|
+
expect(i.read_count).to eql 0
|
89
89
|
i.read
|
90
|
-
i.read_count.
|
90
|
+
expect(i.read_count).to eql 0
|
91
91
|
i.read
|
92
|
-
i.read_count.
|
92
|
+
expect(i.read_count).to eql 0
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
describe "write" do
|
97
|
-
it "
|
97
|
+
it "complains if the server is not connected" do
|
98
98
|
expect(@stream).to receive(:connected?).and_return(false)
|
99
99
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
100
100
|
expect { i.write(Packet.new('','')) }.to raise_error(/Interface not connected/)
|
101
101
|
end
|
102
102
|
|
103
|
-
it "
|
103
|
+
it "counts the packets written" do
|
104
104
|
allow(@stream).to receive(:connected?).and_return(true)
|
105
105
|
allow(@stream).to receive(:write).with(kind_of(Packet))
|
106
106
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
107
|
-
i.write_count.
|
107
|
+
expect(i.write_count).to eql 0
|
108
108
|
i.write(Packet.new('',''))
|
109
|
-
i.write_count.
|
109
|
+
expect(i.write_count).to eql 1
|
110
110
|
i.write(Packet.new('',''))
|
111
|
-
i.write_count.
|
111
|
+
expect(i.write_count).to eql 2
|
112
112
|
end
|
113
113
|
|
114
|
-
it "
|
114
|
+
it "handles server exceptions and disconnect" do
|
115
115
|
allow(@stream).to receive(:connected?).and_return(true)
|
116
116
|
allow(@stream).to receive(:write).with(kind_of(Packet)).and_raise(RuntimeError.new("TEST"))
|
117
117
|
expect(@stream).to receive(:disconnect)
|
@@ -121,24 +121,24 @@ module Cosmos
|
|
121
121
|
end
|
122
122
|
|
123
123
|
describe "write_raw" do
|
124
|
-
it "
|
124
|
+
it "complains if the server is not connected" do
|
125
125
|
expect(@stream).to receive(:connected?).and_return(false)
|
126
126
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
127
127
|
expect { i.write_raw(Packet.new('','')) }.to raise_error(/Interface not connected/)
|
128
128
|
end
|
129
129
|
|
130
|
-
it "
|
130
|
+
it "counts the packets written" do
|
131
131
|
allow(@stream).to receive(:connected?).and_return(true)
|
132
132
|
allow(@stream).to receive(:write_raw).with(kind_of(String))
|
133
133
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
134
|
-
i.write_count.
|
134
|
+
expect(i.write_count).to eql 0
|
135
135
|
i.write_raw('')
|
136
|
-
i.write_count.
|
136
|
+
expect(i.write_count).to eql 1
|
137
137
|
i.write_raw('')
|
138
|
-
i.write_count.
|
138
|
+
expect(i.write_count).to eql 2
|
139
139
|
end
|
140
140
|
|
141
|
-
it "
|
141
|
+
it "handles server exceptions and disconnect" do
|
142
142
|
allow(@stream).to receive(:connected?).and_return(true)
|
143
143
|
allow(@stream).to receive(:write_raw).with(kind_of(String)).and_raise(RuntimeError.new("TEST"))
|
144
144
|
expect(@stream).to receive(:disconnect)
|
@@ -148,7 +148,7 @@ module Cosmos
|
|
148
148
|
end
|
149
149
|
|
150
150
|
describe "set_option" do
|
151
|
-
it "
|
151
|
+
it "sets the listen address for the tcpip_server" do
|
152
152
|
expect(@stream).to receive(:listen_address=).with('127.0.0.1')
|
153
153
|
i = TcpipServerInterface.new('8888','8889','5','5','burst')
|
154
154
|
i.set_option('LISTEN_ADDRESS', ['127.0.0.1'])
|
@@ -15,29 +15,29 @@ module Cosmos
|
|
15
15
|
|
16
16
|
describe UdpInterface do
|
17
17
|
describe "initialize" do
|
18
|
-
it "
|
18
|
+
it "initializes the instance variables" do
|
19
19
|
i = UdpInterface.new('localhost','8888','8889','8890','127.0.0.1','64','5','5')
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "is not writeable if no write port given" do
|
23
23
|
i = UdpInterface.new('localhost','nil','8889')
|
24
|
-
i.name.
|
25
|
-
i.write_allowed
|
26
|
-
i.write_raw_allowed
|
27
|
-
i.read_allowed
|
24
|
+
expect(i.name).to eql "Cosmos::UdpInterface"
|
25
|
+
expect(i.write_allowed?).to be_falsey
|
26
|
+
expect(i.write_raw_allowed?).to be_falsey
|
27
|
+
expect(i.read_allowed?).to be_truthy
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "is not readable if no read port given" do
|
31
31
|
i = UdpInterface.new('localhost','8888','nil')
|
32
|
-
i.name.
|
33
|
-
i.write_allowed
|
34
|
-
i.write_raw_allowed
|
35
|
-
i.read_allowed
|
32
|
+
expect(i.name).to eql "Cosmos::UdpInterface"
|
33
|
+
expect(i.write_allowed?).to be_truthy
|
34
|
+
expect(i.write_raw_allowed?).to be_truthy
|
35
|
+
expect(i.read_allowed?).to be_falsey
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "connect, connected?, disconnect" do
|
40
|
-
it "
|
40
|
+
it "creates a UdpWriteSocket and UdpReadSocket if both given" do
|
41
41
|
write = double("write")
|
42
42
|
expect(write).to receive(:closed?).and_return(false)
|
43
43
|
expect(write).to receive(:close)
|
@@ -47,44 +47,44 @@ module Cosmos
|
|
47
47
|
expect(UdpWriteSocket).to receive(:new).and_return(write)
|
48
48
|
expect(UdpReadSocket).to receive(:new).and_return(read)
|
49
49
|
i = UdpInterface.new('localhost','8888','8889')
|
50
|
-
i.connected
|
50
|
+
expect(i.connected?).to be_falsey
|
51
51
|
i.connect
|
52
|
-
i.connected
|
52
|
+
expect(i.connected?).to be_truthy
|
53
53
|
i.disconnect
|
54
|
-
i.connected
|
54
|
+
expect(i.connected?).to be_falsey
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "creates a UdpWriteSocket if write port given" do
|
58
58
|
write = double("write")
|
59
59
|
expect(write).to receive(:closed?).and_return(false)
|
60
60
|
expect(write).to receive(:close)
|
61
61
|
expect(UdpWriteSocket).to receive(:new).and_return(write)
|
62
62
|
expect(UdpReadSocket).to_not receive(:new)
|
63
63
|
i = UdpInterface.new('localhost','8888','nil')
|
64
|
-
i.connected
|
64
|
+
expect(i.connected?).to be_falsey
|
65
65
|
i.connect
|
66
|
-
i.connected
|
66
|
+
expect(i.connected?).to be_truthy
|
67
67
|
i.disconnect
|
68
|
-
i.connected
|
68
|
+
expect(i.connected?).to be_falsey
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "creates a UdpReadSocket if read port given" do
|
72
72
|
read = double("read")
|
73
73
|
expect(read).to receive(:closed?).and_return(false)
|
74
74
|
expect(read).to receive(:close)
|
75
75
|
expect(UdpWriteSocket).to_not receive(:new)
|
76
76
|
expect(UdpReadSocket).to receive(:new).and_return(read)
|
77
77
|
i = UdpInterface.new('localhost','nil','8889')
|
78
|
-
i.connected
|
78
|
+
expect(i.connected?).to be_falsey
|
79
79
|
i.connect
|
80
|
-
i.connected
|
80
|
+
expect(i.connected?).to be_truthy
|
81
81
|
i.disconnect
|
82
|
-
i.connected
|
82
|
+
expect(i.connected?).to be_falsey
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
describe "disconnect" do
|
87
|
-
it "
|
87
|
+
it "rescues IOError from close" do
|
88
88
|
write = double("write")
|
89
89
|
expect(write).to receive(:closed?).and_return(false)
|
90
90
|
expect(write).to receive(:close).and_raise(IOError)
|
@@ -94,24 +94,24 @@ module Cosmos
|
|
94
94
|
expect(UdpWriteSocket).to receive(:new).and_return(write)
|
95
95
|
expect(UdpReadSocket).to receive(:new).and_return(read)
|
96
96
|
i = UdpInterface.new('localhost','8888','8889')
|
97
|
-
i.connected
|
97
|
+
expect(i.connected?).to be_falsey
|
98
98
|
i.connect
|
99
|
-
i.connected
|
99
|
+
expect(i.connected?).to be_truthy
|
100
100
|
i.disconnect
|
101
|
-
i.connected
|
101
|
+
expect(i.connected?).to be_falsey
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "read" do
|
106
|
-
it "
|
106
|
+
it "stops the read thread if no read port given" do
|
107
107
|
i = UdpInterface.new('localhost','8888','nil')
|
108
108
|
thread = Thread.new { i.read }
|
109
109
|
sleep 0.1
|
110
|
-
thread.stop
|
110
|
+
expect(thread.stop?).to be_truthy
|
111
111
|
Cosmos.kill_thread(nil, thread)
|
112
112
|
end
|
113
113
|
|
114
|
-
it "
|
114
|
+
it "stops the read thread if there is an IOError" do
|
115
115
|
read = double("read")
|
116
116
|
allow(read).to receive(:read).and_raise(IOError)
|
117
117
|
expect(UdpReadSocket).to receive(:new).and_return(read)
|
@@ -119,55 +119,55 @@ module Cosmos
|
|
119
119
|
i.connect
|
120
120
|
thread = Thread.new { i.read }
|
121
121
|
sleep 0.1
|
122
|
-
thread.stop
|
122
|
+
expect(thread.stop?).to be_truthy
|
123
123
|
Cosmos.kill_thread(nil, thread)
|
124
124
|
end
|
125
125
|
|
126
|
-
it "
|
126
|
+
it "counts the packets received" do
|
127
127
|
read = double("read")
|
128
128
|
allow(read).to receive(:read) { "\x00\x01\x02\x03" }
|
129
129
|
expect(UdpReadSocket).to receive(:new).and_return(read)
|
130
130
|
i = UdpInterface.new('localhost','nil','8889')
|
131
131
|
i.connect
|
132
|
-
i.read_count.
|
133
|
-
i.bytes_read.
|
132
|
+
expect(i.read_count).to eql 0
|
133
|
+
expect(i.bytes_read).to eql 0
|
134
134
|
i.read
|
135
|
-
i.read_count.
|
136
|
-
i.bytes_read.
|
135
|
+
expect(i.read_count).to eql 1
|
136
|
+
expect(i.bytes_read).to eql 4
|
137
137
|
i.read
|
138
|
-
i.read_count.
|
139
|
-
i.bytes_read.
|
138
|
+
expect(i.read_count).to eql 2
|
139
|
+
expect(i.bytes_read).to eql 8
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
describe "write, write_raw" do
|
144
|
-
it "
|
144
|
+
it "complains if write_dest not given" do
|
145
145
|
i = UdpInterface.new('localhost','nil','8889')
|
146
146
|
expect { i.write(Packet.new('','')) }.to raise_error(/read only/)
|
147
147
|
expect { i.write_raw('') }.to raise_error(/read only/)
|
148
148
|
end
|
149
149
|
|
150
|
-
it "
|
150
|
+
it "complains if the server is not connected" do
|
151
151
|
i = UdpInterface.new('localhost','8888','nil')
|
152
152
|
expect { i.write(Packet.new('','')) }.to raise_error(/Interface not connected/)
|
153
153
|
expect { i.write_raw('') }.to raise_error(/Interface not connected/)
|
154
154
|
end
|
155
155
|
|
156
|
-
it "
|
156
|
+
it "counts the packets written" do
|
157
157
|
write = double("write")
|
158
158
|
expect(UdpWriteSocket).to receive(:new).and_return(write)
|
159
159
|
allow(write).to receive(:write)
|
160
160
|
i = UdpInterface.new('localhost','8888','nil')
|
161
161
|
i.connect
|
162
|
-
i.write_count.
|
162
|
+
expect(i.write_count).to eql 0
|
163
163
|
pkt = Packet.new('tgt','pkt')
|
164
164
|
pkt.buffer = "\x00\x01\x02\x03"
|
165
165
|
i.write(pkt)
|
166
|
-
i.write_count.
|
167
|
-
i.bytes_written.
|
166
|
+
expect(i.write_count).to eql 1
|
167
|
+
expect(i.bytes_written).to eql 4
|
168
168
|
i.write_raw(pkt.buffer)
|
169
|
-
i.write_count.
|
170
|
-
i.bytes_written.
|
169
|
+
expect(i.write_count).to eql 2
|
170
|
+
expect(i.bytes_written).to eql 8
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
@@ -28,82 +28,82 @@ module Cosmos
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "read" do
|
31
|
-
it "
|
31
|
+
it "reads less than the buffer size" do
|
32
32
|
file = BufferedFile.open(@filename, "rb") do |file|
|
33
|
-
file.read(8).
|
34
|
-
file.pos.
|
35
|
-
file.read(4).
|
36
|
-
file.pos.
|
37
|
-
file.read(1).
|
38
|
-
file.pos.
|
39
|
-
file.read(3).
|
40
|
-
file.pos.
|
41
|
-
file.read(16).
|
42
|
-
file.pos.
|
33
|
+
expect(file.read(8)).to eql DATA[0..7]
|
34
|
+
expect(file.pos).to eql 8
|
35
|
+
expect(file.read(4)).to eql DATA[8..11]
|
36
|
+
expect(file.pos).to eql 12
|
37
|
+
expect(file.read(1)).to eql DATA[12..12]
|
38
|
+
expect(file.pos).to eql 13
|
39
|
+
expect(file.read(3)).to eql DATA[13..15]
|
40
|
+
expect(file.pos).to eql 16
|
41
|
+
expect(file.read(16)).to eql DATA
|
42
|
+
expect(file.pos).to eql 32
|
43
43
|
expected_pos = 32
|
44
44
|
while (expected_pos < (2 * BufferedFile::BUFFER_SIZE))
|
45
|
-
file.read(16).
|
45
|
+
expect(file.read(16)).to eql DATA
|
46
46
|
expected_pos += 16
|
47
|
-
file.pos.
|
47
|
+
expect(file.pos).to eql expected_pos
|
48
48
|
end
|
49
|
-
file.read(1).
|
49
|
+
expect(file.read(1)).to be_nil
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "reads equal to the buffer size" do
|
54
54
|
file = BufferedFile.open(@filename, "rb") do |file|
|
55
|
-
file.read(BufferedFile::BUFFER_SIZE).
|
56
|
-
file.pos.
|
57
|
-
file.read(BufferedFile::BUFFER_SIZE).
|
58
|
-
file.pos.
|
59
|
-
file.read(BufferedFile::BUFFER_SIZE).
|
55
|
+
expect(file.read(BufferedFile::BUFFER_SIZE)).to eql(DATA * (BufferedFile::BUFFER_SIZE / DATA.length))
|
56
|
+
expect(file.pos).to eql BufferedFile::BUFFER_SIZE
|
57
|
+
expect(file.read(BufferedFile::BUFFER_SIZE)).to eql(DATA * (BufferedFile::BUFFER_SIZE / DATA.length))
|
58
|
+
expect(file.pos).to eql BufferedFile::BUFFER_SIZE * 2
|
59
|
+
expect(file.read(BufferedFile::BUFFER_SIZE)).to be_nil
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "reads greater than the buffer size" do
|
64
64
|
file = BufferedFile.open(@filename, "rb") do |file|
|
65
|
-
file.read(BufferedFile::BUFFER_SIZE + 1).
|
66
|
-
file.pos.
|
67
|
-
file.read(BufferedFile::BUFFER_SIZE + 1).
|
68
|
-
file.pos.
|
69
|
-
file.read(BufferedFile::BUFFER_SIZE + 1).
|
65
|
+
expect(file.read(BufferedFile::BUFFER_SIZE + 1)).to eql(DATA * (BufferedFile::BUFFER_SIZE / DATA.length) << DATA[0..0])
|
66
|
+
expect(file.pos).to eql BufferedFile::BUFFER_SIZE + 1
|
67
|
+
expect(file.read(BufferedFile::BUFFER_SIZE + 1)).to eql((DATA * (BufferedFile::BUFFER_SIZE / DATA.length))[1..-1])
|
68
|
+
expect(file.pos).to eql BufferedFile::BUFFER_SIZE * 2
|
69
|
+
expect(file.read(BufferedFile::BUFFER_SIZE + 1)).to be_nil
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "seek" do
|
75
|
-
it "
|
75
|
+
it "has reads still work afterwards" do
|
76
76
|
file = BufferedFile.open(@filename, "rb") do |file|
|
77
|
-
file.read(8).
|
78
|
-
file.pos.
|
77
|
+
expect(file.read(8)).to eql DATA[0..7]
|
78
|
+
expect(file.pos).to eql 8
|
79
79
|
file.seek(4, IO::SEEK_CUR)
|
80
|
-
file.pos.
|
81
|
-
file.read(1).
|
82
|
-
file.pos.
|
83
|
-
file.read(3).
|
84
|
-
file.pos.
|
80
|
+
expect(file.pos).to eql 12
|
81
|
+
expect(file.read(1)).to eql DATA[12..12]
|
82
|
+
expect(file.pos).to eql 13
|
83
|
+
expect(file.read(3)).to eql DATA[13..15]
|
84
|
+
expect(file.pos).to eql 16
|
85
85
|
file.seek(0, IO::SEEK_SET)
|
86
|
-
file.pos.
|
87
|
-
file.read(8).
|
88
|
-
file.pos.
|
86
|
+
expect(file.pos).to eql 0
|
87
|
+
expect(file.read(8)).to eql DATA[0..7]
|
88
|
+
expect(file.pos).to eql 8
|
89
89
|
file.seek(0, IO::SEEK_END)
|
90
|
-
file.pos.
|
90
|
+
expect(file.pos).to eql (2 * BufferedFile::BUFFER_SIZE)
|
91
91
|
file.seek(-16, IO::SEEK_END)
|
92
|
-
file.pos.
|
93
|
-
file.read(4).
|
94
|
-
file.pos.
|
92
|
+
expect(file.pos).to eql ((2 * BufferedFile::BUFFER_SIZE) - 16)
|
93
|
+
expect(file.read(4)).to eql DATA[0..3]
|
94
|
+
expect(file.pos).to eql ((2 * BufferedFile::BUFFER_SIZE) - 12)
|
95
95
|
file.seek(4, IO::SEEK_CUR)
|
96
|
-
file.pos.
|
96
|
+
expect(file.pos).to eql ((2 * BufferedFile::BUFFER_SIZE) - 8)
|
97
97
|
file.seek(0, IO::SEEK_SET)
|
98
|
-
file.pos.
|
99
|
-
file.read(8).
|
100
|
-
file.pos.
|
98
|
+
expect(file.pos).to eql 0
|
99
|
+
expect(file.read(8)).to eql DATA[0..7]
|
100
|
+
expect(file.pos).to eql 8
|
101
101
|
file.seek(4, IO::SEEK_CUR)
|
102
|
-
file.pos.
|
103
|
-
file.read(1).
|
104
|
-
file.pos.
|
105
|
-
file.read(3).
|
106
|
-
file.pos.
|
102
|
+
expect(file.pos).to eql 12
|
103
|
+
expect(file.read(1)).to eql DATA[12..12]
|
104
|
+
expect(file.pos).to eql 13
|
105
|
+
expect(file.read(3)).to eql DATA[13..15]
|
106
|
+
expect(file.pos).to eql 16
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|