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/hash_spec.rb
CHANGED
@@ -14,11 +14,11 @@ require 'cosmos/core_ext/hash'
|
|
14
14
|
describe Hash do
|
15
15
|
|
16
16
|
describe "inspect" do
|
17
|
-
it "
|
17
|
+
it "limits the number of items to 10" do
|
18
18
|
hash = {'1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,'10'=>10}
|
19
|
-
hash.inspect.
|
19
|
+
expect(hash.inspect).to eql '{"1"=>1, "2"=>2, "3"=>3, "4"=>4, "5"=>5, "6"=>6, "7"=>7, "8"=>8, "9"=>9, "10"=>10}'
|
20
20
|
hash['11'] = 11
|
21
|
-
hash.inspect.
|
21
|
+
expect(hash.inspect).to match /#<Hash:\d+>/
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/spec/core_ext/io_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe IO do
|
|
21
21
|
@server.close
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "selects on read sockets" do
|
25
25
|
# Three different timeout values cause different code paths
|
26
26
|
|
27
27
|
socket = TCPSocket.open('localhost', 23456)
|
@@ -37,7 +37,7 @@ describe IO do
|
|
37
37
|
socket.close
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "selects on write sockets" do
|
41
41
|
socket = TCPSocket.open('localhost', 23456)
|
42
42
|
expect(IO.fast_write_select([socket], 0.5)).not_to be_nil
|
43
43
|
socket.close
|
data/spec/core_ext/math_spec.rb
CHANGED
@@ -15,102 +15,102 @@ include Math
|
|
15
15
|
describe Math do
|
16
16
|
|
17
17
|
describe "sin_squared" do
|
18
|
-
it "
|
19
|
-
sin_squared(10).
|
18
|
+
it "calculates sin squared" do
|
19
|
+
expect(sin_squared(10)).to be_within(0.00000001).of(sin(10)**2)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "cos_squared" do
|
24
|
-
it "
|
25
|
-
cos_squared(10).
|
24
|
+
it "calculates cos squared" do
|
25
|
+
expect(cos_squared(10)).to be_within(0.00000001).of(cos(10)**2)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "variance_population" do
|
30
|
-
it "
|
30
|
+
it "returns 0 if the same value" do
|
31
31
|
mean, var = variance_population([1,1,1,1])
|
32
|
-
mean.
|
33
|
-
var.
|
32
|
+
expect(mean).to eql 1.0
|
33
|
+
expect(var).to eql 0.0
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "returns population variance" do
|
37
37
|
mean, var = variance_population([1,2,3])
|
38
|
-
mean.
|
39
|
-
var.
|
38
|
+
expect(mean).to eql 2.0
|
39
|
+
expect(var).to eql 2.0/3.0
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "handles an empty data set" do
|
43
43
|
mean, var = variance_population([])
|
44
|
-
mean.
|
45
|
-
var.
|
44
|
+
expect(mean).to eql 0.0
|
45
|
+
expect(var).to eql 0.0
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "variance_sample" do
|
50
|
-
it "
|
50
|
+
it "returns 0 if the same value" do
|
51
51
|
mean, var = variance_sample([1,1,1,1])
|
52
|
-
mean.
|
53
|
-
var.
|
52
|
+
expect(mean).to eql 1.0
|
53
|
+
expect(var).to eql 0.0
|
54
54
|
end
|
55
55
|
|
56
|
-
it "
|
56
|
+
it "returns sample variance" do
|
57
57
|
mean, var = variance_sample([1,2,3])
|
58
|
-
mean.
|
59
|
-
var.
|
58
|
+
expect(mean).to eql 2.0
|
59
|
+
expect(var).to eql 1.0
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
62
|
+
it "handles an empty data set" do
|
63
63
|
mean, var = variance_sample([])
|
64
|
-
mean.
|
65
|
-
var.
|
64
|
+
expect(mean).to eql 0.0
|
65
|
+
expect(var).to eql 0.0
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
68
|
+
it "handles a single item data set" do
|
69
69
|
mean, var = variance_sample([1])
|
70
|
-
mean.
|
71
|
-
var.
|
70
|
+
expect(mean).to eql 1.0
|
71
|
+
expect(var).to eql 0.0
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "stddev_population" do
|
76
|
-
it "
|
76
|
+
it "returns 0 if the same value" do
|
77
77
|
mean, var = stddev_population([1,1,1,1])
|
78
|
-
mean.
|
79
|
-
var.
|
78
|
+
expect(mean).to eql 1.0
|
79
|
+
expect(var).to eql 0.0
|
80
80
|
end
|
81
81
|
|
82
|
-
it "
|
82
|
+
it "returns population stddev" do
|
83
83
|
mean, var = stddev_population([1,2,3])
|
84
|
-
mean.
|
85
|
-
var.
|
84
|
+
expect(mean).to eql 2.0
|
85
|
+
expect(var).to eql sqrt(2.0/3.0)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
describe "stddev_sample" do
|
90
|
-
it "
|
90
|
+
it "returns 0 if the same value" do
|
91
91
|
mean, var = stddev_sample([1,1,1,1])
|
92
|
-
mean.
|
93
|
-
var.
|
92
|
+
expect(mean).to eql 1.0
|
93
|
+
expect(var).to eql 0.0
|
94
94
|
end
|
95
95
|
|
96
|
-
it "
|
96
|
+
it "returns sample stddev" do
|
97
97
|
mean, var = stddev_sample([1,2,3])
|
98
|
-
mean.
|
99
|
-
var.
|
98
|
+
expect(mean).to eql 2.0
|
99
|
+
expect(var).to eql 1.0
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
describe "luma_from_rgb_max_255" do
|
104
|
-
it "
|
105
|
-
luma_from_rgb_max_255(0,0,0).
|
104
|
+
it "returns 0 with 0 RGB" do
|
105
|
+
expect(luma_from_rgb_max_255(0,0,0)).to eql 0.0
|
106
106
|
end
|
107
107
|
|
108
|
-
it "
|
109
|
-
luma_from_rgb_max_255(255,255,255).
|
108
|
+
it "returns 1.0 with 255 RGB" do
|
109
|
+
expect(luma_from_rgb_max_255(255,255,255)).to eql 1.0
|
110
110
|
end
|
111
111
|
|
112
|
-
it "
|
113
|
-
luma_from_rgb_max_255(127,127,127).
|
112
|
+
it "returns about 0.5 with 127 RGB" do
|
113
|
+
expect(luma_from_rgb_max_255(127,127,127)).to be_within(0.01).of(0.5)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -14,52 +14,52 @@ require 'cosmos/core_ext/matrix'
|
|
14
14
|
describe Matrix do
|
15
15
|
|
16
16
|
describe "[]" do
|
17
|
-
it "
|
17
|
+
it "returns an entire row" do
|
18
18
|
matrix = Matrix[[1,2,3],[4,5,6],[7,8,9]]
|
19
|
-
matrix[0].
|
20
|
-
matrix[1].
|
21
|
-
matrix[2].
|
19
|
+
expect(matrix[0]).to eql [1,2,3]
|
20
|
+
expect(matrix[1]).to eql [4,5,6]
|
21
|
+
expect(matrix[2]).to eql [7,8,9]
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "returns an element" do
|
25
25
|
matrix = Matrix[[1,2,3],[4,5,6],[7,8,9]]
|
26
|
-
matrix[0,0].
|
27
|
-
matrix[1,1].
|
28
|
-
matrix[2,2].
|
26
|
+
expect(matrix[0,0]).to eql 1
|
27
|
+
expect(matrix[1,1]).to eql 5
|
28
|
+
expect(matrix[2,2]).to eql 9
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "[]=" do
|
33
|
-
it "
|
33
|
+
it "sets an element" do
|
34
34
|
matrix = Matrix[[1,2,3],[4,5,6],[7,8,9]]
|
35
35
|
matrix[0,0] = -1
|
36
|
-
matrix[0,0].
|
36
|
+
expect(matrix[0,0]).to eql -1
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "rot" do
|
41
|
-
it "
|
42
|
-
Matrix.rot(:X, Math::PI / 2).
|
43
|
-
Matrix.rot(:X, 90).
|
44
|
-
Matrix.rot(:x, 90).
|
41
|
+
it "creates a rotation about x" do
|
42
|
+
expect(Matrix.rot(:X, Math::PI / 2)).to eql Matrix[[1,0,0],[0,cos(Math::PI / 2),sin(Math::PI / 2)],[0,-sin(Math::PI / 2),cos(Math::PI / 2)]]
|
43
|
+
expect(Matrix.rot(:X, 90)).to eql Matrix.rot(:x, 90)
|
44
|
+
expect(Matrix.rot(:x, 90)).to eql Matrix.rot(1, 90)
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
48
|
-
Matrix.rot(:Y, Math::PI / 2).
|
47
|
+
it "creates a rotation about y" do
|
48
|
+
expect(Matrix.rot(:Y, Math::PI / 2)).to eql Matrix[[cos(Math::PI / 2),0,-sin(Math::PI / 2)],[0,1,0],[sin(Math::PI / 2),0, cos(Math::PI / 2)]]
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
52
|
-
Matrix.rot(:Z, Math::PI / 2).
|
51
|
+
it "creates a rotation about z" do
|
52
|
+
expect(Matrix.rot(:Z, Math::PI / 2)).to eql Matrix[[cos(Math::PI / 2),sin(Math::PI / 2),0],[-sin(Math::PI / 2),cos(Math::PI / 2),0],[0,0,1]]
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
describe "trace" do
|
57
|
-
it "
|
58
|
-
Matrix[[1,2,3],[4,5,6],[7,8,9]].trace.
|
57
|
+
it "sums the diagonal" do
|
58
|
+
expect(Matrix[[1,2,3],[4,5,6],[7,8,9]].trace).to eql 15.0
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
62
|
-
Matrix[[1,2],[4,5],[7,8]].trace.
|
61
|
+
it "handles rectangular matrices" do
|
62
|
+
expect(Matrix[[1,2],[4,5],[7,8]].trace).to eql 6.0
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -14,16 +14,16 @@ require 'cosmos/core_ext/objectspace'
|
|
14
14
|
describe ObjectSpace do
|
15
15
|
|
16
16
|
describe "find" do
|
17
|
-
it "
|
18
|
-
ObjectSpace.find(Class).
|
19
|
-
ObjectSpace.find(Cosmos).
|
17
|
+
it "finds a class in the Ruby object space" do
|
18
|
+
expect(ObjectSpace.find(Class)).not_to be_nil
|
19
|
+
expect(ObjectSpace.find(Cosmos)).to be_nil
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "find_all" do
|
24
|
-
it "
|
25
|
-
ObjectSpace.find_all(Class).
|
26
|
-
ObjectSpace.find_all(Cosmos).
|
24
|
+
it "finds classes in the Ruby object space" do
|
25
|
+
expect(ObjectSpace.find_all(Class)).to be_a(Array)
|
26
|
+
expect(ObjectSpace.find_all(Cosmos)).to eql([])
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/spec/core_ext/range_spec.rb
CHANGED
@@ -14,8 +14,8 @@ require 'cosmos/core_ext/range'
|
|
14
14
|
describe Range do
|
15
15
|
|
16
16
|
describe "to_a_to_f" do
|
17
|
-
it "
|
18
|
-
(1..5).to_a_to_f.
|
17
|
+
it "converts a Range to an array of floats" do
|
18
|
+
expect((1..5).to_a_to_f).to eql [1.0,2.0,3.0,4.0,5.0]
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -13,10 +13,10 @@ require 'cosmos/core_ext/socket'
|
|
13
13
|
|
14
14
|
describe Socket do
|
15
15
|
describe "get_own_ip_address" do
|
16
|
-
it "
|
16
|
+
it "returns the ip address of the current machine" do
|
17
17
|
begin
|
18
18
|
Socket.get_own_ip_address
|
19
|
-
Socket.get_own_ip_address.
|
19
|
+
expect(Socket.get_own_ip_address).to match /\b(?:\d{1,3}\.){3}\d{1,3}\b/
|
20
20
|
rescue Resolv::ResolvError
|
21
21
|
# Oh well
|
22
22
|
end
|
@@ -24,9 +24,9 @@ describe Socket do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "lookup_hostname_from_ip" do
|
27
|
-
it "
|
27
|
+
it "returns the hostname for the ip address" do
|
28
28
|
ipaddr = Resolv.getaddress "www.ball.com"
|
29
|
-
Socket.lookup_hostname_from_ip(ipaddr).
|
29
|
+
expect(Socket.lookup_hostname_from_ip(ipaddr)).to match "ball.com"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -20,50 +20,50 @@ describe String do
|
|
20
20
|
@data = @data.pack('C*')
|
21
21
|
end
|
22
22
|
|
23
|
-
it "
|
24
|
-
@data.formatted.split("\n")[0].
|
25
|
-
@data.formatted.split("\n")[1].
|
23
|
+
it "uses 1 byte words" do
|
24
|
+
expect(@data.formatted.split("\n")[0]).to eql "00000000: 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 !\"#\$%&\'\(\)"
|
25
|
+
expect(@data.formatted.split("\n")[1]).to eql "00000010: 2A 2B 2C 2D 2E 2F *+,-./ "
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
29
|
-
@data.formatted(2, 8).
|
30
|
-
@data.formatted(2, 8).
|
28
|
+
it "uses 2 byte words" do
|
29
|
+
expect(@data.formatted(2, 8)).to match "00000000: 1A1B 1C1D 1E1F" # ...
|
30
|
+
expect(@data.formatted(2, 8)).to match "00000010: 2A2B 2C2D 2E2F"
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
34
|
-
@data.formatted(2, 4, '_').
|
35
|
-
@data.formatted(2, 4, '_').
|
36
|
-
@data.formatted(2, 4, '_').
|
33
|
+
it "changes the word separator" do
|
34
|
+
expect(@data.formatted(2, 4, '_')).to match "00000000: 1A1B_1C1D_1E1F_2021"
|
35
|
+
expect(@data.formatted(2, 4, '_')).to match "00000008: 2223_2425_2627_2829"
|
36
|
+
expect(@data.formatted(2, 4, '_')).to match "00000010: 2A2B_2C2D_2E2F"
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
40
|
-
@data.formatted(1, 16, ' ', 4).
|
39
|
+
it "indents the lines" do
|
40
|
+
expect(@data.formatted(1, 16, ' ', 4)).to match " 00000000: 1A 1B 1C 1D"
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
44
|
-
@data.formatted(1, 16, ' ', 0, false).
|
43
|
+
it "does not show the address" do
|
44
|
+
expect(@data.formatted(1, 16, ' ', 0, false)).to match "1A 1B 1C 1D"
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
48
|
-
@data.formatted(1, 16, ' ', 0, true, '= ').
|
47
|
+
it "changes the address separator" do
|
48
|
+
expect(@data.formatted(1, 16, ' ', 0, true, '= ')).to match "00000000= 1A 1B 1C 1D"
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
52
|
-
@data.formatted(1,16,'',0,true,'',true).
|
53
|
-
@data.formatted(1,16,'',0,true,'',false).
|
51
|
+
it "does not show the ASCII" do
|
52
|
+
expect(@data.formatted(1,16,'',0,true,'',true)).to match '29 !"#\$%&\'()'
|
53
|
+
expect(@data.formatted(1,16,'',0,true,'',false)).not_to match '29 !"#\$%&\'()'
|
54
54
|
end
|
55
55
|
|
56
|
-
it "
|
57
|
-
@data.formatted(1,16,'',0,true,'',true,'__').
|
56
|
+
it "changes the ASCII separator" do
|
57
|
+
expect(@data.formatted(1,16,'',0,true,'',true,'__')).to match '29__ !"#\$%&\'()'
|
58
58
|
end
|
59
59
|
|
60
|
-
it "
|
61
|
-
@data.formatted(1,16,'',0,true,'',true,'__','x').
|
60
|
+
it "changes the ASCII unprintable character" do
|
61
|
+
expect(@data.formatted(1,16,'',0,true,'',true,'__','x')).to match '29__xxxxxx !"#\$%&\'()'
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
65
|
-
@data.formatted(1,16,' ',0,true,': ',true,' ',' ', '~').split("~")[0].
|
66
|
-
@data.formatted(1,16,' ',0,true,': ',true,' ',' ', '~').split("~")[1].
|
64
|
+
it "changes the line separator" do
|
65
|
+
expect(@data.formatted(1,16,' ',0,true,': ',true,' ',' ', '~').split("~")[0]).to eql "00000000: 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 !\"#\$%&\'\(\)"
|
66
|
+
expect(@data.formatted(1,16,' ',0,true,': ',true,' ',' ', '~').split("~")[1]).to eql "00000010: 2A 2B 2C 2D 2E 2F *+,-./ "
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -74,69 +74,69 @@ describe String do
|
|
74
74
|
@data = @data.pack('C*')
|
75
75
|
end
|
76
76
|
|
77
|
-
it "
|
78
|
-
@data.simple_formatted.
|
77
|
+
it "formats the data" do
|
78
|
+
expect(@data.simple_formatted).to eql "1A1B1C1D1E1F202122232425262728292A2B2C2D2E2F"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
describe "remove_line" do
|
83
|
-
it "
|
83
|
+
it "removes the specified line" do
|
84
84
|
test = "this\nis\na\ntest"
|
85
|
-
test.remove_line(1).
|
86
|
-
test.
|
85
|
+
expect(test.remove_line(1)).to eql "is\na\ntest"
|
86
|
+
expect(test).to eql "this\nis\na\ntest"
|
87
87
|
end
|
88
88
|
|
89
|
-
it "
|
89
|
+
it "splits on the given separator" do
|
90
90
|
test = "thisXisXaXtest"
|
91
|
-
test.remove_line(4,'X').
|
91
|
+
expect(test.remove_line(4,'X')).to eql "thisXisXaX"
|
92
92
|
end
|
93
93
|
|
94
|
-
it "
|
94
|
+
it "does nothing if the line number isn't found" do
|
95
95
|
test = "thisXisXaXtest"
|
96
|
-
test.remove_line(5,'X').
|
96
|
+
expect(test.remove_line(5,'X')).to eql "thisXisXaXtest"
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
describe "num_lines" do
|
101
|
-
it "
|
101
|
+
it "counts the number of newlines" do
|
102
102
|
test = "this\nis\na\ntest"
|
103
|
-
test.num_lines.
|
103
|
+
expect(test.num_lines).to eql 4
|
104
104
|
end
|
105
105
|
|
106
|
-
it "
|
106
|
+
it "does not count trailing newlines" do
|
107
107
|
test = "this\nis\na\ntest\n"
|
108
|
-
test.num_lines.
|
108
|
+
expect(test.num_lines).to eql 4
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "remove_quotes" do
|
113
113
|
context "with single quotes" do
|
114
|
-
it "
|
114
|
+
it "removes leading and trailing single quotes" do
|
115
115
|
test = "'string'"
|
116
|
-
test.remove_quotes.
|
116
|
+
expect(test.remove_quotes).to eql "string"
|
117
117
|
end
|
118
118
|
|
119
|
-
it "
|
119
|
+
it "does not remove interior" do
|
120
120
|
test = "can't"
|
121
|
-
test.remove_quotes.
|
121
|
+
expect(test.remove_quotes).to eql "can't"
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
125
|
context "with double quotes" do
|
126
|
-
it "
|
126
|
+
it "removes leading and trailing" do
|
127
127
|
test = '"string"'
|
128
|
-
test.remove_quotes.
|
128
|
+
expect(test.remove_quotes).to eql "string"
|
129
129
|
end
|
130
130
|
|
131
|
-
it "
|
131
|
+
it "does not remove interior" do
|
132
132
|
test = 'say("HI")'
|
133
|
-
test.remove_quotes.
|
133
|
+
expect(test.remove_quotes).to eql 'say("HI")'
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
138
|
describe "is_float?" do
|
139
|
-
it "
|
139
|
+
it "returns true if it's a float" do
|
140
140
|
expect("hi".is_float?).to be false
|
141
141
|
expect("hi 5.5".is_float?).to be false
|
142
142
|
expect("5.5 hi".is_float?).to be false
|
@@ -148,7 +148,7 @@ describe String do
|
|
148
148
|
end
|
149
149
|
|
150
150
|
describe "is_int?" do
|
151
|
-
it "
|
151
|
+
it "returns true if it's an integer" do
|
152
152
|
expect("hi".is_int?).to be false
|
153
153
|
expect("hi 5".is_int?).to be false
|
154
154
|
expect("5 hi".is_int?).to be false
|
@@ -159,7 +159,7 @@ describe String do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
describe "is_hex?" do
|
162
|
-
it "
|
162
|
+
it "returns true if it's a hexadecimal number" do
|
163
163
|
expect("0x".is_hex?).to be false
|
164
164
|
expect("x5".is_hex?).to be false
|
165
165
|
expect("0xG".is_hex?).to be false
|
@@ -170,7 +170,7 @@ describe String do
|
|
170
170
|
end
|
171
171
|
|
172
172
|
describe "is_array?" do
|
173
|
-
it "
|
173
|
+
it "returns true if it's an array" do
|
174
174
|
expect("1,2,3,4".is_array?).to be false
|
175
175
|
expect("[1,2,3,4".is_array?).to be false
|
176
176
|
expect("1,2,3,4]".is_array?).to be false
|
@@ -181,42 +181,42 @@ describe String do
|
|
181
181
|
end
|
182
182
|
|
183
183
|
describe "convert_to_value" do
|
184
|
-
it "
|
185
|
-
"5.123E5".convert_to_value.
|
186
|
-
"5.123".convert_to_value.
|
184
|
+
it "converts a float" do
|
185
|
+
expect("5.123E5".convert_to_value).to eql 512300.0
|
186
|
+
expect("5.123".convert_to_value).to eql 5.123
|
187
187
|
end
|
188
188
|
|
189
|
-
it "
|
190
|
-
"12345".convert_to_value.
|
191
|
-
"0x1A".convert_to_value.
|
189
|
+
it "converts an integer" do
|
190
|
+
expect("12345".convert_to_value).to eql 12345
|
191
|
+
expect("0x1A".convert_to_value).to eql 0x1A
|
192
192
|
end
|
193
193
|
|
194
|
-
it "
|
195
|
-
"[0,1,2,3]".convert_to_value.
|
194
|
+
it "converts an array" do
|
195
|
+
expect("[0,1,2,3]".convert_to_value).to eql [0,1,2,3]
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
199
|
describe "hex_to_byte_string" do
|
200
|
-
it "
|
201
|
-
"0xABCD".hex_to_byte_string.
|
200
|
+
it "converts a hex string to binary bytes" do
|
201
|
+
expect("0xABCD".hex_to_byte_string).to eql "\xAB\xCD"
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
205
|
describe "class_name_to_filename" do
|
206
|
-
it "
|
207
|
-
"MyGreatClass".class_name_to_filename.
|
206
|
+
it "converts a class name to a filename" do
|
207
|
+
expect("MyGreatClass".class_name_to_filename).to eql "my_great_class.rb"
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
211
|
describe "filename_to_class_name" do
|
212
|
-
it "
|
213
|
-
"my_great_class.rb".filename_to_class_name.
|
212
|
+
it "converts a filename to a class name" do
|
213
|
+
expect("my_great_class.rb".filename_to_class_name).to eql "MyGreatClass"
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
217
|
describe "to_class" do
|
218
|
-
it "
|
219
|
-
"String".to_class.
|
218
|
+
it "returns the class for the string" do
|
219
|
+
expect("String".to_class).to eql String
|
220
220
|
end
|
221
221
|
end
|
222
222
|
end
|