From 2eadd8e18675c8b8f167589ebc8ea7038690854b Mon Sep 17 00:00:00 2001 From: Thomas Brain Date: Tue, 3 Sep 2024 14:58:15 -0500 Subject: [PATCH] In honor of "Change Spaces To Tabs Day", circa 2009 --- CMakeTestFiles/TestICGLinkedLibs.cpp | 34 +- test/SIM_anon_enum/models/starter.cpp | 4 +- .../models/Foo.cpp | 2 +- .../models/empty.cpp | 2 +- .../models/starter.cpp | 6 +- .../src/InputProcessSimObject.cpp | 32 +- .../models/ExtLibDir.cpp | 2 +- test/SIM_exclusion_mechanisms/models/Foo.cpp | 4 +- .../models/ext_lib_dir/ExtLibDir.cpp | 2 +- .../real/ext_lib_dir/ExtLibDir.cpp | 2 +- .../real/ext_lib_dir/ExtLibDir.cpp | 2 +- .../models/ttvtest.cpp | 28 +- test/SIM_isystem/models/my_code/Foo.cpp | 4 +- .../models/third_party/Warning.cpp | 2 +- test/SIM_job_class_order/models/starter.cpp | 94 +- test/SIM_leaks/models/Leaker/Leaker.cpp | 44 +- test/SIM_parse_s_define/models/Classes.cpp | 2 +- .../src/ExampleSegments.cpp | 54 +- .../models/SegmentedExecutive/src/Segment.cpp | 54 +- .../src/SegmentedExecutive.cpp | 396 +- test/SIM_stls/models/STLCheckpoint.cpp | 1504 ++++---- .../models/many/a.cpp | 2 +- .../models/many/b.cpp | 2 +- .../models/many/c.cpp | 2 +- .../models/nested/x.cpp | 2 +- .../models/nested/y/y.cpp | 2 +- .../models/nested/z/z.cpp | 2 +- .../models/one/1.cpp | 2 +- test/SIM_test_dr/models/dr/src/DR.cpp | 22 +- .../models/dr/src/DR_default_data.cpp | 168 +- .../models/test_ip/src/ClassOfEverything.cpp | 24 +- test/SIM_test_output_dir/models/starter.cpp | 88 +- .../models/test_client/test_client.cpp | 2454 ++++++------- .../models/test_client/test_client_err1.cpp | 16 +- .../models/test_client/test_client_err2.cpp | 16 +- .../models/varserv/src/VS.cpp | 132 +- .../models/threads/src/Thread1.cpp | 40 +- .../models/threads/src/Thread2.cpp | 102 +- .../models/threads/src/Thread3.cpp | 96 +- .../Cannon/models/httpMethods/TimeSession.cpp | 88 +- .../ODE/SIM_ode_ball/models/Ball/Ball.cpp | 126 +- .../ODE/SIM_ode_buggy/models/Buggy/Buggy.cpp | 396 +- trick_sims/ODE/models/DrawStuff/DrawStuff.cpp | 74 +- .../ODE/models/DrawStuff/DrawStuffObject.cpp | 12 +- .../ROS/models/ros_comm/ros_framework.cpp | 22 +- .../ROS/models/ros_comm/ros_publish.cpp | 50 +- .../ROS/models/ros_comm/ros_subscribe.cpp | 24 +- .../SIM_Ball++_L1/RUN_cpp_input/input.cpp | 118 +- trick_sims/SIM_Ball++_L1/models/Ball.cpp | 56 +- trick_sims/SIM_Ball++_L1/models/BallForce.cpp | 16 +- .../SIM_Ball++_L1/models/BallForceField.cpp | 92 +- .../models/BallForce_default_data.cpp | 62 +- .../SIM_Ball++_L1/models/BallShutdown.cpp | 54 +- trick_sims/SIM_Ball++_L1/models/BallState.cpp | 66 +- .../SIM_Ball++_L1/models/BallStateDeriv.cpp | 92 +- .../SIM_Ball++_L1/models/BallStateInit.cpp | 70 +- .../SIM_Ball++_L1/models/BallStateInteg.cpp | 116 +- .../SIM_Ball++_L1/models/BallStatePrint.cpp | 66 +- .../models/BallState_default_data.cpp | 68 +- .../models/Aircraft/src/Aircraft.cpp | 412 +-- .../models/Aircraft/src/Waypoint.cpp | 160 +- .../models/balloon/src/Balloon.cpp | 230 +- .../models/graphics/cpp/Socket.cpp | 88 +- .../models/graphics/cpp/main.cpp | 1520 ++++---- .../models/pool_table/src/ball.cpp | 76 +- .../models/pool_table/src/bumper.cpp | 30 +- .../models/pool_table/src/pool_table.cpp | 912 ++--- .../SIM_contact/models/contact/src/Ball.cpp | 34 +- .../models/contact/src/Contact.cpp | 236 +- .../fibonacci_time/src/Fibonacci_time.cpp | 86 +- .../PIDController/src/PIDController.cpp | 120 +- .../SIM_lander/models/lander/src/Lander.cpp | 344 +- trick_sims/SIM_msd/models/msd/src/msd.cpp | 28 +- .../models/msd/src/msd_default_data.cpp | 30 +- .../SIM_msd/models/msd/src/msd_deriv.cpp | 20 +- .../SIM_msd/models/msd/src/msd_init.cpp | 22 +- .../SIM_msd/models/msd/src/msd_integ.cpp | 48 +- .../SIM_msd/models/msd/src/msd_shutdown.cpp | 26 +- .../models/parachute/src/Parachutist.cpp | 178 +- .../models/parachute/src/interpolate.cpp | 40 +- .../models/rocket/src/Environment.cpp | 12 +- .../SIM_rocket/models/rocket/src/Motor.cpp | 72 +- .../SIM_rocket/models/rocket/src/Rocket.cpp | 124 +- .../models/satellite/src/Satellite.cpp | 56 +- .../models/Satellite/graphics/Camera.cpp | 40 +- .../models/Satellite/graphics/Scene.cpp | 300 +- .../Satellite/graphics/SceneElement.cpp | 148 +- .../models/Satellite/src/Planet.cpp | 14 +- .../models/Satellite/src/SatGraphicsComm.cpp | 114 +- .../models/Satellite/src/Satellite.cpp | 386 +- .../models/Satellite/src/Thruster.cpp | 44 +- .../CrewModule/src/CrewModuleDynamics.cpp | 378 +- .../models/CrewModule/src/CrewModuleShape.cpp | 106 +- .../models/submarine/src/Submarine.cpp | 208 +- .../models/Battery/src/DCBattery.cpp | 26 +- .../models/Battery/test/DCBatteryTest.cpp | 72 +- .../models/Control/src/PIDController.cpp | 120 +- .../src/differentialDriveController.cpp | 136 +- .../models/Control/src/vehicleController.cpp | 124 +- .../test/DifferentialDriveControllerTest.cpp | 244 +- .../Control/test/VehicleControllerTest.cpp | 96 +- .../Electrical/src/ElectricalCircuit.cpp | 26 +- .../models/Guidance/src/arena.cpp | 340 +- .../models/Guidance/src/findpath.cpp | 218 +- .../models/Guidance/src/navigator.cpp | 76 +- .../models/Guidance/test/ArenaTest.cpp | 542 +-- .../models/Guidance/test/FindPathTest.cpp | 414 +-- .../models/Guidance/test/NavigatorTest.cpp | 218 +- .../SIM_wheelbot/models/Motor/src/DCMotor.cpp | 42 +- .../Motor/src/DCMotorSpeedController.cpp | 38 +- .../SIM_wheelbot/models/Motor/src/Motor.cpp | 8 +- .../SIM_wheelbot/models/Motor/src/PWM.cpp | 38 +- .../models/Motor/src/ServoMotor.cpp | 56 +- .../models/Motor/src/ServoSpeedController.cpp | 106 +- .../models/Motor/test/DCMotorTest.cpp | 108 +- .../test/DifferentialDriveControllerTest.cpp | 244 +- .../Motor/test/test/VehicleControllerTest.cpp | 96 +- .../models/Vehicle/src/vehicleOne.cpp | 404 +- .../ClassTemplateVisitor.cpp | 168 +- .../Interface_Code_Gen/ClassValues.cpp | 448 +-- .../Interface_Code_Gen/ClassVisitor.cpp | 794 ++-- .../Interface_Code_Gen/CommentSaver.cpp | 474 +-- .../Interface_Code_Gen/ConstructValues.cpp | 374 +- .../codegen/Interface_Code_Gen/EnumValues.cpp | 56 +- .../Interface_Code_Gen/EnumVisitor.cpp | 128 +- .../Interface_Code_Gen/FieldDescription.cpp | 930 ++--- .../Interface_Code_Gen/FieldVisitor.cpp | 1142 +++--- .../Interface_Code_Gen/FindTrickICG.cpp | 276 +- .../Interface_Code_Gen/HeaderSearchDirs.cpp | 676 ++-- .../Interface_Code_Gen/ICGASTConsumer.cpp | 22 +- .../ICGDiagnosticConsumer.cpp | 54 +- .../Interface_Code_Gen/PrintAttributes.cpp | 1154 +++--- .../PrintFileContents10.cpp | 712 ++-- .../PrintFileContentsBase.cpp | 136 +- .../TranslationUnitVisitor.cpp | 276 +- .../Interface_Code_Gen/TypedefVisitor.cpp | 246 +- .../codegen/Interface_Code_Gen/Utilities.cpp | 384 +- .../Interface_Code_Gen/VariableVisitor.cpp | 162 +- .../codegen/Interface_Code_Gen/main.cpp | 588 +-- .../data_products/Apps/Trk2csv/trk2ascii.cpp | 460 +-- .../Apps/trkConvert/CSV_Formatter.cpp | 44 +- .../Apps/trkConvert/DocWindow.cpp | 300 +- .../Apps/trkConvert/ParamDescription.cpp | 44 +- .../Apps/trkConvert/TRK_DataLog.cpp | 438 +-- .../Apps/trkConvert/VarTableWidget.cpp | 162 +- .../Apps/trkConvert/Varlist_Formatter.cpp | 46 +- .../data_products/Apps/trkConvert/main.cpp | 124 +- .../DPX/APPS/FXPLOT/curve_view_node.cpp | 440 +-- .../DPX/APPS/FXPLOT/fermi_view.cpp | 504 +-- .../data_products/DPX/APPS/FXPLOT/fxplot.cpp | 1306 +++---- .../DPX/APPS/FXPLOT/page_view_node.cpp | 1010 ++--- .../DPX/APPS/FXPLOT/plot_view_node.cpp | 1002 ++--- .../DPX/APPS/FXPLOT/product_view_node.cpp | 128 +- .../DPX/APPS/FXPLOT/table_view_node.cpp | 768 ++-- .../DPX/APPS/GXPLOT/gp_colors.cpp | 1780 ++++----- .../DPX/APPS/GXPLOT/gp_utilities.cpp | 570 +-- .../DPX/APPS/GXPLOT/gp_version.cpp | 84 +- .../data_products/DPX/APPS/GXPLOT/gp_view.cpp | 356 +- .../DPX/APPS/GXPLOT/gp_view_curve_node.cpp | 502 +-- .../DPX/APPS/GXPLOT/gp_view_page_node.cpp | 1718 ++++----- .../DPX/APPS/GXPLOT/gp_view_plot_node.cpp | 584 +-- .../DPX/APPS/GXPLOT/gp_view_product_node.cpp | 30 +- .../data_products/DPX/APPS/GXPLOT/gxplot.cpp | 210 +- .../DPX/DPC/DPC_TimeCstrDataStream.cpp | 150 +- .../DPX/DPC/DPC_UnitConvDataStream.cpp | 264 +- .../DPX/DPC/DPC_datastream_supplier.cpp | 156 +- .../data_products/DPX/DPC/DPC_delta_curve.cpp | 420 +-- .../data_products/DPX/DPC/DPC_delta_plot.cpp | 278 +- .../data_products/DPX/DPC/DPC_page.cpp | 350 +- .../data_products/DPX/DPC/DPC_plot.cpp | 200 +- .../data_products/DPX/DPC/DPC_product.cpp | 390 +- .../DPX/DPC/DPC_standard_plot.cpp | 112 +- .../data_products/DPX/DPC/DPC_std_curve.cpp | 500 +-- .../data_products/DPX/DPC/DPC_table.cpp | 560 +-- .../data_products/DPX/DPM/DPM_attribute.cpp | 34 +- .../data_products/DPX/DPM/DPM_axis.cpp | 184 +- .../data_products/DPX/DPM/DPM_column.cpp | 210 +- .../data_products/DPX/DPM/DPM_component.cpp | 106 +- .../data_products/DPX/DPM/DPM_curve.cpp | 566 +-- .../data_products/DPX/DPM/DPM_extfn.cpp | 206 +- .../data_products/DPX/DPM/DPM_inputs.cpp | 180 +- .../data_products/DPX/DPM/DPM_measurement.cpp | 192 +- .../data_products/DPX/DPM/DPM_outputs.cpp | 174 +- .../data_products/DPX/DPM/DPM_page.cpp | 246 +- .../data_products/DPX/DPM/DPM_parse_tree.cpp | 136 +- .../data_products/DPX/DPM/DPM_product.cpp | 346 +- .../data_products/DPX/DPM/DPM_relation.cpp | 548 +-- .../data_products/DPX/DPM/DPM_run.cpp | 118 +- .../data_products/DPX/DPM/DPM_session.cpp | 412 +-- .../data_products/DPX/DPM/DPM_table.cpp | 276 +- .../DPX/DPM/DPM_time_constraints.cpp | 118 +- .../data_products/DPX/DPM/DPM_var.cpp | 212 +- .../DPX/DPV/UTILS/DPV_textbuffer.cpp | 226 +- .../data_products/DPX/DPV/UTILS/tbtest.cpp | 32 +- .../DPX/TESTING/DPC_TEST/ctrl_test.cpp | 158 +- .../DPX/TESTING/DPC_TEST/test_view.cpp | 430 +-- .../DPX/TESTING/DPM_TEST/model_test.cpp | 80 +- .../data_products/DPX/TESTING/DS/dstest.cpp | 36 +- .../DPX/TESTING/DS_exercisor/DS_exercisor.cpp | 148 +- .../DPX/TESTING/TCDS/tcdstest.cpp | 52 +- .../data_products/DPX/TESTING/UDS/udstest.cpp | 40 +- .../DPX/test/unit_test/DPC_test.cpp | 1698 ++++----- .../DPX/test/unit_test/DPM_test.cpp | 420 +-- .../DPX/test/unit_test/DS_test.cpp | 754 ++-- .../DPX/test/unit_test/test_view.cpp | 488 +-- trick_source/data_products/Log/Csv.cpp | 324 +- trick_source/data_products/Log/DataStream.cpp | 40 +- .../data_products/Log/DataStreamFactory.cpp | 324 +- .../data_products/Log/DataStreamGroup.cpp | 564 +-- trick_source/data_products/Log/Delta.cpp | 110 +- .../data_products/Log/ExternalProgram.cpp | 216 +- trick_source/data_products/Log/MatLab.cpp | 1802 ++++----- trick_source/data_products/Log/MatLab4.cpp | 776 ++-- .../data_products/Log/TrickBinary.cpp | 1030 +++--- trick_source/data_products/Log/TrickHDF5.cpp | 374 +- trick_source/data_products/Log/log.cpp | 3262 ++++++++--------- trick_source/data_products/Log/multiLog.cpp | 316 +- .../data_products/Log/parseLogHeader.cpp | 352 +- .../data_products/Log/trick_byteswap.cpp | 186 +- trick_source/data_products/Var/var.cpp | 1620 ++++---- .../data_products/units/init_units_system.cpp | 28 +- .../CheckPointAgent/CheckPointAgent.cpp | 56 +- .../CheckPointAgent/ChkPtParseContext.cpp | 42 +- .../ClassicCheckPointerAgent.cpp | 2086 +++++------ .../CheckPointAgent/PythonPrint.cpp | 718 ++-- .../CheckPointRestart/CheckPointRestart.cpp | 598 +-- .../CheckPointRestart_c_intf.cpp | 266 +- .../CheckPointRestart/next_attr_name.cpp | 22 +- .../stl_type_name_convert.cpp | 20 +- trick_source/sim_services/Clock/Clock.cpp | 152 +- .../sim_services/Clock/GetTimeOfDayClock.cpp | 100 +- .../sim_services/Clock/clock_c_intf.cpp | 38 +- .../sim_services/Clock/test/Clocks_test.cpp | 34 +- .../Clock/test/GetTimeOfDayClock_test.cpp | 218 +- .../Clock/test/exec_get_rt_nap_stub.cpp | 4 +- trick_source/sim_services/Collect/collect.cpp | 164 +- .../CommandLineArguments.cpp | 552 +-- .../command_line_c_intf.cpp | 144 +- .../test/create_path_test.cpp | 148 +- .../sim_services/DataRecord/DRAscii.cpp | 426 +-- .../sim_services/DataRecord/DRBinary.cpp | 330 +- .../sim_services/DataRecord/DRHDF5.cpp | 574 +-- .../DataRecord/DataRecordDispatcher.cpp | 450 +-- .../DataRecord/DataRecordGroup.cpp | 1532 ++++---- .../DataRecord/data_record_utilities.cpp | 128 +- .../sim_services/DataTypes/src/AllocInfo.cpp | 724 ++-- .../DataTypes/src/ArrayDataType.cpp | 600 +-- .../DataTypes/src/BitfieldStructMember.cpp | 46 +- .../DataTypes/src/ClassicChkPtAgent.cpp | 716 ++-- .../DataTypes/src/CompositeDataType.cpp | 572 +-- .../DataTypes/src/CompositeValue.cpp | 86 +- .../sim_services/DataTypes/src/DataType.cpp | 58 +- .../DataTypes/src/EnumDataType.cpp | 314 +- .../DataTypes/src/EnumDictionary.cpp | 64 +- .../sim_services/DataTypes/src/Enumerator.cpp | 40 +- .../DataTypes/src/FloatingPointValue.cpp | 40 +- .../DataTypes/src/IntegerValue.cpp | 40 +- .../DataTypes/src/LexicalAnalyzer.cpp | 264 +- .../sim_services/DataTypes/src/MemMgr.cpp | 654 ++-- .../DataTypes/src/NormalStructMember.cpp | 236 +- .../DataTypes/src/ParsedDeclaration.cpp | 488 +-- .../DataTypes/src/PointerDataType.cpp | 346 +- .../DataTypes/src/PointerValue.cpp | 32 +- .../DataTypes/src/PrimitiveDataType.cpp | 174 +- .../DataTypes/src/StaticStructMember.cpp | 234 +- .../DataTypes/src/StringValue.cpp | 14 +- .../DataTypes/src/StructMember.cpp | 16 +- .../DataTypes/src/TypeDictionary.cpp | 150 +- .../DataTypes/testing/AllocInfoTest.cpp | 258 +- .../DataTypes/testing/ArrayTypeSpecTest.cpp | 744 ++-- .../testing/ClassicChkPtAgentTest.cpp | 612 ++-- .../DataTypes/testing/CompTypeSpecTest.cpp | 428 +-- .../DataTypes/testing/DataTypeTestSupport.cpp | 228 +- .../DataTypes/testing/EnumDeclarationTest.cpp | 284 +- .../DataTypes/testing/EnumTypeSpecTest.cpp | 244 +- .../DataTypes/testing/LexicalAnalyzerTest.cpp | 64 +- .../testing/ParsedDeclarationTest.cpp | 156 +- .../DataTypes/testing/PointerTypeSpecTest.cpp | 342 +- .../DataTypes/testing/PrimTypeSpecTest.cpp | 674 ++-- .../DataTypes/testing/TypeDictionaryTest.cpp | 168 +- .../sim_services/DebugPause/DebugPause.cpp | 118 +- .../DebugPause/DebugPause_c_intf.cpp | 56 +- .../sim_services/EchoJobs/EchoJobs.cpp | 84 +- .../sim_services/EchoJobs/EchoJobs_c_intf.cpp | 46 +- .../sim_services/Environment/Environment.cpp | 60 +- .../Environment/Environment_c_intf.cpp | 90 +- .../EventManager/EventInstrument.cpp | 18 +- .../EventManager/EventManager.cpp | 502 +-- .../EventManager/EventManager_c_intf.cpp | 70 +- .../EventManager/EventProcessor.cpp | 170 +- .../sim_services/Executive/Executive.cpp | 568 +-- .../Executive/ExecutiveException.cpp | 24 +- .../Executive_add_depends_on_job.cpp | 84 +- .../Executive/Executive_add_jobs_to_queue.cpp | 368 +- .../Executive_add_scheduled_job_class.cpp | 34 +- .../Executive/Executive_add_sim_object.cpp | 70 +- .../Executive/Executive_advance_sim_time.cpp | 134 +- .../Executive/Executive_c_intf.cpp | 1764 ++++----- .../Executive/Executive_call_default_data.cpp | 68 +- .../Executive_call_initialization.cpp | 56 +- .../Executive_call_input_processor.cpp | 70 +- .../Executive_check_all_job_cycle_times.cpp | 120 +- .../Executive_check_all_jobs_handled.cpp | 64 +- .../Executive/Executive_checkpoint.cpp | 54 +- .../Executive_clear_scheduled_queues.cpp | 62 +- .../Executive/Executive_create_threads.cpp | 44 +- .../Executive/Executive_fpe_handler.cpp | 140 +- .../Executive/Executive_freeze.cpp | 124 +- .../Executive/Executive_freeze_loop.cpp | 188 +- .../Executive/Executive_get_curr_job.cpp | 18 +- .../Executive/Executive_get_job.cpp | 34 +- .../Executive/Executive_get_job_cycle.cpp | 24 +- .../Executive/Executive_get_process_id.cpp | 28 +- .../Executive/Executive_get_sim_time.cpp | 68 +- .../sim_services/Executive/Executive_init.cpp | 120 +- .../Executive_init_freeze_scheduled.cpp | 24 +- .../Executive_init_signal_handlers.cpp | 316 +- .../Executive/Executive_instrument_job.cpp | 208 +- .../Executive_isThreadReadyToRun.cpp | 64 +- .../sim_services/Executive/Executive_loop.cpp | 106 +- .../Executive/Executive_loop_multi_thread.cpp | 418 +-- .../Executive_loop_single_thread.cpp | 220 +- .../Executive/Executive_post_checkpoint.cpp | 16 +- .../Executive/Executive_process_sim_args.cpp | 124 +- .../Executive_register_scheduler.cpp | 12 +- .../Executive/Executive_remove_jobs.cpp | 138 +- .../Executive/Executive_remove_sim_object.cpp | 74 +- .../Executive/Executive_restart.cpp | 244 +- .../sim_services/Executive/Executive_run.cpp | 18 +- .../Executive_scheduled_thread_sync.cpp | 38 +- .../Executive/Executive_set_job_cycle.cpp | 78 +- .../Executive/Executive_set_job_onoff.cpp | 66 +- .../Executive_set_simobject_onoff.cpp | 94 +- .../Executive_set_thread_amf_cycle_time.cpp | 34 +- .../Executive_set_thread_async_wait.cpp | 34 +- .../Executive_set_thread_cpu_affinity.cpp | 22 +- .../Executive_set_thread_enabled.cpp | 28 +- .../Executive_set_thread_priority.cpp | 24 +- .../Executive_set_thread_process_type.cpp | 34 +- .../Executive_set_thread_rt_semaphore.cpp | 16 +- .../Executive_set_time_tic_value.cpp | 136 +- .../Executive/Executive_shutdown.cpp | 298 +- .../Executive/Executive_signal_handler.cpp | 240 +- .../sim_services/Executive/Executive_stop.cpp | 26 +- .../Executive/Executive_terminate.cpp | 18 +- .../Executive/Executive_thread_sync.cpp | 102 +- .../Executive_write_s_job_execution.cpp | 254 +- .../Executive_write_s_run_summary.cpp | 88 +- .../sim_services/Executive/ThreadTrigger.cpp | 194 +- .../sim_services/Executive/Threads.cpp | 82 +- .../sim_services/Executive/Threads_child.cpp | 404 +- .../Executive/Threads_set_amf_cycle_tics.cpp | 32 +- .../Executive/Threads_set_async_wait.cpp | 8 +- .../Executive/Threads_set_process_type.cpp | 20 +- .../sim_services/Executive/child_handler.cpp | 42 +- .../sim_services/Executive/fpe_handler.cpp | 48 +- .../sim_services/Executive/sig_hand.cpp | 72 +- .../Executive/test/Executive_test.cpp | 1570 ++++---- .../ExternalApplication.cpp | 340 +- .../ExternalApplicationManager.cpp | 90 +- .../ExternalApplication_c_intf.cpp | 442 +-- .../MalfunctionsTrickView.cpp | 28 +- .../ExternalApplications/MonteMonitor.cpp | 8 +- .../ExternalApplications/SimControlPanel.cpp | 36 +- .../ExternalApplications/StripChart.cpp | 70 +- .../ExternalApplications/TrickView.cpp | 92 +- .../FrameLog/FrameDataRecordGroup.cpp | 156 +- .../sim_services/FrameLog/FrameLog.cpp | 1856 +++++----- .../sim_services/FrameLog/FrameLog_c_intf.cpp | 64 +- .../sim_services/InputProcessor/IPPython.cpp | 360 +- .../InputProcessor/IPPythonEvent.cpp | 1314 +++---- .../InputProcessor/InputProcessor.cpp | 66 +- .../sim_services/InputProcessor/MTV.cpp | 202 +- .../InputProcessor/MTV_c_intf.cpp | 52 +- .../InputProcessor/input_processor_ext.cpp | 222 +- .../Integrator/src/IntegLoopManager.cpp | 670 ++-- .../Integrator/src/IntegLoopScheduler.cpp | 1134 +++--- .../Integrator/src/IntegLoopSimObject.cpp | 116 +- .../Integrator/src/Integrator.cpp | 366 +- .../Integrator/src/Integrator_C_Intf.cpp | 210 +- .../Integrator/src/getIntegrator.cpp | 296 +- .../trick_algorithms/ABM_Integrator.cpp | 342 +- .../Euler_Cromer_Integrator.cpp | 216 +- .../trick_algorithms/Euler_Integrator.cpp | 116 +- .../trick_algorithms/MM4_Integrator.cpp | 210 +- .../trick_algorithms/NL2_Integrator.cpp | 204 +- .../trick_algorithms/RK2_Integrator.cpp | 182 +- .../trick_algorithms/RK4_Integrator.cpp | 222 +- .../trick_algorithms/RKF45_Integrator.cpp | 316 +- .../trick_algorithms/RKF78_Integrator.cpp | 460 +-- .../trick_algorithms/RKG4_Integrator.cpp | 256 +- .../Integrator/unittest/IBall.cpp | 236 +- .../Integrator/unittest/IRFBall.cpp | 344 +- .../sim_services/Integrator/unittest/ISat.cpp | 326 +- .../sim_services/JITInputFile/JITEvent.cpp | 68 +- .../JITInputFile/JITInputFile.cpp | 478 +-- .../JITInputFile/jit_input_file_c_intf.cpp | 102 +- .../JSONVariableServer/JSONVariableServer.cpp | 292 +- .../JSONVariableServerThread.cpp | 522 +-- .../sim_services/MasterSlave/MSSharedMem.cpp | 484 +-- .../sim_services/MasterSlave/MSSocket.cpp | 320 +- .../sim_services/MasterSlave/Master.cpp | 918 ++--- .../sim_services/MasterSlave/Slave.cpp | 504 +-- .../MemoryManager/ADefParseContext.cpp | 116 +- .../MemoryManager/MemoryManager.cpp | 204 +- .../MemoryManager/MemoryManager_C_Intf.cpp | 1172 +++--- .../MemoryManager/MemoryManager_JSON_Intf.cpp | 110 +- .../MemoryManager_add_attr_info.cpp | 282 +- ...anager_add_checkpoint_alloc_dependency.cpp | 16 +- ...moryManager_add_shared_library_symbols.cpp | 42 +- .../MemoryManager_add_template_name_trans.cpp | 12 +- .../MemoryManager/MemoryManager_add_var.cpp | 140 +- .../MemoryManager_alloc_depends.cpp | 446 +-- .../MemoryManager_alloc_info_map.cpp | 84 +- .../MemoryManager_clear_memory.cpp | 584 +-- .../MemoryManager_declare_var.cpp | 778 ++-- .../MemoryManager_delete_var.cpp | 260 +- .../MemoryManager_get_enumerated.cpp | 48 +- .../MemoryManager/MemoryManager_get_size.cpp | 276 +- .../MemoryManager_get_stl_dependencies.cpp | 342 +- .../MemoryManager_get_type_attributes.cpp | 176 +- .../MemoryManager_io_src_intf.cpp | 356 +- .../MemoryManager_is_alloced.cpp | 42 +- .../MemoryManager_make_declaration.cpp | 38 +- .../MemoryManager_make_reference_attr.cpp | 82 +- .../MemoryManager_map_external_object.cpp | 488 +-- .../MemoryManager/MemoryManager_realloc.cpp | 422 +-- .../MemoryManager_ref_allocate.cpp | 90 +- .../MemoryManager_ref_assignment.cpp | 874 ++--- .../MemoryManager_ref_attributes.cpp | 80 +- .../MemoryManager/MemoryManager_ref_dim.cpp | 192 +- .../MemoryManager/MemoryManager_ref_name.cpp | 244 +- .../MemoryManager_ref_name_from_address.cpp | 26 +- .../MemoryManager/MemoryManager_ref_var.cpp | 60 +- .../MemoryManager/MemoryManager_restore.cpp | 216 +- .../MemoryManager_restore_stls.cpp | 350 +- .../MemoryManager_set_checkpointagent.cpp | 26 +- .../MemoryManager_set_debug_level.cpp | 32 +- .../MemoryManager/MemoryManager_strdup.cpp | 30 +- .../MemoryManager_write_checkpoint.cpp | 322 +- .../MemoryManager/MemoryManager_write_var.cpp | 286 +- .../MemoryManager/RefParseContext.cpp | 32 +- .../sim_services/MemoryManager/ref_free.cpp | 48 +- .../sim_services/Message/MessageCout.cpp | 94 +- .../Message/MessageCustomFile.cpp | 54 +- .../Message/MessageCustomManager.cpp | 78 +- .../sim_services/Message/MessageFile.cpp | 94 +- .../sim_services/Message/MessageHSFile.cpp | 32 +- .../sim_services/Message/MessageLCout.cpp | 118 +- .../sim_services/Message/MessagePublisher.cpp | 140 +- .../Message/MessageSubscriber.cpp | 20 +- .../sim_services/Message/MessageTCDevice.cpp | 370 +- .../Message/MessageThreadedCout.cpp | 170 +- .../sim_services/Message/Message_c_intf.cpp | 210 +- .../sim_services/Message/PlaybackFile.cpp | 24 +- .../Message/message_publish_standalone.cpp | 48 +- .../sim_services/MonteCarlo/MonteCarlo.cpp | 112 +- .../MonteCarlo/MonteCarlo_c_intf.cpp | 366 +- .../MonteCarlo_dispatch_run_to_slave.cpp | 108 +- .../MonteCarlo/MonteCarlo_dryrun.cpp | 94 +- .../MonteCarlo/MonteCarlo_execute_monte.cpp | 38 +- .../MonteCarlo/MonteCarlo_funcs.cpp | 1000 ++--- .../MonteCarlo_initialize_sockets.cpp | 56 +- .../MonteCarlo/MonteCarlo_master.cpp | 98 +- .../MonteCarlo/MonteCarlo_master_file_io.cpp | 166 +- .../MonteCarlo/MonteCarlo_master_init.cpp | 38 +- .../MonteCarlo/MonteCarlo_master_shutdown.cpp | 222 +- .../MonteCarlo/MonteCarlo_receive_results.cpp | 368 +- .../MonteCarlo/MonteCarlo_run_queue.cpp | 46 +- .../MonteCarlo/MonteCarlo_slave.cpp | 132 +- .../MonteCarlo/MonteCarlo_slave_funcs.cpp | 60 +- .../MonteCarlo/MonteCarlo_slave_init.cpp | 102 +- .../MonteCarlo_slave_process_run.cpp | 278 +- .../MonteCarlo/MonteCarlo_spawn_slaves.cpp | 218 +- .../MonteCarlo/MonteVarCalculated.cpp | 136 +- .../sim_services/MonteCarlo/MonteVarFile.cpp | 232 +- .../sim_services/MonteCarlo/MonteVarFixed.cpp | 56 +- .../MonteCarlo/MonteVarRandom.cpp | 424 +-- .../MonteCarlo/StlRandomGenerator.cpp | 538 +-- .../MonteCarlo/test/MonteCarlo_exceptions.cpp | 126 +- .../MonteCarlo/test/MonteCarlo_test.cpp | 1444 ++++---- .../RealtimeInjector/RtiEvent.cpp | 36 +- .../sim_services/RealtimeInjector/RtiExec.cpp | 102 +- .../sim_services/RealtimeInjector/RtiList.cpp | 36 +- .../RealtimeInjector/RtiStager.cpp | 182 +- .../RealtimeSync/RealtimeSync.cpp | 828 ++--- .../RealtimeSync/RealtimeSync_c_intf.cpp | 194 +- .../ScheduledJobQueue/ScheduledJobQueue.cpp | 760 ++-- .../ScheduledJobQueueInstrument.cpp | 38 +- .../test/ScheduledJobQueue_test.cpp | 826 ++--- .../sim_services/Scheduler/Scheduler.cpp | 104 +- .../sim_services/Sie/AttributesMap.cpp | 286 +- .../sim_services/Sie/EnumAttributesMap.cpp | 116 +- trick_source/sim_services/Sie/Sie.cpp | 548 +-- trick_source/sim_services/Sie/sie_c_intf.cpp | 54 +- .../sim_services/SimObject/JobData.cpp | 352 +- .../sim_services/SimObject/SimObject.cpp | 176 +- trick_source/sim_services/SimTime/SimTime.cpp | 102 +- .../sim_services/SimTime/SimTime_c_intf.cpp | 30 +- .../sim_services/ThreadBase/SysThread.cpp | 170 +- .../sim_services/ThreadBase/ThreadBase.cpp | 550 +-- trick_source/sim_services/Timer/ITimer.cpp | 262 +- trick_source/sim_services/Timer/Timer.cpp | 28 +- .../sim_services/Timer/it_handler.cpp | 20 +- .../sim_services/Timer/test/ITimer_test.cpp | 206 +- trick_source/sim_services/UdUnits/UdUnits.cpp | 36 +- .../UdUnits/map_trick_units_to_udunits.cpp | 166 +- .../sim_services/UnitTest/UnitTest.cpp | 262 +- .../sim_services/UnitTest/UnitTest_c_intf.cpp | 48 +- .../sim_services/UnitsMap/UnitsMap.cpp | 76 +- .../VariableServer/VariableReference.cpp | 1332 +++---- .../VariableServer/VariableServer.cpp | 238 +- .../VariableServerListenThread.cpp | 440 +-- .../VariableServer/VariableServerSession.cpp | 338 +- .../VariableServerSessionThread.cpp | 174 +- .../VariableServerSessionThread_loop.cpp | 250 +- .../VariableServerSession_commands.cpp | 580 +-- ...ableServerSession_copy_and_write_modes.cpp | 208 +- .../VariableServerSession_copy_sim_data.cpp | 44 +- .../VariableServerSession_freeze_init.cpp | 22 +- .../VariableServerSession_write_data.cpp | 456 +-- .../VariableServerSession_write_stdio.cpp | 22 +- .../VariableServer_copy_and_write_freeze.cpp | 18 +- ...Server_copy_and_write_freeze_scheduled.cpp | 40 +- ...ariableServer_copy_and_write_scheduled.cpp | 40 +- .../VariableServer_copy_and_write_top.cpp | 18 +- .../VariableServer_default_data.cpp | 6 +- .../VariableServer_freeze_init.cpp | 44 +- ...riableServer_get_next_freeze_call_time.cpp | 32 +- ...VariableServer_get_next_sync_call_time.cpp | 32 +- .../VariableServer/VariableServer_init.cpp | 24 +- ...VariableServer_open_additional_servers.cpp | 130 +- .../VariableServer/VariableServer_restart.cpp | 98 +- .../VariableServer_shutdown.cpp | 30 +- .../VariableServer/exit_var_thread.cpp | 20 +- .../VariableServer/var_server_ext.cpp | 974 ++--- .../sim_services/Zeroconf/Zeroconf.cpp | 154 +- trick_source/sim_services/mains/master.cpp | 72 +- .../trick_swig/PrimitiveAttributesMap.cpp | 88 +- .../trick_swig/swig_convert_units.cpp | 112 +- trick_source/trick_swig/swig_double.cpp | 1578 ++++---- trick_source/trick_swig/swig_global_vars.cpp | 500 +-- trick_source/trick_swig/swig_int.cpp | 2150 +++++------ trick_source/trick_swig/swig_ref.cpp | 1566 ++++---- .../examples/AsteroidFlyBy/Flyby.cpp | 94 +- .../BouncyCannonBall/BouncyCannonBall.cpp | 94 +- .../examples/CannonBall/CannonBall.cpp | 76 +- .../DefiniteIntegral/DefiniteIntegral.cpp | 78 +- .../DoubleIntegral/DoubleIntegral.cpp | 88 +- .../MassSpringDamper/MassSpringDamper.cpp | 110 +- .../SAIntegrator/examples/Orbit/Orbit.cpp | 92 +- .../SAIntegrator/src/RootFinder.cpp | 194 +- .../SAIntegrator/src/SAIntegrator.cpp | 2402 ++++++------ .../trick_utils/comm/test/TCBlockioTest.cpp | 68 +- .../trick_utils/comm/test/TCConnectTest.cpp | 70 +- .../trick_utils/comm/test/TCDevCopyTest.cpp | 62 +- .../comm/test/TCDisconnectTest.cpp | 48 +- .../trick_utils/comm/test/TCErrorTest.cpp | 66 +- .../trick_utils/comm/test/TCIsValidTest.cpp | 58 +- .../trick_utils/comm/test/TCPendingTest.cpp | 52 +- .../comm/test/TCReadByteSwapTest.cpp | 36 +- .../comm/test/TCSetBlockIOTest.cpp | 50 +- .../src/compareFloatingPoint.cpp | 118 +- .../connection_handlers/ClientConnection.cpp | 2 +- .../connection_handlers/MulticastGroup.cpp | 380 +- .../connection_handlers/TCPClientListener.cpp | 446 +-- .../connection_handlers/TCPConnection.cpp | 294 +- .../connection_handlers/UDPConnection.cpp | 422 +-- .../test/MulticastGroup_test.cpp | 204 +- .../test/TCPClientListener_test.cpp | 606 +-- .../test/TCPConnection_test.cpp | 608 +-- .../test/UDPConnection_test.cpp | 618 ++-- .../interpolator/src/Interpolator.cpp | 104 +- .../math/Unittest/euler_quat_test.cpp | 140 +- .../math/test/UnitTestEulerQuat.cpp | 668 ++-- .../trick_adt/test/dllist_unittest.cpp | 1558 ++++---- .../trick_adt/test/lqueue_unittest.cpp | 218 +- .../unicode/test/unicode_utils_test.cpp | 804 ++-- .../units/Unittest/unit_cpp_test.cpp | 1082 +++--- trick_source/trick_utils/units/src/UCFn.cpp | 26 +- trick_source/trick_utils/units/src/Unit.cpp | 108 +- .../units/test/UnitConvTestSuite.cpp | 94 +- .../trick_utils/units/test/UnitTestSuite.cpp | 820 ++--- .../web/CivetServer/src/MyCivetServer.cpp | 678 ++-- .../CivetServer/src/VariableServerSession.cpp | 476 +-- .../src/VariableServerVariable.cpp | 346 +- .../web/CivetServer/src/http_GET_handlers.cpp | 316 +- .../web/CivetServer/src/simpleJSON.cpp | 378 +- 588 files changed, 79872 insertions(+), 79872 deletions(-) diff --git a/CMakeTestFiles/TestICGLinkedLibs.cpp b/CMakeTestFiles/TestICGLinkedLibs.cpp index 33ce68915..ebd5928db 100644 --- a/CMakeTestFiles/TestICGLinkedLibs.cpp +++ b/CMakeTestFiles/TestICGLinkedLibs.cpp @@ -1,22 +1,22 @@ -// `llvm/Support/Host.h` is deprecated in favour of `llvm/TargetParser/Host.h` since clang 17 -#if LIBCLANG_MAJOR > 16 -#include "llvm/TargetParser/Host.h" +// `llvm/Support/Host.h` is deprecated in favour of `llvm/TargetParser/Host.h` since clang 17 +#if LIBCLANG_MAJOR > 16 +#include "llvm/TargetParser/Host.h" #else -#include "llvm/Support/Host.h" +#include "llvm/Support/Host.h" #endif -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/raw_ostream.h" -#include "clang/Basic/Builtins.h" -#include "clang/Frontend/CompilerInstance.h" -#include "clang/Basic/TargetOptions.h" -#include "clang/Basic/TargetInfo.h" -#include "clang/Basic/FileManager.h" -#include "clang/Lex/Preprocessor.h" -#include "clang/Lex/PreprocessorOptions.h" -#include "clang/Basic/Diagnostic.h" -#include "clang/Parse/ParseAST.h" +#include "clang/Basic/Builtins.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Basic/TargetOptions.h" +#include "clang/Basic/TargetInfo.h" +#include "clang/Basic/FileManager.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Lex/PreprocessorOptions.h" +#include "clang/Basic/Diagnostic.h" +#include "clang/Parse/ParseAST.h" -int main() { - return 0; +int main() { + return 0; } \ No newline at end of file diff --git a/test/SIM_anon_enum/models/starter.cpp b/test/SIM_anon_enum/models/starter.cpp index 60da96a38..fcbb9187a 100644 --- a/test/SIM_anon_enum/models/starter.cpp +++ b/test/SIM_anon_enum/models/starter.cpp @@ -1,5 +1,5 @@ -#include "starter.h" +#include "starter.h" -Starter::Starter() { +Starter::Starter() { } diff --git a/test/SIM_checkpoint_data_recording/models/Foo.cpp b/test/SIM_checkpoint_data_recording/models/Foo.cpp index 53e0e3f85..638e6c4bd 100644 --- a/test/SIM_checkpoint_data_recording/models/Foo.cpp +++ b/test/SIM_checkpoint_data_recording/models/Foo.cpp @@ -1 +1 @@ -#include "Foo.hh" +#include "Foo.hh" diff --git a/test/SIM_delete_default_constructor/models/empty.cpp b/test/SIM_delete_default_constructor/models/empty.cpp index 6d9fb2d39..fe0e6d3dc 100644 --- a/test/SIM_delete_default_constructor/models/empty.cpp +++ b/test/SIM_delete_default_constructor/models/empty.cpp @@ -1 +1 @@ -#include "empty.h" +#include "empty.h" diff --git a/test/SIM_delete_default_constructor/models/starter.cpp b/test/SIM_delete_default_constructor/models/starter.cpp index b8761d13d..ccc6ccf62 100644 --- a/test/SIM_delete_default_constructor/models/starter.cpp +++ b/test/SIM_delete_default_constructor/models/starter.cpp @@ -1,6 +1,6 @@ -#include "starter.h" +#include "starter.h" -Starter::Starter(int foo) { - +Starter::Starter(int foo) { + } diff --git a/test/SIM_demo_inputfile/models/InputProcessSimObject/src/InputProcessSimObject.cpp b/test/SIM_demo_inputfile/models/InputProcessSimObject/src/InputProcessSimObject.cpp index 44ac37f63..d6c94ca6c 100644 --- a/test/SIM_demo_inputfile/models/InputProcessSimObject/src/InputProcessSimObject.cpp +++ b/test/SIM_demo_inputfile/models/InputProcessSimObject/src/InputProcessSimObject.cpp @@ -1,32 +1,32 @@ -#ifndef TRICK_ICG -#include +#ifndef TRICK_ICG +#include #endif -#include -#include +#include +#include -#include "InputProcessSimObject/include/InputProcessSimObject.hh" +#include "InputProcessSimObject/include/InputProcessSimObject.hh" -Trick::InputProcessSimObject::InputProcessSimObject(std::string in_function) { +Trick::InputProcessSimObject::InputProcessSimObject(std::string in_function) { - python_call_function = in_function ; - return_value = 0 ; + python_call_function = in_function ; + return_value = 0 ; } -int Trick::InputProcessSimObject::call_function( Trick::JobData * curr_job ) { +int Trick::InputProcessSimObject::call_function( Trick::JobData * curr_job ) { - std::stringstream ss ; + std::stringstream ss ; - ss << python_call_function << "(" << curr_job->id << ")" ; - PyRun_SimpleString(ss.str().c_str()) ; + ss << python_call_function << "(" << curr_job->id << ")" ; + PyRun_SimpleString(ss.str().c_str()) ; - return( return_value ) ; + return( return_value ) ; } -double Trick::InputProcessSimObject::call_function_double( Trick::JobData * curr_job ) { +double Trick::InputProcessSimObject::call_function_double( Trick::JobData * curr_job ) { - (void)curr_job ; - return(0.0) ; + (void)curr_job ; + return(0.0) ; } diff --git a/test/SIM_exclusion_mechanisms/models/ExtLibDir.cpp b/test/SIM_exclusion_mechanisms/models/ExtLibDir.cpp index 02086a788..dae2c0b49 100644 --- a/test/SIM_exclusion_mechanisms/models/ExtLibDir.cpp +++ b/test/SIM_exclusion_mechanisms/models/ExtLibDir.cpp @@ -1 +1 @@ -This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. +This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. diff --git a/test/SIM_exclusion_mechanisms/models/Foo.cpp b/test/SIM_exclusion_mechanisms/models/Foo.cpp index 222ffaa3f..29218f4c3 100644 --- a/test/SIM_exclusion_mechanisms/models/Foo.cpp +++ b/test/SIM_exclusion_mechanisms/models/Foo.cpp @@ -1,2 +1,2 @@ -// @trick_link_dependency{ExtLibDir.cpp} -// @trick_link_dependency{ext_lib_dir/ExtLibDir.cpp} +// @trick_link_dependency{ExtLibDir.cpp} +// @trick_link_dependency{ext_lib_dir/ExtLibDir.cpp} diff --git a/test/SIM_exclusion_mechanisms/models/ext_lib_dir/ExtLibDir.cpp b/test/SIM_exclusion_mechanisms/models/ext_lib_dir/ExtLibDir.cpp index 02086a788..dae2c0b49 100644 --- a/test/SIM_exclusion_mechanisms/models/ext_lib_dir/ExtLibDir.cpp +++ b/test/SIM_exclusion_mechanisms/models/ext_lib_dir/ExtLibDir.cpp @@ -1 +1 @@ -This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. +This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. diff --git a/test/SIM_exclusion_mechanisms/models/symlinks/exclude_link_path/real/ext_lib_dir/ExtLibDir.cpp b/test/SIM_exclusion_mechanisms/models/symlinks/exclude_link_path/real/ext_lib_dir/ExtLibDir.cpp index 02086a788..dae2c0b49 100644 --- a/test/SIM_exclusion_mechanisms/models/symlinks/exclude_link_path/real/ext_lib_dir/ExtLibDir.cpp +++ b/test/SIM_exclusion_mechanisms/models/symlinks/exclude_link_path/real/ext_lib_dir/ExtLibDir.cpp @@ -1 +1 @@ -This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. +This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. diff --git a/test/SIM_exclusion_mechanisms/models/symlinks/exclude_real_path/real/ext_lib_dir/ExtLibDir.cpp b/test/SIM_exclusion_mechanisms/models/symlinks/exclude_real_path/real/ext_lib_dir/ExtLibDir.cpp index 02086a788..dae2c0b49 100644 --- a/test/SIM_exclusion_mechanisms/models/symlinks/exclude_real_path/real/ext_lib_dir/ExtLibDir.cpp +++ b/test/SIM_exclusion_mechanisms/models/symlinks/exclude_real_path/real/ext_lib_dir/ExtLibDir.cpp @@ -1 +1 @@ -This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. +This file should be excluded from the build. Is is meant to cause a compiler error if Trick tries to build it. diff --git a/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp b/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp index cf516ba24..3d6d4b83f 100644 --- a/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp +++ b/test/SIM_exec_set_time_tic_value/models/ttvtest.cpp @@ -1,21 +1,21 @@ -#include -#include "ttvtest.h" -int TTVTest::scheduled() { - //message_publish(MSG_NORMAL, "Hello World!\n"); - return 0; +#include +#include "ttvtest.h" +int TTVTest::scheduled() { + //message_publish(MSG_NORMAL, "Hello World!\n"); + return 0; } -int TTVTest::scheduled2() { - //message_publish(MSG_NORMAL, "Hello World!\n"); - return 0; +int TTVTest::scheduled2() { + //message_publish(MSG_NORMAL, "Hello World!\n"); + return 0; } -int TTVTest::scheduled3() { - //message_publish(MSG_NORMAL, "Hello World!\n"); - return 0; +int TTVTest::scheduled3() { + //message_publish(MSG_NORMAL, "Hello World!\n"); + return 0; } -int TTVTest::scheduled4() { - //message_publish(MSG_NORMAL, "Hello World!\n"); - return 0; +int TTVTest::scheduled4() { + //message_publish(MSG_NORMAL, "Hello World!\n"); + return 0; } \ No newline at end of file diff --git a/test/SIM_isystem/models/my_code/Foo.cpp b/test/SIM_isystem/models/my_code/Foo.cpp index c70664dbe..e75fdb5e3 100644 --- a/test/SIM_isystem/models/my_code/Foo.cpp +++ b/test/SIM_isystem/models/my_code/Foo.cpp @@ -1,3 +1,3 @@ -// @trick_link_dependency{Warning.cpp} +// @trick_link_dependency{Warning.cpp} -#include "Warning.hh" +#include "Warning.hh" diff --git a/test/SIM_isystem/models/third_party/Warning.cpp b/test/SIM_isystem/models/third_party/Warning.cpp index 87a489338..f865cff91 100644 --- a/test/SIM_isystem/models/third_party/Warning.cpp +++ b/test/SIM_isystem/models/third_party/Warning.cpp @@ -1 +1 @@ -#include +#include diff --git a/test/SIM_job_class_order/models/starter.cpp b/test/SIM_job_class_order/models/starter.cpp index ff7b51cb1..1d6a7f64f 100644 --- a/test/SIM_job_class_order/models/starter.cpp +++ b/test/SIM_job_class_order/models/starter.cpp @@ -1,76 +1,76 @@ -#include "starter.h" -#include -#include "trick/exec_proto.hh" -#include "trick/exec_proto.h" +#include "starter.h" +#include +#include "trick/exec_proto.hh" +#include "trick/exec_proto.h" -void Starter::sched () { - sched_calls++; +void Starter::sched () { + sched_calls++; } -void Starter::custom () { - custom_calls++; +void Starter::custom () { + custom_calls++; } -void Starter::top () { - top_calls++; +void Starter::top () { + top_calls++; } -void Starter::automatic () { +void Starter::automatic () { - Trick::JobData * thisJob = exec_get_curr_job() ; - thisJob->set_next_call_time(exec_get_time_tics() + exec_get_time_tic_value()); - automatic_calls++; + Trick::JobData * thisJob = exec_get_curr_job() ; + thisJob->set_next_call_time(exec_get_time_tics() + exec_get_time_tic_value()); + automatic_calls++; } -void Starter::automatic_last () { +void Starter::automatic_last () { - Trick::JobData * thisJob = exec_get_curr_job() ; - thisJob->set_next_call_time(exec_get_time_tics() + exec_get_time_tic_value()); + Trick::JobData * thisJob = exec_get_curr_job() ; + thisJob->set_next_call_time(exec_get_time_tics() + exec_get_time_tic_value()); - automatic_last_calls++; + automatic_last_calls++; } -void Starter::end() { - end_calls++; +void Starter::end() { + end_calls++; } -void Starter::deriv() { - deriv_calls++; +void Starter::deriv() { + deriv_calls++; } -int Starter::integ() { - integ_calls++; +int Starter::integ() { + integ_calls++; - return 0; + return 0; } -void Starter::test_calls() { - if (top_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "top_of_frame job never called"); - } +void Starter::test_calls() { + if (top_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "top_of_frame job never called"); + } - if (custom_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "custom job never called"); - } + if (custom_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "custom job never called"); + } - if (sched_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "scheduled job never called"); - } + if (sched_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "scheduled job never called"); + } - if (automatic_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "automatic job never called"); - } + if (automatic_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "automatic job never called"); + } - if (automatic_last_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "automatic_last job never called"); - } + if (automatic_last_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "automatic_last job never called"); + } - if (deriv_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "derivative job never called"); - } + if (deriv_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "derivative job never called"); + } - if (integ_calls == 0) { - exec_terminate_with_return(1, __FILE__, __LINE__, "integration job never called"); - } + if (integ_calls == 0) { + exec_terminate_with_return(1, __FILE__, __LINE__, "integration job never called"); + } } diff --git a/test/SIM_leaks/models/Leaker/Leaker.cpp b/test/SIM_leaks/models/Leaker/Leaker.cpp index 0308e7e4e..b8c65fbcb 100644 --- a/test/SIM_leaks/models/Leaker/Leaker.cpp +++ b/test/SIM_leaks/models/Leaker/Leaker.cpp @@ -1,37 +1,37 @@ -#include -#include -#include +#include +#include +#include -/* Model include files. */ -#include "sim_services/MemoryManager/include/memorymanager_c_intf.h" +/* Model include files. */ +#include "sim_services/MemoryManager/include/memorymanager_c_intf.h" -std::vector< int > dv ; +std::vector< int > dv ; - /* ENTRY POINT */ -int Leaker() { + /* ENTRY POINT */ +int Leaker() { - int * i_malloc = (int *)malloc( sizeof(int) ) ; + int * i_malloc = (int *)malloc( sizeof(int) ) ; - int * i_calloc = (int *)calloc( 1 , sizeof(int) ) ; + int * i_calloc = (int *)calloc( 1 , sizeof(int) ) ; -#if 0 - int * i_realloc = NULL ; - i_realloc = (int *)realloc( i_realloc, sizeof(int) ) ; +#if 0 + int * i_realloc = NULL ; + i_realloc = (int *)realloc( i_realloc, sizeof(int) ) ; #endif - int * i_new = new int ; + int * i_new = new int ; - int * ia_new = new int[10] ; + int * ia_new = new int[10] ; - char * str = strdup("hello") ; + char * str = strdup("hello") ; - int ii ; - for ( ii = 0 ; ii < 100 ; ii++ ) { - dv.push_back(ii) ; - } + int ii ; + for ( ii = 0 ; ii < 100 ; ii++ ) { + dv.push_back(ii) ; + } - /* RETURN */ - return( 0 ); + /* RETURN */ + return( 0 ); } diff --git a/test/SIM_parse_s_define/models/Classes.cpp b/test/SIM_parse_s_define/models/Classes.cpp index f1dbbb826..229fc1934 100644 --- a/test/SIM_parse_s_define/models/Classes.cpp +++ b/test/SIM_parse_s_define/models/Classes.cpp @@ -1 +1 @@ -void foo() {}; +void foo() {}; diff --git a/test/SIM_segments/models/SegmentedExecutive/src/ExampleSegments.cpp b/test/SIM_segments/models/SegmentedExecutive/src/ExampleSegments.cpp index 8fcc74b56..e592a9a69 100644 --- a/test/SIM_segments/models/SegmentedExecutive/src/ExampleSegments.cpp +++ b/test/SIM_segments/models/SegmentedExecutive/src/ExampleSegments.cpp @@ -1,35 +1,35 @@ -#include -#include "SegmentedExecutive/include/ExampleSegments.hh" +#include +#include "SegmentedExecutive/include/ExampleSegments.hh" -SegmentA::SegmentA( std::string in_segment_name , - std::string enter_job_class_str , - std::string exit_job_class_str , - Trick::IntegLoopScheduler & in_integ_sched ) : - Trick::Segment(in_segment_name , enter_job_class_str , exit_job_class_str) , - integ_sched(in_integ_sched) { } ; +SegmentA::SegmentA( std::string in_segment_name , + std::string enter_job_class_str , + std::string exit_job_class_str , + Trick::IntegLoopScheduler & in_integ_sched ) : + Trick::Segment(in_segment_name , enter_job_class_str , exit_job_class_str) , + integ_sched(in_integ_sched) { } ; -/* This custom enter routine changes the integrator and integrator cycle rate */ -int SegmentA::enter( std::string next_segment ) { - std::cout << "Switching integrators in segment A!" << std::endl ; - integ_sched.getIntegrator(Runge_Kutta_2 , 4) ; - integ_sched.set_integ_cycle(0.01) ; - return Trick::Segment::exit(next_segment) ; +/* This custom enter routine changes the integrator and integrator cycle rate */ +int SegmentA::enter( std::string next_segment ) { + std::cout << "Switching integrators in segment A!" << std::endl ; + integ_sched.getIntegrator(Runge_Kutta_2 , 4) ; + integ_sched.set_integ_cycle(0.01) ; + return Trick::Segment::exit(next_segment) ; } -/* -------------------------------------------------------------------- */ +/* -------------------------------------------------------------------- */ -SegmentB::SegmentB( std::string in_segment_name , - std::string enter_job_class_str , - std::string exit_job_class_str , - Trick::IntegLoopScheduler & in_integ_sched ) : - Trick::Segment(in_segment_name , enter_job_class_str , exit_job_class_str) , - integ_sched(in_integ_sched) { } ; +SegmentB::SegmentB( std::string in_segment_name , + std::string enter_job_class_str , + std::string exit_job_class_str , + Trick::IntegLoopScheduler & in_integ_sched ) : + Trick::Segment(in_segment_name , enter_job_class_str , exit_job_class_str) , + integ_sched(in_integ_sched) { } ; -/* This custom enter routine changes the integrator and integrator cycle rate */ -int SegmentB::enter( std::string next_segment ) { - std::cout << "Switching integrators in segment B!" << std::endl ; - integ_sched.getIntegrator(Runge_Kutta_4 , 4) ; - integ_sched.set_integ_cycle(0.1) ; - return Trick::Segment::exit(next_segment) ; +/* This custom enter routine changes the integrator and integrator cycle rate */ +int SegmentB::enter( std::string next_segment ) { + std::cout << "Switching integrators in segment B!" << std::endl ; + integ_sched.getIntegrator(Runge_Kutta_4 , 4) ; + integ_sched.set_integ_cycle(0.1) ; + return Trick::Segment::exit(next_segment) ; } diff --git a/test/SIM_segments/models/SegmentedExecutive/src/Segment.cpp b/test/SIM_segments/models/SegmentedExecutive/src/Segment.cpp index ddbaf56a1..d7a797ef0 100644 --- a/test/SIM_segments/models/SegmentedExecutive/src/Segment.cpp +++ b/test/SIM_segments/models/SegmentedExecutive/src/Segment.cpp @@ -1,45 +1,45 @@ -#include "SegmentedExecutive/include/Segment.hh" +#include "SegmentedExecutive/include/Segment.hh" -Trick::Segment::Segment( std::string in_name ) : segment_name(in_name) {} ; +Trick::Segment::Segment( std::string in_name ) : segment_name(in_name) {} ; -Trick::Segment::Segment( std::string in_name , - std::string enter_job_class_str , - std::string exit_job_class_str ) : - segment_name(in_name) { - set_enter_job_class_name(enter_job_class_str) ; - set_exit_job_class_name(exit_job_class_str) ; -} ; +Trick::Segment::Segment( std::string in_name , + std::string enter_job_class_str , + std::string exit_job_class_str ) : + segment_name(in_name) { + set_enter_job_class_name(enter_job_class_str) ; + set_exit_job_class_name(exit_job_class_str) ; +} ; -std::string Trick::Segment::get_segment_name() { - return segment_name ; +std::string Trick::Segment::get_segment_name() { + return segment_name ; } -void Trick::Segment::set_segment_name(std::string in_segment_name) { - segment_name = in_segment_name ; +void Trick::Segment::set_segment_name(std::string in_segment_name) { + segment_name = in_segment_name ; } -void Trick::Segment::set_enter_job_class_name(std::string job_class_name) { - enter_job_class_name = job_class_name ; - job_queues[enter_job_class_name] = &enter_jobs ; +void Trick::Segment::set_enter_job_class_name(std::string job_class_name) { + enter_job_class_name = job_class_name ; + job_queues[enter_job_class_name] = &enter_jobs ; } -void Trick::Segment::set_exit_job_class_name(std::string job_class_name) { - exit_job_class_name = job_class_name ; - job_queues[exit_job_class_name] = &exit_jobs ; +void Trick::Segment::set_exit_job_class_name(std::string job_class_name) { + exit_job_class_name = job_class_name ; + job_queues[exit_job_class_name] = &exit_jobs ; } -// Call the enter_jobs when entering this segment. -int Trick::Segment::enter( std::string prev_segment __attribute__((unused)) ) { - return enter_jobs.execute_all_jobs() ; +// Call the enter_jobs when entering this segment. +int Trick::Segment::enter( std::string prev_segment __attribute__((unused)) ) { + return enter_jobs.execute_all_jobs() ; } -// Call the exit_jobs when exiting this segment. -int Trick::Segment::exit( std::string next_segment __attribute__((unused)) ) { - return exit_jobs.execute_all_jobs() ; +// Call the exit_jobs when exiting this segment. +int Trick::Segment::exit( std::string next_segment __attribute__((unused)) ) { + return exit_jobs.execute_all_jobs() ; } -std::map < std::string , Trick::ScheduledJobQueue * > & Trick::Segment::get_job_queues() { - return job_queues ; +std::map < std::string , Trick::ScheduledJobQueue * > & Trick::Segment::get_job_queues() { + return job_queues ; } diff --git a/test/SIM_segments/models/SegmentedExecutive/src/SegmentedExecutive.cpp b/test/SIM_segments/models/SegmentedExecutive/src/SegmentedExecutive.cpp index 5f2177050..7d0069f45 100644 --- a/test/SIM_segments/models/SegmentedExecutive/src/SegmentedExecutive.cpp +++ b/test/SIM_segments/models/SegmentedExecutive/src/SegmentedExecutive.cpp @@ -1,256 +1,256 @@ -#include -#include -#include -#include +#include +#include +#include +#include -#include "SegmentedExecutive.hh" -#include "sim_services/Message/include/message_proto.h" -#include "sim_services/CommandLineArguments/include/command_line_protos.h" +#include "SegmentedExecutive.hh" +#include "sim_services/Message/include/message_proto.h" +#include "sim_services/CommandLineArguments/include/command_line_protos.h" -Trick::SegmentedExecutive * the_phe = NULL ; +Trick::SegmentedExecutive * the_phe = NULL ; -Trick::SegmentedExecutive::SegmentedExecutive() : curr_segment(NULL) { - // Set the global the_phe pointer for use in C bound access functions - the_phe = this ; +Trick::SegmentedExecutive::SegmentedExecutive() : curr_segment(NULL) { + // Set the global the_phe pointer for use in C bound access functions + the_phe = this ; } -int Trick::SegmentedExecutive::add_segment( Trick::Segment * ps ) { +int Trick::SegmentedExecutive::add_segment( Trick::Segment * ps ) { - // Gets the job class to job queue map for this segment and adds the job classes to the executive. - std::map < std::string , Trick::ScheduledJobQueue * >::iterator it ; - for ( it = ps->get_job_queues().begin() ; it != ps->get_job_queues().end() ; ++it ) { - class_map[(*it).first] = num_classes ; - class_to_queue[num_classes++] = (*it).second ; - } + // Gets the job class to job queue map for this segment and adds the job classes to the executive. + std::map < std::string , Trick::ScheduledJobQueue * >::iterator it ; + for ( it = ps->get_job_queues().begin() ; it != ps->get_job_queues().end() ; ++it ) { + class_map[(*it).first] = num_classes ; + class_to_queue[num_classes++] = (*it).second ; + } - // Store the segment information in a map keyed by the segment name - segment_map[ps->get_segment_name()] = ps ; + // Store the segment information in a map keyed by the segment name + segment_map[ps->get_segment_name()] = ps ; - return 0 ; + return 0 ; } /** @details - Finds all jobs that have 1 or more job tags that are a segment string. - Those jobs are saved to a set. + Finds all jobs that have 1 or more job tags that are a segment string. + Those jobs are saved to a set. */ -int Trick::SegmentedExecutive::gather_segmented_jobs() { - Trick::JobData * job ; - unsigned int ii ; - std::map < std::string , Trick::Segment * >::iterator mit ; - std::set< std::string > segment_tags ; - - for ( mit = segment_map.begin() ; mit != segment_map.end() ; ++mit ) { - segment_tags.insert((*mit).first) ; - } - - // all_jobs_vector is defined in the Trick::Executive. - for ( ii = 0 ; ii < all_jobs_vector.size() ; ii++ ) { - job = all_jobs_vector[ii] ; - /* Find the set intersection between the known segments and the current job tags. */ - std::set< std::string > intersect ; - std::set_intersection( segment_tags.begin() , segment_tags.end() , job->tags_begin() , job->tags_end() , - std::inserter( intersect, intersect.begin() ) ) ; - /* If the set intersection is not empty we have a segment. Add this job to our set of segmented jobs. */ - if ( ! intersect.empty() ) { - all_segmented_jobs.insert(job) ; - } - } - - return 0 ; +int Trick::SegmentedExecutive::gather_segmented_jobs() { + Trick::JobData * job ; + unsigned int ii ; + std::map < std::string , Trick::Segment * >::iterator mit ; + std::set< std::string > segment_tags ; + + for ( mit = segment_map.begin() ; mit != segment_map.end() ; ++mit ) { + segment_tags.insert((*mit).first) ; + } + + // all_jobs_vector is defined in the Trick::Executive. + for ( ii = 0 ; ii < all_jobs_vector.size() ; ii++ ) { + job = all_jobs_vector[ii] ; + /* Find the set intersection between the known segments and the current job tags. */ + std::set< std::string > intersect ; + std::set_intersection( segment_tags.begin() , segment_tags.end() , job->tags_begin() , job->tags_end() , + std::inserter( intersect, intersect.begin() ) ) ; + /* If the set intersection is not empty we have a segment. Add this job to our set of segmented jobs. */ + if ( ! intersect.empty() ) { + all_segmented_jobs.insert(job) ; + } + } + + return 0 ; } /** @details -Tests if the incoming segment string is a valid segment name. -If the name is valid, save the next segment for the next call of segment_switch +Tests if the incoming segment string is a valid segment name. +If the name is valid, save the next segment for the next call of segment_switch */ -int Trick::SegmentedExecutive::segment_set( std::string in_segment ) { - // Check to see if this segment string exists. - if ( segment_map.find(in_segment) != segment_map.end() ) { - next_segment_str = in_segment ; - } else { - message_publish( MSG_ERROR , "Bad Segment Name: %s\n" , in_segment.c_str() ) ; - return -1 ; - } - return 0 ; +int Trick::SegmentedExecutive::segment_set( std::string in_segment ) { + // Check to see if this segment string exists. + if ( segment_map.find(in_segment) != segment_map.end() ) { + next_segment_str = in_segment ; + } else { + message_publish( MSG_ERROR , "Bad Segment Name: %s\n" , in_segment.c_str() ) ; + return -1 ; + } + return 0 ; } /** @details -Performs segment switch. --# If there is a segment change - -# If a current segment is set. - -# Call the currrent segment exit routine - -# Call the next segment enter routine - -# else - -# Call the next segment enter routine with an empty string as the current segment - -# Turn on/off all segmented jobs. - -# Set the current segment to the next segment. +Performs segment switch. +-# If there is a segment change + -# If a current segment is set. + -# Call the currrent segment exit routine + -# Call the next segment enter routine + -# else + -# Call the next segment enter routine with an empty string as the current segment + -# Turn on/off all segmented jobs. + -# Set the current segment to the next segment. */ -int Trick::SegmentedExecutive::segment_switch() { - - Trick::Segment * next_segment = segment_map[next_segment_str] ; - - // Only do something if the next_segment is not equal to the current segment. - if ( curr_segment != next_segment ) { - if ( curr_segment != NULL ) { - // Perform current segment exit routine. - if ( curr_segment->get_segment_name().compare(next_segment_str) ) { - message_publish( MSG_INFO , "Switching from segment %s to %s\n" , - curr_segment->get_segment_name().c_str() , next_segment_str.c_str() ) ; - curr_segment->exit( next_segment_str ) ; - } - // Perform next segment enter routines - next_segment->enter( curr_segment->get_segment_name() ) ; - } else { - // If curr_segment is NULL, then this is the initial segment set. - // No need to exit current segment. - message_publish( MSG_INFO , "Setting initial segment to %s\n" , next_segment_str.c_str() ) ; - // Enter the next segment with the prev_segment set as an empty string. - next_segment->enter( std::string("") ) ; - } - - // Set the jobs to on/off according to segment - segment_set_jobs_onoff() ; - curr_segment = next_segment ; - } - - return 0 ; +int Trick::SegmentedExecutive::segment_switch() { + + Trick::Segment * next_segment = segment_map[next_segment_str] ; + + // Only do something if the next_segment is not equal to the current segment. + if ( curr_segment != next_segment ) { + if ( curr_segment != NULL ) { + // Perform current segment exit routine. + if ( curr_segment->get_segment_name().compare(next_segment_str) ) { + message_publish( MSG_INFO , "Switching from segment %s to %s\n" , + curr_segment->get_segment_name().c_str() , next_segment_str.c_str() ) ; + curr_segment->exit( next_segment_str ) ; + } + // Perform next segment enter routines + next_segment->enter( curr_segment->get_segment_name() ) ; + } else { + // If curr_segment is NULL, then this is the initial segment set. + // No need to exit current segment. + message_publish( MSG_INFO , "Setting initial segment to %s\n" , next_segment_str.c_str() ) ; + // Enter the next segment with the prev_segment set as an empty string. + next_segment->enter( std::string("") ) ; + } + + // Set the jobs to on/off according to segment + segment_set_jobs_onoff() ; + curr_segment = next_segment ; + } + + return 0 ; } /** @details -Traverses all jobs that have been marked as having a segment tag. -If the job contains the next segment tag, enable the job, else disable it. +Traverses all jobs that have been marked as having a segment tag. +If the job contains the next segment tag, enable the job, else disable it. */ -int Trick::SegmentedExecutive::segment_set_jobs_onoff() { - Trick::JobData * job ; - std::set < Trick::JobData * >::iterator it ; - - for ( it = all_segmented_jobs.begin() ; it != all_segmented_jobs.end() ; ++it ) { - job = *it ; - // Test to see if the next segment is present in the job tags. - // Set the disabled flag to the negation of the tag's presence - job->disabled = !(job->tags.count(next_segment_str)) ; - message_publish(MSG_NORMAL, "segment set job %s to %s\n" , job->name.c_str() , job->disabled ? "disabled" : "enabled" ) ; - } - - return 0 ; +int Trick::SegmentedExecutive::segment_set_jobs_onoff() { + Trick::JobData * job ; + std::set < Trick::JobData * >::iterator it ; + + for ( it = all_segmented_jobs.begin() ; it != all_segmented_jobs.end() ; ++it ) { + job = *it ; + // Test to see if the next segment is present in the job tags. + // Set the disabled flag to the negation of the tag's presence + job->disabled = !(job->tags.count(next_segment_str)) ; + message_publish(MSG_NORMAL, "segment set job %s to %s\n" , job->name.c_str() , job->disabled ? "disabled" : "enabled" ) ; + } + + return 0 ; } -/* The following routines add the segmented jobs to the S_job_execution file and - instruments the segmented jobs just like ant other job. +/* The following routines add the segmented jobs to the S_job_execution file and + instruments the segmented jobs just like ant other job. */ -int Trick::SegmentedExecutive::write_s_job_execution(FILE *fp) { +int Trick::SegmentedExecutive::write_s_job_execution(FILE *fp) { - char buf[1024]; - std::string output_dir ; + char buf[1024]; + std::string output_dir ; - // call the base Executive function - Trick::Executive::write_s_job_execution(fp) ; + // call the base Executive function + Trick::Executive::write_s_job_execution(fp) ; - /* Get full path to S_job_execution */ - output_dir = command_line_args_get_output_dir() ; - snprintf(buf, sizeof(buf), "%s/S_job_execution", output_dir.c_str()); + /* Get full path to S_job_execution */ + output_dir = command_line_args_get_output_dir() ; + snprintf(buf, sizeof(buf), "%s/S_job_execution", output_dir.c_str()); - /* Reopen the S_job_execution file. If it fails, it's not a fatal error, return 0. */ - if ((fp = fopen(buf, "a")) == NULL) { - return (0) ; - } + /* Reopen the S_job_execution file. If it fails, it's not a fatal error, return 0. */ + if ((fp = fopen(buf, "a")) == NULL) { + return (0) ; + } - fprintf(fp, "Segment Jobs:\n") ; + fprintf(fp, "Segment Jobs:\n") ; - std::map < std::string , Trick::Segment * >::iterator pmit ; - for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { - Trick::Segment * pb = (*pmit).second ; - std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; - for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { - (*jqit).second->write_non_sched_queue(fp) ; - } - } - fprintf(fp, "\n===================================================================================================\n") ; - fclose(fp) ; + std::map < std::string , Trick::Segment * >::iterator pmit ; + for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { + Trick::Segment * pb = (*pmit).second ; + std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; + for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { + (*jqit).second->write_non_sched_queue(fp) ; + } + } + fprintf(fp, "\n===================================================================================================\n") ; + fclose(fp) ; - return 0 ; + return 0 ; } -int Trick::SegmentedExecutive::instrument_job_before( Trick::JobData * instrument_job ) { +int Trick::SegmentedExecutive::instrument_job_before( Trick::JobData * instrument_job ) { - unsigned int count = 0 ; + unsigned int count = 0 ; - if ( instrument_job != NULL ) { - //call the base Executive instrument job - count = Trick::Executive::instrument_job_before( instrument_job ) ; + if ( instrument_job != NULL ) { + //call the base Executive instrument job + count = Trick::Executive::instrument_job_before( instrument_job ) ; - //go through all of the segmented jobs and instrument them. - std::map < std::string , Trick::Segment * >::iterator pmit ; - for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { - Trick::Segment * pb = (*pmit).second ; - std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; - for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { - (*jqit).second->instrument_before(instrument_job) ; - } - } - } + //go through all of the segmented jobs and instrument them. + std::map < std::string , Trick::Segment * >::iterator pmit ; + for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { + Trick::Segment * pb = (*pmit).second ; + std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; + for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { + (*jqit).second->instrument_before(instrument_job) ; + } + } + } - return count ; + return count ; } -int Trick::SegmentedExecutive::instrument_job_after( Trick::JobData * instrument_job ) { - - unsigned int count = 0 ; - - if ( instrument_job != NULL ) { - //call the base Executive instrument job - count = Trick::Executive::instrument_job_after( instrument_job ) ; - - //go through all of the segmented jobs and instrument them. - std::map < std::string , Trick::Segment * >::iterator pmit ; - for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { - Trick::Segment * pb = (*pmit).second ; - std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; - for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { - (*jqit).second->instrument_after(instrument_job) ; - } - } - } - return count ; +int Trick::SegmentedExecutive::instrument_job_after( Trick::JobData * instrument_job ) { + + unsigned int count = 0 ; + + if ( instrument_job != NULL ) { + //call the base Executive instrument job + count = Trick::Executive::instrument_job_after( instrument_job ) ; + + //go through all of the segmented jobs and instrument them. + std::map < std::string , Trick::Segment * >::iterator pmit ; + for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { + Trick::Segment * pb = (*pmit).second ; + std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; + for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { + (*jqit).second->instrument_after(instrument_job) ; + } + } + } + return count ; } -int Trick::SegmentedExecutive::instrument_job_remove(std::string in_job) { +int Trick::SegmentedExecutive::instrument_job_remove(std::string in_job) { - //call the base Executive instrument job - Trick::Executive::instrument_job_remove( in_job ) ; + //call the base Executive instrument job + Trick::Executive::instrument_job_remove( in_job ) ; - std::map < std::string , Trick::Segment * >::iterator pmit ; - for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { - Trick::Segment * pb = (*pmit).second ; - std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; - for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { - (*jqit).second->instrument_remove(in_job) ; - } - } - return 0 ; + std::map < std::string , Trick::Segment * >::iterator pmit ; + for ( pmit = segment_map.begin() ; pmit != segment_map.end() ; ++pmit ) { + Trick::Segment * pb = (*pmit).second ; + std::map < std::string , Trick::ScheduledJobQueue * >::iterator jqit ; + for ( jqit = pb->get_job_queues().begin() ; jqit != pb->get_job_queues().end() ; ++jqit ) { + (*jqit).second->instrument_remove(in_job) ; + } + } + return 0 ; } -// This function proides the shortcut access to set the segment in python -// trick.phexec_segment_set("string_segment") -extern "C" int exec_segment_set( std::string in_segment ) { - if ( the_phe != NULL ) { - return the_phe->segment_set(in_segment) ; - } - return -1 ; +// This function proides the shortcut access to set the segment in python +// trick.phexec_segment_set("string_segment") +extern "C" int exec_segment_set( std::string in_segment ) { + if ( the_phe != NULL ) { + return the_phe->segment_set(in_segment) ; + } + return -1 ; } -// This function proides the shortcut access to set the segment switching in python -// trick.phexec_segment_switch() -extern "C" int exec_segment_switch() { - if ( the_phe != NULL ) { - return the_phe->segment_switch() ; - } - return -1 ; +// This function proides the shortcut access to set the segment switching in python +// trick.phexec_segment_switch() +extern "C" int exec_segment_switch() { + if ( the_phe != NULL ) { + return the_phe->segment_switch() ; + } + return -1 ; } diff --git a/test/SIM_stls/models/STLCheckpoint.cpp b/test/SIM_stls/models/STLCheckpoint.cpp index 1e9839dc9..2c8453054 100644 --- a/test/SIM_stls/models/STLCheckpoint.cpp +++ b/test/SIM_stls/models/STLCheckpoint.cpp @@ -1,763 +1,763 @@ -#include "sim_services/Message/include/message_proto.h" -#include "STLCheckpoint.hh" -#include "trick/memorymanager_c_intf.h" -#include -#include -#include "sim_services/UnitTest/include/trick_tests.h" -/* These 2 constructors add different data to an STLCheckpoint. */ - -STLCheckpoint::STLCheckpoint() { - return ; +#include "sim_services/Message/include/message_proto.h" +#include "STLCheckpoint.hh" +#include "trick/memorymanager_c_intf.h" +#include +#include +#include "sim_services/UnitTest/include/trick_tests.h" +/* These 2 constructors add different data to an STLCheckpoint. */ + +STLCheckpoint::STLCheckpoint() { + return ; } -template -void compare_data_structures_with_top(T a, T b, std::string test_name) { - const char *test_suite = "STLCheckpoint"; +template +void compare_data_structures_with_top(T a, T b, std::string test_name) { + const char *test_suite = "STLCheckpoint"; - TRICK_EXPECT_EQ(a.size(), b.size(), test_suite, test_name.c_str()); - while (!a.empty()) { - TRICK_EXPECT_EQ(a.top(), b.top(), test_suite, test_name.c_str()); - a.pop(); - b.pop(); - } + TRICK_EXPECT_EQ(a.size(), b.size(), test_suite, test_name.c_str()); + while (!a.empty()) { + TRICK_EXPECT_EQ(a.top(), b.top(), test_suite, test_name.c_str()); + a.pop(); + b.pop(); + } } -int STLCheckpoint::addData() { - dataJobRun = true; - vector_vector_double = std::vector< std::vector< double > >(4, std::vector(3)); - vector_vector_vector_double = std::vector< std::vector< std::vector< double > > >(5, std::vector >(4, std::vector(3))); - - std::cout << "Adding hardcoded data to sim" << std::endl; - - double_map[44.4] = 444.4 ; - double_map[55.5] = 555.5 ; - double_map[66.6] = 666.6 ; - - string_key_map[std::string("four")] = 4 ; - string_key_map[std::string("five")] = 5 ; - string_key_map[std::string("six")] = 6 ; - - string_data_map[7] = std::string("seiben") ; - string_data_map[8] = std::string("acht") ; - string_data_map[9] = std::string("neun") ; - - std::vector< int > v ; - v.push_back(2) ; - v.push_back(4) ; - v.push_back(6) ; - v.push_back(8) ; - map_int_vector_int[1] = v ; - - std::pair< int , int > p ; - p.first = 24 ; - p.second = 30 ; - gcd[p] = 6 ; - - p.first = 50 ; - p.second = 60 ; - std::pair< int , int > q ; - q.first = 70 ; - q.second = 80 ; - map_pair_pair[p] = q ; - - p.first = 3 ; - p.second = 5 ; - v.clear() ; - v.push_back(15) ; - v.push_back(30) ; - v.push_back(45) ; - v.push_back(60) ; - common_multiples.insert(std::pair< std::pair< int, int >, std::vector< int > >(p,v)) ; - - p.first = 3 ; - p.second = 7 ; - v.clear() ; - v.push_back(21) ; - v.push_back(42) ; - v.push_back(84) ; - v.push_back(168) ; - common_multiples.insert(std::pair< std::pair< int, int >, std::vector< int > >(p,v)) ; - - string_map[std::string("sister")] = std::string("Lisa") ; - string_map[std::string("dog")] = std::string("Santa's Little Helper") ; - - int_multimap.insert(std::pair(44,444)) ; - int_multimap.insert(std::pair(55,555)) ; - int_multimap.insert(std::pair(66,666)) ; - int_multimap.insert(std::pair(44,4444)) ; - int_multimap.insert(std::pair(55,5555)) ; - int_multimap.insert(std::pair(66,6666)) ; - - string_key_multimap.insert(std::pair("four", 4)) ; - string_key_multimap.insert(std::pair("five", 5)) ; - string_key_multimap.insert(std::pair("six", 6)) ; - string_key_multimap.insert(std::pair("four", 44)) ; - string_key_multimap.insert(std::pair("five", 55)) ; - string_key_multimap.insert(std::pair("six", 66)) ; - - string_data_multimap.insert(std::pair(7, "seiben")) ; - string_data_multimap.insert(std::pair(8, "acht")) ; - string_data_multimap.insert(std::pair(9, "neun")) ; - string_data_multimap.insert(std::pair(7, "seven")) ; - string_data_multimap.insert(std::pair(8, "eight")) ; - string_data_multimap.insert(std::pair(9, "nine")) ; - - string_multimap.insert(std::pair("sister","Lisa")) ; - string_multimap.insert(std::pair("dog","Santa's Little Helper")) ; - string_multimap.insert(std::pair("sister","Meg")) ; - string_multimap.insert(std::pair("dog","Brian")) ; - - double_vector.push_back(4.0) ; - double_vector.push_back(5.0) ; - double_vector.push_back(6.0) ; - - string_vector.push_back("It") ; - string_vector.push_back("has") ; - string_vector.push_back("the") ; - string_vector.push_back("Wi-Fies") ; - - short_list.push_back(400) ; - short_list.push_back(401) ; - short_list.push_back(402) ; - - string_list.push_back("I") ; - string_list.push_back("don't") ; - string_list.push_back("care") ; - - float_deque.push_back(98.7) ; - float_deque.push_back(65.4) ; - float_deque.push_back(32.1) ; - - string_deque.push_back("Welcome") ; - string_deque.push_back("to") ; - string_deque.push_back("PhoneMart") ; - - int_set.insert(8000) ; - int_set.insert(4000) ; - int_set.insert(2000) ; - int_set.insert(1000) ; - - string_set.insert("efg") ; - string_set.insert("abc") ; - string_set.insert("def") ; - - for (int j = 0; j < 5; j++) { - std::vector temp; - for (int i = j; i < 10; i++) { - temp.push_back(i); - } - vector_set.insert(temp); - } - - pair_set.emplace("One", 1); - pair_set.emplace("Two", 2); - pair_set.emplace("Three", 3); - - std::map m; - m[5] = 500.5; - m[1] = 100.1; - std::map m2; - m2[5] = 5000.5; - m2[1] = 1000.1; - - nested_map_set.insert(m); - nested_map_set.insert(m2); - - for (int j = 0; j < 5; j++) { - std::vector temp; - for (int i = j; i < 10; i++) { - temp.push_back(i); - } - vector_queue.push(temp); - } - - - long_multiset.insert(8000) ; - long_multiset.insert(4000) ; - long_multiset.insert(4000) ; - long_multiset.insert(2000) ; - long_multiset.insert(1000) ; - - string_multiset.insert("efg") ; - string_multiset.insert("abc") ; - string_multiset.insert("def") ; - string_multiset.insert("efg") ; - string_multiset.insert("abc") ; - string_multiset.insert("def") ; - - pair_multiset.emplace(5, 5); - pair_multiset.emplace(5, 5); - pair_multiset.emplace(5, 4); - pair_multiset.emplace(4, 4); - - vec_multiset.emplace(std::vector({1,2,3,4})); - vec_multiset.emplace(std::vector({1,2,3,4})); - vec_multiset.emplace(std::vector({1,2,3,4,5})); - - - uint_stack.push(1) ; - uint_stack.push(2) ; - uint_stack.push(3) ; - uint_stack.push(4) ; - - string_stack.push("I") ; - string_stack.push("want the one") ; - string_stack.push("with the bigger") ; - string_stack.push("Gee Bees") ; - - std::vector temp_v1 = {1, 2, 3, 4}; - std::vector temp_v2 = {5, 6, 7, 8}; - stack_vector_int.push(temp_v1) ; - stack_vector_int.push(temp_v2) ; - - int_queue.push(1) ; - int_queue.push(2) ; - int_queue.push(3) ; - int_queue.push(4) ; - - string_queue.push("I") ; - string_queue.push("want") ; - string_queue.push("an") ; - string_queue.push("iPhone 4") ; - - int_priority_queue.push(3) ; - int_priority_queue.push(2) ; - int_priority_queue.push(4) ; - int_priority_queue.push(1) ; - - string_priority_queue.push("I") ; - string_priority_queue.push("want") ; - string_priority_queue.push("an") ; - string_priority_queue.push("iPhone 4") ; - - queue_vector_int.push(temp_v1) ; - queue_vector_int.push(temp_v2) ; - - priority_queue_vector_int.push(temp_v1) ; - priority_queue_vector_int.push(temp_v2) ; - - int_pair.first = 10 ; - int_pair.second = 20 ; - - string_first_pair.first = "string first" ; - string_first_pair.second = 25 ; - - string_second_pair.first = 25 ; - string_second_pair.second = "string second" ; - - string_pair.first = "pair first string" ; - string_pair.second = "pair second string" ; - - int_pair_int_int.first = 200 ; - p.first = 10 ; - p.second = 20 ; - int_pair_int_int.second = p ; - - p.first = 15 ; - p.second = 12 ; - pair_int_int_int.first = p ; - pair_int_int_int.second = 180 ; - - pair_pair_pair.first.first = 51 ; - pair_pair_pair.first.second = 52 ; - pair_pair_pair.second.first = 53 ; - pair_pair_pair.second.second = 54 ; - - int_vec_pair.first = 5; - int_vec_pair.second.push_back(5); - int_vec_pair.second.push_back(10); - int_vec_pair.second.push_back(15); - int_vec_pair.second.push_back(20); - - vec_int_pair.second = 5; - vec_int_pair.first.push_back(5); - vec_int_pair.first.push_back(10); - vec_int_pair.first.push_back(15); - vec_int_pair.first.push_back(20); - - vec_vec_pair.first.push_back(5); - vec_vec_pair.first.push_back(10); - vec_vec_pair.first.push_back(15); - vec_vec_pair.first.push_back(20); - vec_vec_pair.second.push_back(5); - vec_vec_pair.second.push_back(10); - vec_vec_pair.second.push_back(15); - vec_vec_pair.second.push_back(20); - - vector_vector_double[0][0] = 100 ; - vector_vector_double[0][1] = 101 ; - vector_vector_double[0][2] = 102 ; - vector_vector_double[1][0] = 103 ; - vector_vector_double[1][1] = 104 ; - vector_vector_double[1][2] = 105 ; - vector_vector_double[2][0] = 106 ; - vector_vector_double[2][1] = 107 ; - vector_vector_double[2][2] = 108 ; - vector_vector_double[3][0] = 109 ; - vector_vector_double[3][1] = 110 ; - vector_vector_double[3][2] = 111 ; - - vector_vector_vector_double[0][0][0] = 0 ; - vector_vector_vector_double[0][0][1] = 1 ; - vector_vector_vector_double[0][0][2] = 2 ; - vector_vector_vector_double[0][1][0] = 3 ; - vector_vector_vector_double[0][1][1] = 4 ; - vector_vector_vector_double[0][1][2] = 5 ; - vector_vector_vector_double[0][2][0] = 6 ; - vector_vector_vector_double[0][2][1] = 7 ; - vector_vector_vector_double[0][2][2] = 8 ; - vector_vector_vector_double[0][3][0] = 9 ; - vector_vector_vector_double[0][3][1] = 10 ; - vector_vector_vector_double[0][3][2] = 11 ; - - vector_vector_vector_double[1][0][0] = 1000 ; - vector_vector_vector_double[1][0][1] = 1001 ; - vector_vector_vector_double[1][0][2] = 1002 ; - vector_vector_vector_double[1][1][0] = 1003 ; - vector_vector_vector_double[1][1][1] = 1004 ; - vector_vector_vector_double[1][1][2] = 1005 ; - vector_vector_vector_double[1][2][0] = 1006 ; - vector_vector_vector_double[1][2][1] = 1007 ; - vector_vector_vector_double[1][2][2] = 1008 ; - vector_vector_vector_double[1][3][0] = 1009 ; - vector_vector_vector_double[1][3][1] = 1010 ; - vector_vector_vector_double[1][3][2] = 1011 ; - - vector_vector_vector_double[2][0][0] = 2000 ; - vector_vector_vector_double[2][0][1] = 2001 ; - vector_vector_vector_double[2][0][2] = 2002 ; - vector_vector_vector_double[2][1][0] = 2003 ; - vector_vector_vector_double[2][1][1] = 2004 ; - vector_vector_vector_double[2][1][2] = 2005 ; - vector_vector_vector_double[2][2][0] = 2006 ; - vector_vector_vector_double[2][2][1] = 2007 ; - vector_vector_vector_double[2][2][2] = 2008 ; - vector_vector_vector_double[2][3][0] = 2009 ; - vector_vector_vector_double[2][3][1] = 2010 ; - vector_vector_vector_double[2][3][2] = 2011 ; - - vector_vector_vector_double[3][0][0] = 3000 ; - vector_vector_vector_double[3][0][1] = 3001 ; - vector_vector_vector_double[3][0][2] = 3002 ; - vector_vector_vector_double[3][1][0] = 3003 ; - vector_vector_vector_double[3][1][1] = 3004 ; - vector_vector_vector_double[3][1][2] = 3005 ; - vector_vector_vector_double[3][2][0] = 3006 ; - vector_vector_vector_double[3][2][1] = 3007 ; - vector_vector_vector_double[3][2][2] = 3008 ; - vector_vector_vector_double[3][3][0] = 3009 ; - vector_vector_vector_double[3][3][1] = 3010 ; - vector_vector_vector_double[3][3][2] = 3011 ; - - vector_vector_vector_double[4][0][0] = 4000 ; - vector_vector_vector_double[4][0][1] = 4001 ; - vector_vector_vector_double[4][0][2] = 4002 ; - vector_vector_vector_double[4][1][0] = 4003 ; - vector_vector_vector_double[4][1][1] = 4004 ; - vector_vector_vector_double[4][1][2] = 4005 ; - vector_vector_vector_double[4][2][0] = 4006 ; - vector_vector_vector_double[4][2][1] = 4007 ; - vector_vector_vector_double[4][2][2] = 4008 ; - vector_vector_vector_double[4][3][0] = 4009 ; - vector_vector_vector_double[4][3][1] = 4010 ; - vector_vector_vector_double[4][3][2] = 4011 ; - - for (int i = 0; i < 10; i++) { - UserClass temp; - for (int j = 0; j < 5; j++) { - temp.a[j] = i+j; - } - temp.b = 8888888888; - temp.c = "Here is a test string"; - - // We'll just make a pointer to the same stuff - - UserClass * user_class_ptr = (UserClass *) TMM_declare_var_s("UserClass"); - for (int j = 0; j < 5; j++) { - user_class_ptr->a[j] = i+j; - } - user_class_ptr->b = 8888888888; - user_class_ptr->c = "Here is a test string"; - - temp.d = user_class_ptr; - - vec_user_simple.emplace_back(temp); - } - - for (int i = 0; i < 10; i++) { - SimpleWrapper temp_wrapper; - temp_wrapper.a = 888; - for (int j = i; j < i+10; j++) { - temp_wrapper.vec.push_back(j); - } - vec_user_defined.emplace_back(temp_wrapper); - } - - for (int i = 0; i < 10; i++) { - SimpleWrapper * temp_wrapper = (SimpleWrapper *) TMM_declare_var_s("SimpleWrapper"); - temp_wrapper->a = 888; - for (int j = i; j < i+10; j++) { - temp_wrapper->vec.push_back(j); - } - vec_user_defined_ptr.push_back(temp_wrapper); - } - - return 0; +int STLCheckpoint::addData() { + dataJobRun = true; + vector_vector_double = std::vector< std::vector< double > >(4, std::vector(3)); + vector_vector_vector_double = std::vector< std::vector< std::vector< double > > >(5, std::vector >(4, std::vector(3))); + + std::cout << "Adding hardcoded data to sim" << std::endl; + + double_map[44.4] = 444.4 ; + double_map[55.5] = 555.5 ; + double_map[66.6] = 666.6 ; + + string_key_map[std::string("four")] = 4 ; + string_key_map[std::string("five")] = 5 ; + string_key_map[std::string("six")] = 6 ; + + string_data_map[7] = std::string("seiben") ; + string_data_map[8] = std::string("acht") ; + string_data_map[9] = std::string("neun") ; + + std::vector< int > v ; + v.push_back(2) ; + v.push_back(4) ; + v.push_back(6) ; + v.push_back(8) ; + map_int_vector_int[1] = v ; + + std::pair< int , int > p ; + p.first = 24 ; + p.second = 30 ; + gcd[p] = 6 ; + + p.first = 50 ; + p.second = 60 ; + std::pair< int , int > q ; + q.first = 70 ; + q.second = 80 ; + map_pair_pair[p] = q ; + + p.first = 3 ; + p.second = 5 ; + v.clear() ; + v.push_back(15) ; + v.push_back(30) ; + v.push_back(45) ; + v.push_back(60) ; + common_multiples.insert(std::pair< std::pair< int, int >, std::vector< int > >(p,v)) ; + + p.first = 3 ; + p.second = 7 ; + v.clear() ; + v.push_back(21) ; + v.push_back(42) ; + v.push_back(84) ; + v.push_back(168) ; + common_multiples.insert(std::pair< std::pair< int, int >, std::vector< int > >(p,v)) ; + + string_map[std::string("sister")] = std::string("Lisa") ; + string_map[std::string("dog")] = std::string("Santa's Little Helper") ; + + int_multimap.insert(std::pair(44,444)) ; + int_multimap.insert(std::pair(55,555)) ; + int_multimap.insert(std::pair(66,666)) ; + int_multimap.insert(std::pair(44,4444)) ; + int_multimap.insert(std::pair(55,5555)) ; + int_multimap.insert(std::pair(66,6666)) ; + + string_key_multimap.insert(std::pair("four", 4)) ; + string_key_multimap.insert(std::pair("five", 5)) ; + string_key_multimap.insert(std::pair("six", 6)) ; + string_key_multimap.insert(std::pair("four", 44)) ; + string_key_multimap.insert(std::pair("five", 55)) ; + string_key_multimap.insert(std::pair("six", 66)) ; + + string_data_multimap.insert(std::pair(7, "seiben")) ; + string_data_multimap.insert(std::pair(8, "acht")) ; + string_data_multimap.insert(std::pair(9, "neun")) ; + string_data_multimap.insert(std::pair(7, "seven")) ; + string_data_multimap.insert(std::pair(8, "eight")) ; + string_data_multimap.insert(std::pair(9, "nine")) ; + + string_multimap.insert(std::pair("sister","Lisa")) ; + string_multimap.insert(std::pair("dog","Santa's Little Helper")) ; + string_multimap.insert(std::pair("sister","Meg")) ; + string_multimap.insert(std::pair("dog","Brian")) ; + + double_vector.push_back(4.0) ; + double_vector.push_back(5.0) ; + double_vector.push_back(6.0) ; + + string_vector.push_back("It") ; + string_vector.push_back("has") ; + string_vector.push_back("the") ; + string_vector.push_back("Wi-Fies") ; + + short_list.push_back(400) ; + short_list.push_back(401) ; + short_list.push_back(402) ; + + string_list.push_back("I") ; + string_list.push_back("don't") ; + string_list.push_back("care") ; + + float_deque.push_back(98.7) ; + float_deque.push_back(65.4) ; + float_deque.push_back(32.1) ; + + string_deque.push_back("Welcome") ; + string_deque.push_back("to") ; + string_deque.push_back("PhoneMart") ; + + int_set.insert(8000) ; + int_set.insert(4000) ; + int_set.insert(2000) ; + int_set.insert(1000) ; + + string_set.insert("efg") ; + string_set.insert("abc") ; + string_set.insert("def") ; + + for (int j = 0; j < 5; j++) { + std::vector temp; + for (int i = j; i < 10; i++) { + temp.push_back(i); + } + vector_set.insert(temp); + } + + pair_set.emplace("One", 1); + pair_set.emplace("Two", 2); + pair_set.emplace("Three", 3); + + std::map m; + m[5] = 500.5; + m[1] = 100.1; + std::map m2; + m2[5] = 5000.5; + m2[1] = 1000.1; + + nested_map_set.insert(m); + nested_map_set.insert(m2); + + for (int j = 0; j < 5; j++) { + std::vector temp; + for (int i = j; i < 10; i++) { + temp.push_back(i); + } + vector_queue.push(temp); + } + + + long_multiset.insert(8000) ; + long_multiset.insert(4000) ; + long_multiset.insert(4000) ; + long_multiset.insert(2000) ; + long_multiset.insert(1000) ; + + string_multiset.insert("efg") ; + string_multiset.insert("abc") ; + string_multiset.insert("def") ; + string_multiset.insert("efg") ; + string_multiset.insert("abc") ; + string_multiset.insert("def") ; + + pair_multiset.emplace(5, 5); + pair_multiset.emplace(5, 5); + pair_multiset.emplace(5, 4); + pair_multiset.emplace(4, 4); + + vec_multiset.emplace(std::vector({1,2,3,4})); + vec_multiset.emplace(std::vector({1,2,3,4})); + vec_multiset.emplace(std::vector({1,2,3,4,5})); + + + uint_stack.push(1) ; + uint_stack.push(2) ; + uint_stack.push(3) ; + uint_stack.push(4) ; + + string_stack.push("I") ; + string_stack.push("want the one") ; + string_stack.push("with the bigger") ; + string_stack.push("Gee Bees") ; + + std::vector temp_v1 = {1, 2, 3, 4}; + std::vector temp_v2 = {5, 6, 7, 8}; + stack_vector_int.push(temp_v1) ; + stack_vector_int.push(temp_v2) ; + + int_queue.push(1) ; + int_queue.push(2) ; + int_queue.push(3) ; + int_queue.push(4) ; + + string_queue.push("I") ; + string_queue.push("want") ; + string_queue.push("an") ; + string_queue.push("iPhone 4") ; + + int_priority_queue.push(3) ; + int_priority_queue.push(2) ; + int_priority_queue.push(4) ; + int_priority_queue.push(1) ; + + string_priority_queue.push("I") ; + string_priority_queue.push("want") ; + string_priority_queue.push("an") ; + string_priority_queue.push("iPhone 4") ; + + queue_vector_int.push(temp_v1) ; + queue_vector_int.push(temp_v2) ; + + priority_queue_vector_int.push(temp_v1) ; + priority_queue_vector_int.push(temp_v2) ; + + int_pair.first = 10 ; + int_pair.second = 20 ; + + string_first_pair.first = "string first" ; + string_first_pair.second = 25 ; + + string_second_pair.first = 25 ; + string_second_pair.second = "string second" ; + + string_pair.first = "pair first string" ; + string_pair.second = "pair second string" ; + + int_pair_int_int.first = 200 ; + p.first = 10 ; + p.second = 20 ; + int_pair_int_int.second = p ; + + p.first = 15 ; + p.second = 12 ; + pair_int_int_int.first = p ; + pair_int_int_int.second = 180 ; + + pair_pair_pair.first.first = 51 ; + pair_pair_pair.first.second = 52 ; + pair_pair_pair.second.first = 53 ; + pair_pair_pair.second.second = 54 ; + + int_vec_pair.first = 5; + int_vec_pair.second.push_back(5); + int_vec_pair.second.push_back(10); + int_vec_pair.second.push_back(15); + int_vec_pair.second.push_back(20); + + vec_int_pair.second = 5; + vec_int_pair.first.push_back(5); + vec_int_pair.first.push_back(10); + vec_int_pair.first.push_back(15); + vec_int_pair.first.push_back(20); + + vec_vec_pair.first.push_back(5); + vec_vec_pair.first.push_back(10); + vec_vec_pair.first.push_back(15); + vec_vec_pair.first.push_back(20); + vec_vec_pair.second.push_back(5); + vec_vec_pair.second.push_back(10); + vec_vec_pair.second.push_back(15); + vec_vec_pair.second.push_back(20); + + vector_vector_double[0][0] = 100 ; + vector_vector_double[0][1] = 101 ; + vector_vector_double[0][2] = 102 ; + vector_vector_double[1][0] = 103 ; + vector_vector_double[1][1] = 104 ; + vector_vector_double[1][2] = 105 ; + vector_vector_double[2][0] = 106 ; + vector_vector_double[2][1] = 107 ; + vector_vector_double[2][2] = 108 ; + vector_vector_double[3][0] = 109 ; + vector_vector_double[3][1] = 110 ; + vector_vector_double[3][2] = 111 ; + + vector_vector_vector_double[0][0][0] = 0 ; + vector_vector_vector_double[0][0][1] = 1 ; + vector_vector_vector_double[0][0][2] = 2 ; + vector_vector_vector_double[0][1][0] = 3 ; + vector_vector_vector_double[0][1][1] = 4 ; + vector_vector_vector_double[0][1][2] = 5 ; + vector_vector_vector_double[0][2][0] = 6 ; + vector_vector_vector_double[0][2][1] = 7 ; + vector_vector_vector_double[0][2][2] = 8 ; + vector_vector_vector_double[0][3][0] = 9 ; + vector_vector_vector_double[0][3][1] = 10 ; + vector_vector_vector_double[0][3][2] = 11 ; + + vector_vector_vector_double[1][0][0] = 1000 ; + vector_vector_vector_double[1][0][1] = 1001 ; + vector_vector_vector_double[1][0][2] = 1002 ; + vector_vector_vector_double[1][1][0] = 1003 ; + vector_vector_vector_double[1][1][1] = 1004 ; + vector_vector_vector_double[1][1][2] = 1005 ; + vector_vector_vector_double[1][2][0] = 1006 ; + vector_vector_vector_double[1][2][1] = 1007 ; + vector_vector_vector_double[1][2][2] = 1008 ; + vector_vector_vector_double[1][3][0] = 1009 ; + vector_vector_vector_double[1][3][1] = 1010 ; + vector_vector_vector_double[1][3][2] = 1011 ; + + vector_vector_vector_double[2][0][0] = 2000 ; + vector_vector_vector_double[2][0][1] = 2001 ; + vector_vector_vector_double[2][0][2] = 2002 ; + vector_vector_vector_double[2][1][0] = 2003 ; + vector_vector_vector_double[2][1][1] = 2004 ; + vector_vector_vector_double[2][1][2] = 2005 ; + vector_vector_vector_double[2][2][0] = 2006 ; + vector_vector_vector_double[2][2][1] = 2007 ; + vector_vector_vector_double[2][2][2] = 2008 ; + vector_vector_vector_double[2][3][0] = 2009 ; + vector_vector_vector_double[2][3][1] = 2010 ; + vector_vector_vector_double[2][3][2] = 2011 ; + + vector_vector_vector_double[3][0][0] = 3000 ; + vector_vector_vector_double[3][0][1] = 3001 ; + vector_vector_vector_double[3][0][2] = 3002 ; + vector_vector_vector_double[3][1][0] = 3003 ; + vector_vector_vector_double[3][1][1] = 3004 ; + vector_vector_vector_double[3][1][2] = 3005 ; + vector_vector_vector_double[3][2][0] = 3006 ; + vector_vector_vector_double[3][2][1] = 3007 ; + vector_vector_vector_double[3][2][2] = 3008 ; + vector_vector_vector_double[3][3][0] = 3009 ; + vector_vector_vector_double[3][3][1] = 3010 ; + vector_vector_vector_double[3][3][2] = 3011 ; + + vector_vector_vector_double[4][0][0] = 4000 ; + vector_vector_vector_double[4][0][1] = 4001 ; + vector_vector_vector_double[4][0][2] = 4002 ; + vector_vector_vector_double[4][1][0] = 4003 ; + vector_vector_vector_double[4][1][1] = 4004 ; + vector_vector_vector_double[4][1][2] = 4005 ; + vector_vector_vector_double[4][2][0] = 4006 ; + vector_vector_vector_double[4][2][1] = 4007 ; + vector_vector_vector_double[4][2][2] = 4008 ; + vector_vector_vector_double[4][3][0] = 4009 ; + vector_vector_vector_double[4][3][1] = 4010 ; + vector_vector_vector_double[4][3][2] = 4011 ; + + for (int i = 0; i < 10; i++) { + UserClass temp; + for (int j = 0; j < 5; j++) { + temp.a[j] = i+j; + } + temp.b = 8888888888; + temp.c = "Here is a test string"; + + // We'll just make a pointer to the same stuff + + UserClass * user_class_ptr = (UserClass *) TMM_declare_var_s("UserClass"); + for (int j = 0; j < 5; j++) { + user_class_ptr->a[j] = i+j; + } + user_class_ptr->b = 8888888888; + user_class_ptr->c = "Here is a test string"; + + temp.d = user_class_ptr; + + vec_user_simple.emplace_back(temp); + } + + for (int i = 0; i < 10; i++) { + SimpleWrapper temp_wrapper; + temp_wrapper.a = 888; + for (int j = i; j < i+10; j++) { + temp_wrapper.vec.push_back(j); + } + vec_user_defined.emplace_back(temp_wrapper); + } + + for (int i = 0; i < 10; i++) { + SimpleWrapper * temp_wrapper = (SimpleWrapper *) TMM_declare_var_s("SimpleWrapper"); + temp_wrapper->a = 888; + for (int j = i; j < i+10; j++) { + temp_wrapper->vec.push_back(j); + } + vec_user_defined_ptr.push_back(temp_wrapper); + } + + return 0; } -int STLCheckpoint::print() { - message_publish(1,"Quack!\n") ; - message_publish(1, "Double vector size: %d", double_vector.size() ); - message_publish(1,"double_vector: %f %f %f\n", double_vector[0], double_vector[1], double_vector[2]) ; - message_publish(1,"vector_vector_double[1]: %f %f %f\n", - vector_vector_double[1][0], vector_vector_double[1][1], vector_vector_double[1][2]) ; - message_publish(1,"vector_vector_vector_double[4][2]: %f %f %f\n", - vector_vector_vector_double[4][2][0], vector_vector_vector_double[4][2][1], vector_vector_vector_double[4][2][2]) ; - message_publish(1,"string_vector[0]: %s\n", string_vector[0].c_str()) ; - message_publish(1,"map_int_vector_int[1][1] = %d\n", map_int_vector_int[1][1]) ; - message_publish(1,"gcd = %d\n", gcd[std::pair(24,30)]) ; - message_publish(1,"common_multiples = %d\n", common_multiples[std::pair(3,5)][1]) ; - message_publish(1,"common_multiples = %d\n", common_multiples[std::pair(3,5)][1]) ; - message_publish(1,"int_pair_int_int.second.second = %d\n", int_pair_int_int.second.second) ; - message_publish(1,"pair_int_int_int.first.second = %d\n", pair_int_int_int.first.second) ; - message_publish(1,"pair_pair_pair.second.first = %d\n", pair_pair_pair.second.first) ; - message_publish(1,"int_queue.front = %d\n", int_queue.front()) ; - message_publish(1,"int_priority_queue.top = %d\n", int_priority_queue.top()) ; - message_publish(1,"uint_stack.top = %d\n", uint_stack.top()) ; - message_publish(1,"queue_vector_int.front()[3] = %d\n", queue_vector_int.front()[3]) ; - message_publish(1,"priority_queue_vector_int.top()[2] = %d\n", priority_queue_vector_int.top()[2]) ; - message_publish(1,"stack_vector_int.top()[1] = %d\n", stack_vector_int.top()[1]) ; - return 0 ; +int STLCheckpoint::print() { + message_publish(1,"Quack!\n") ; + message_publish(1, "Double vector size: %d", double_vector.size() ); + message_publish(1,"double_vector: %f %f %f\n", double_vector[0], double_vector[1], double_vector[2]) ; + message_publish(1,"vector_vector_double[1]: %f %f %f\n", + vector_vector_double[1][0], vector_vector_double[1][1], vector_vector_double[1][2]) ; + message_publish(1,"vector_vector_vector_double[4][2]: %f %f %f\n", + vector_vector_vector_double[4][2][0], vector_vector_vector_double[4][2][1], vector_vector_vector_double[4][2][2]) ; + message_publish(1,"string_vector[0]: %s\n", string_vector[0].c_str()) ; + message_publish(1,"map_int_vector_int[1][1] = %d\n", map_int_vector_int[1][1]) ; + message_publish(1,"gcd = %d\n", gcd[std::pair(24,30)]) ; + message_publish(1,"common_multiples = %d\n", common_multiples[std::pair(3,5)][1]) ; + message_publish(1,"common_multiples = %d\n", common_multiples[std::pair(3,5)][1]) ; + message_publish(1,"int_pair_int_int.second.second = %d\n", int_pair_int_int.second.second) ; + message_publish(1,"pair_int_int_int.first.second = %d\n", pair_int_int_int.first.second) ; + message_publish(1,"pair_pair_pair.second.first = %d\n", pair_pair_pair.second.first) ; + message_publish(1,"int_queue.front = %d\n", int_queue.front()) ; + message_publish(1,"int_priority_queue.top = %d\n", int_priority_queue.top()) ; + message_publish(1,"uint_stack.top = %d\n", uint_stack.top()) ; + message_publish(1,"queue_vector_int.front()[3] = %d\n", queue_vector_int.front()[3]) ; + message_publish(1,"priority_queue_vector_int.top()[2] = %d\n", priority_queue_vector_int.top()[2]) ; + message_publish(1,"stack_vector_int.top()[1] = %d\n", stack_vector_int.top()[1]) ; + return 0 ; } -int STLCheckpoint::test() { - std::cout << "Running test jobs" << std::endl; - const char *test_suite = "STLCheckpoint"; - - TRICK_EXPECT_EQ( double_vector.size(), 3, test_suite, "double_vector size"); - TRICK_EXPECT_EQ( double_vector[0], 4, test_suite, "double_vector[0]"); - TRICK_EXPECT_EQ( double_vector[1], 5, test_suite, "double_vector[1]"); - TRICK_EXPECT_EQ( double_vector[2], 6, test_suite, "double_vector[2]"); - TRICK_EXPECT_EQ( vector_vector_double[1][0], 103, test_suite, "vector_vector_double[1][0]"); - TRICK_EXPECT_EQ( vector_vector_double[1][1], 104, test_suite, "vector_vector_double[1][1]"); - TRICK_EXPECT_EQ( vector_vector_double[1][2], 105, test_suite, "vector_vector_double[1][2]"); - TRICK_EXPECT_EQ( vector_vector_vector_double[4][2][0], 4006, test_suite, "vector_vector_vector_double[4][2][0]"); - TRICK_EXPECT_EQ( vector_vector_vector_double[4][2][1], 4007, test_suite, "vector_vector_vector_double[4][2][1]"); - TRICK_EXPECT_EQ( vector_vector_vector_double[4][2][2], 4008, test_suite, "vector_vector_vector_double[4][2][2]"); - TRICK_EXPECT_EQ( string_vector[0], std::string("It"), test_suite, "string_vector"); - - TRICK_EXPECT_EQ( double_map[44.4], 444.4, test_suite, "double_map[44.4]" ); - - TRICK_EXPECT_EQ( string_data_map[7], std::string("seiben"), test_suite, "string_data_map[7]" ); - TRICK_EXPECT_EQ( string_data_map[9], std::string("neun") , test_suite, "string_data_map[9]"); - - std::vector< int > v ; - v.push_back(2) ; - v.push_back(4) ; - v.push_back(6) ; - v.push_back(8) ; - TRICK_EXPECT_EQ( map_int_vector_int[1], v, test_suite, "map_int_vector_int[1]"); - - std::pair< int , int > p ; - p.first = 24 ; - p.second = 30 ; - TRICK_EXPECT_EQ(gcd[p], 6, test_suite, "gcd[p]" ); - - p.first = 50 ; - p.second = 60 ; - std::pair< int , int > q ; - q.first = 70 ; - q.second = 80 ; - TRICK_EXPECT_EQ( map_pair_pair[p], q, test_suite, "map_pair_pair[p]" ); - - p.first = 3 ; - p.second = 5 ; - v.clear() ; - v.push_back(15) ; - v.push_back(30) ; - v.push_back(45) ; - v.push_back(60) ; - TRICK_EXPECT_EQ( common_multiples[p], v, test_suite, "common_multiples" ); - - p.first = 3 ; - p.second = 7 ; - v.clear() ; - v.push_back(21) ; - v.push_back(42) ; - v.push_back(84) ; - v.push_back(168) ; - TRICK_EXPECT_EQ( common_multiples[p], v, test_suite, "common_multiples" ); - - - TRICK_EXPECT_EQ( string_map["sister"], "Lisa", test_suite, "string_map[sister]" ); - TRICK_EXPECT_EQ( string_map["dog"], "Santa's Little Helper", test_suite, "string_map[dog]" ); - - - // The easiest way to test the multimaps is to just rebuild copies and compare - std::multimap int_multimap_copy; - int_multimap_copy.insert(std::pair(44,444)) ; - int_multimap_copy.insert(std::pair(55,555)) ; - int_multimap_copy.insert(std::pair(66,666)) ; - int_multimap_copy.insert(std::pair(44,4444)) ; - int_multimap_copy.insert(std::pair(55,5555)) ; - int_multimap_copy.insert(std::pair(66,6666)) ; - TRICK_EXPECT_EQ(int_multimap, int_multimap_copy , test_suite, "int_multimap"); - - int_multimap_copy.insert(std::pair(66,66666)) ; - TRICK_EXPECT_NE(int_multimap, int_multimap_copy , test_suite, "int_multimap_fail"); - - std::multimap string_key_multimap_copy; - string_key_multimap_copy.insert(std::pair("four", 4)) ; - string_key_multimap_copy.insert(std::pair("five", 5)) ; - string_key_multimap_copy.insert(std::pair("six", 6)) ; - string_key_multimap_copy.insert(std::pair("four", 44)) ; - string_key_multimap_copy.insert(std::pair("five", 55)) ; - string_key_multimap_copy.insert(std::pair("six", 66)) ; - TRICK_EXPECT_EQ(string_key_multimap, string_key_multimap_copy , test_suite, "string_key_multimap"); - - std::multimap string_data_multimap_copy; - string_data_multimap_copy.insert(std::pair(7, "seiben")) ; - string_data_multimap_copy.insert(std::pair(8, "acht")) ; - string_data_multimap_copy.insert(std::pair(9, "neun")) ; - string_data_multimap_copy.insert(std::pair(7, "seven")) ; - string_data_multimap_copy.insert(std::pair(8, "eight")) ; - string_data_multimap_copy.insert(std::pair(9, "nine")) ; - TRICK_EXPECT_EQ(string_data_multimap, string_data_multimap_copy , test_suite, "string_data_multimap"); - - std::multimap string_multimap_copy; - string_multimap_copy.insert(std::pair("sister","Lisa")) ; - string_multimap_copy.insert(std::pair("dog","Santa's Little Helper")) ; - string_multimap_copy.insert(std::pair("sister","Meg")) ; - string_multimap_copy.insert(std::pair("dog","Brian")) ; - TRICK_EXPECT_EQ(string_multimap, string_multimap_copy , test_suite, "string_multimap"); - - - // TODO: fix this case - // TRICK_EXPECT_EQ(vec_user_defined.size(), 10, test_suite, "vec_user_defined"); - // for (int i = 0; i < vec_user_defined.size(); i++) { - // TRICK_EXPECT_EQ(vec_user_defined[i].vec.size(), 10, test_suite, "vec_user_defined"); - // TRICK_EXPECT_EQ(vec_user_defined[i].a, 888, test_suite, "vec_user_defined"); - // for (int j = i; j < i+vec_user_defined[i].vec.size(); j++) { - // TRICK_EXPECT_EQ(vec_user_defined[i].vec[j-i], j, test_suite, "vec_user_defined"); - // } - // } - - TRICK_EXPECT_EQ(vec_user_defined_ptr.size(), 10, test_suite, "vec_user_defined_ptr"); - for (int i = 0; i < vec_user_defined_ptr.size(); i++) { - TRICK_EXPECT_EQ(vec_user_defined_ptr[i]->vec.size(), 10, test_suite, "vec_user_defined_ptr"); - TRICK_EXPECT_EQ(vec_user_defined_ptr[i]->a, 888, test_suite, "vec_user_defined_ptr"); - std::vector test_vec; - for (int j = i; j < i+vec_user_defined_ptr[i]->vec.size(); j++) { - test_vec.push_back(j); - } - TRICK_EXPECT_EQ(vec_user_defined_ptr[i]->vec, test_vec, test_suite, "vec_user_defined_ptr"); - } - - - std::vector string_vector_copy = {"It", "has", "the", "Wi-Fies"}; - TRICK_EXPECT_EQ(string_vector, string_vector_copy, test_suite, "string_vector"); - - std::list short_list_copy = {400, 401, 402}; - int list_index = 0; - TRICK_EXPECT_EQ(short_list, short_list_copy, test_suite, "short_list"); - - std::list string_list_copy = {"I", "don't", "care"}; - TRICK_EXPECT_EQ(string_list, string_list_copy, test_suite, "string_list"); - - std::deque float_deque_copy = {98.7, 65.4, 32.1}; - TRICK_EXPECT_EQ(float_deque, float_deque_copy, test_suite, "float_deque"); - - std::deque string_deque_copy = {"Welcome", "to", "PhoneMart"}; - TRICK_EXPECT_EQ(string_deque, string_deque_copy, test_suite, "string_deque"); - - std::set int_set_copy = {8000, 4000, 2000, 1000}; - TRICK_EXPECT_EQ(int_set, int_set_copy, test_suite, "int_set"); - - std::set string_set_copy = {"efg", "abc", "def"}; - TRICK_EXPECT_EQ(string_set, string_set_copy, test_suite, "string_set"); - - std::set> vector_set_copy; - for (int j = 0; j < 5; j++) { - std::vector temp; - for (int i = j; i < 10; i++) { - temp.push_back(i); - } - vector_set_copy.insert(temp); - } - TRICK_EXPECT_EQ(vector_set, vector_set_copy, test_suite, "vector_set"); - - std::set> pair_set_copy; - pair_set_copy.emplace("One", 1); - pair_set_copy.emplace("Two", 2); - pair_set_copy.emplace("Three", 3); - TRICK_EXPECT_EQ(pair_set, pair_set_copy, test_suite, "pair_set"); - - std::set> nested_map_set_copy; - std::map m; - m[5] = 500.5; - m[1] = 100.1; - std::map m2; - m2[5] = 5000.5; - m2[1] = 1000.1; - nested_map_set_copy.insert(m); - nested_map_set_copy.insert(m2); - TRICK_EXPECT_EQ(nested_map_set, nested_map_set_copy, test_suite, "nested_map_set"); - - std::queue> vector_queue_copy; - for (int j = 0; j < 5; j++) { - std::vector temp; - for (int i = j; i < 10; i++) { - temp.push_back(i); - } - vector_queue_copy.push(temp); - } - TRICK_EXPECT_EQ(vector_queue, vector_queue_copy, test_suite, "vector_queue"); - - std::multiset long_multiset_copy = {8000, 4000, 4000, 2000, 1000}; - TRICK_EXPECT_EQ(long_multiset, long_multiset_copy, test_suite, "long_multiset"); - - std::multiset string_multiset_copy = {"efg", "abc", "def", "efg", "abc", "def"}; - TRICK_EXPECT_EQ(string_multiset, string_multiset_copy, test_suite, "string_multiset"); - - std::multiset> pair_multiset_copy; - pair_multiset_copy.emplace(5, 5); - pair_multiset_copy.emplace(5, 5); - pair_multiset_copy.emplace(5, 4); - pair_multiset_copy.emplace(4, 4); - TRICK_EXPECT_EQ(pair_multiset, pair_multiset_copy, test_suite, "pair_multiset"); - - std::multiset> vec_multiset_copy; - vec_multiset_copy.emplace(std::vector({1,2,3,4})); - vec_multiset_copy.emplace(std::vector({1,2,3,4})); - vec_multiset_copy.emplace(std::vector({1,2,3,4,5})); - TRICK_EXPECT_EQ(vec_multiset, vec_multiset_copy, test_suite, "vec_multiset"); - - std::stack uint_stack_copy; - uint_stack_copy.push(1) ; - uint_stack_copy.push(2) ; - uint_stack_copy.push(3) ; - uint_stack_copy.push(4) ; - TRICK_EXPECT_EQ(uint_stack, uint_stack_copy, test_suite, "uint_stack"); - - std::stack string_stack_copy; - string_stack_copy.push("I") ; - string_stack_copy.push("want the one") ; - string_stack_copy.push("with the bigger") ; - string_stack_copy.push("Gee Bees") ; - TRICK_EXPECT_EQ(string_stack, string_stack_copy, test_suite, "string_stack"); - - std::stack> stack_vector_int_copy; - std::vector temp_v1 = {1, 2, 3, 4}; - std::vector temp_v2 = {5, 6, 7, 8}; - stack_vector_int_copy.emplace(temp_v1) ; - stack_vector_int_copy.emplace(temp_v2) ; - TRICK_EXPECT_EQ(stack_vector_int, stack_vector_int_copy, test_suite, "stack_vector_int"); - - std::queue int_queue_copy; - int_queue_copy.push(1) ; - int_queue_copy.push(2) ; - int_queue_copy.push(3) ; - int_queue_copy.push(4) ; - TRICK_EXPECT_EQ(int_queue, int_queue_copy, test_suite, "int_queue"); - - std::queue string_queue_copy; - string_queue_copy.push("I") ; - string_queue_copy.push("want") ; - string_queue_copy.push("an") ; - string_queue_copy.push("iPhone 4") ; - TRICK_EXPECT_EQ(string_queue, string_queue_copy, test_suite, "string_queue"); - - // Why doesn't priority_queue have the == operator but literally everything else does >:( - std::priority_queue int_priority_queue_copy; - int_priority_queue_copy.push(3) ; - int_priority_queue_copy.push(2) ; - int_priority_queue_copy.push(4) ; - int_priority_queue_copy.push(1) ; - compare_data_structures_with_top(int_priority_queue_copy, int_priority_queue, "int_priority_queue"); - - std::priority_queue string_priority_queue_copy; - string_priority_queue_copy.push("I") ; - string_priority_queue_copy.push("want") ; - string_priority_queue_copy.push("an") ; - string_priority_queue_copy.push("iPhone 4") ; - compare_data_structures_with_top(string_priority_queue_copy, string_priority_queue, "string_priority_queue"); - - std::queue> queue_vector_int_copy; - queue_vector_int_copy.emplace(temp_v1) ; - queue_vector_int_copy.emplace(temp_v2) ; - TRICK_EXPECT_EQ(queue_vector_int, queue_vector_int_copy, test_suite, "queue_vector_int"); - - std::priority_queue> priority_queue_vector_int_copy; - priority_queue_vector_int_copy.emplace(temp_v1) ; - priority_queue_vector_int_copy.emplace(temp_v2) ; - compare_data_structures_with_top(priority_queue_vector_int_copy, priority_queue_vector_int, "priority_queue_vector_int"); - - std::pair int_pair_copy(10,20); - TRICK_EXPECT_EQ(int_pair, int_pair_copy, test_suite, "int_pair"); - - std::pair< std::string , int > string_first_pair_copy ("string first", 25); - TRICK_EXPECT_EQ(string_first_pair, string_first_pair_copy, test_suite, "string_first_pair"); - - std::pair< int , std::string > string_second_pair_copy (25, "string second"); - TRICK_EXPECT_EQ(string_second_pair_copy, string_second_pair, test_suite, "string_second_pair"); - - std::pair< std::string , std::string > string_pair_copy ("pair first string", "pair second string"); - TRICK_EXPECT_EQ(string_pair_copy, string_pair, test_suite, "string_pair"); - - - std::pair< int , std::pair< int, int > > int_pair_int_int_copy; - int_pair_int_int_copy.first = 200 ; - p.first = 10 ; - p.second = 20 ; - int_pair_int_int_copy.second = p ; - TRICK_EXPECT_EQ(int_pair_int_int_copy, int_pair_int_int, test_suite, "int_pair_int_int"); - - std::pair< std::pair< int, int > , int > pair_int_int_int_copy; - p.first = 15 ; - p.second = 12 ; - pair_int_int_int_copy.first = p ; - pair_int_int_int_copy.second = 180 ; - TRICK_EXPECT_EQ(pair_int_int_int_copy, pair_int_int_int, test_suite, "pair_int_int_int"); - - std::pair< std::pair< int, int > , std::pair< int, int > > pair_pair_pair_copy ; - pair_pair_pair_copy.first.first = 51 ; - pair_pair_pair_copy.first.second = 52 ; - pair_pair_pair_copy.second.first = 53 ; - pair_pair_pair_copy.second.second = 54 ; - TRICK_EXPECT_EQ(pair_pair_pair_copy, pair_pair_pair, test_suite, "pair_pair_pair"); - - // Check all the int/vec combo pairs together, for laziness - TRICK_EXPECT_EQ(int_vec_pair.first, 5, test_suite, "int_vec_pair.first"); - TRICK_EXPECT_EQ(vec_int_pair.second, 5, test_suite, "vec_int_pair.second"); - - TRICK_EXPECT_EQ(int_vec_pair.second.size(), 4, test_suite, "int_vec_pair.second.size"); - TRICK_EXPECT_EQ(vec_int_pair.first.size(), 4, test_suite, "vec_int_pair.first.size"); - TRICK_EXPECT_EQ(vec_vec_pair.first.size(), 4, test_suite, "vec_vec_pair.first.size"); - TRICK_EXPECT_EQ(vec_vec_pair.second.size(), 4, test_suite, "vec_vec_pair.second.size"); - - for (int i = 0; i < int_vec_pair.second.size(); i++) { - TRICK_EXPECT_EQ(int_vec_pair.second[i], (i+1)*5, test_suite, "int_vec_pair.second elems"); - TRICK_EXPECT_EQ(vec_int_pair.first[i], (i+1)*5, test_suite, "vec_int_pair.first elems"); - TRICK_EXPECT_EQ(vec_vec_pair.first[i], (i+1)*5, test_suite, "vec_vec_pair.first elems"); - TRICK_EXPECT_EQ(vec_vec_pair.second[i], (i+1)*5, test_suite, "vec_vec_pair.second elems"); - - } - - - TRICK_EXPECT_EQ(vec_user_simple.size(), 10, test_suite, "vec_user_simple") - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 5; j++) { - TRICK_EXPECT_EQ(vec_user_simple[i].a[j], i+j, test_suite, "vec_user_simple"); - TRICK_EXPECT_EQ(vec_user_simple[i].d->a[j], i+j, test_suite, "vec_user_simple"); - } - - TRICK_EXPECT_EQ(vec_user_simple[i].b, 8888888888, test_suite, "vec_user_simple"); - TRICK_EXPECT_EQ(vec_user_simple[i].d->b, 8888888888, test_suite, "vec_user_simple"); - - TRICK_EXPECT_EQ(vec_user_simple[i].c, "Here is a test string", test_suite, "vec_user_simple"); - TRICK_EXPECT_EQ(vec_user_simple[i].d->c, "Here is a test string", test_suite, "vec_user_simple"); - } - - +int STLCheckpoint::test() { + std::cout << "Running test jobs" << std::endl; + const char *test_suite = "STLCheckpoint"; + + TRICK_EXPECT_EQ( double_vector.size(), 3, test_suite, "double_vector size"); + TRICK_EXPECT_EQ( double_vector[0], 4, test_suite, "double_vector[0]"); + TRICK_EXPECT_EQ( double_vector[1], 5, test_suite, "double_vector[1]"); + TRICK_EXPECT_EQ( double_vector[2], 6, test_suite, "double_vector[2]"); + TRICK_EXPECT_EQ( vector_vector_double[1][0], 103, test_suite, "vector_vector_double[1][0]"); + TRICK_EXPECT_EQ( vector_vector_double[1][1], 104, test_suite, "vector_vector_double[1][1]"); + TRICK_EXPECT_EQ( vector_vector_double[1][2], 105, test_suite, "vector_vector_double[1][2]"); + TRICK_EXPECT_EQ( vector_vector_vector_double[4][2][0], 4006, test_suite, "vector_vector_vector_double[4][2][0]"); + TRICK_EXPECT_EQ( vector_vector_vector_double[4][2][1], 4007, test_suite, "vector_vector_vector_double[4][2][1]"); + TRICK_EXPECT_EQ( vector_vector_vector_double[4][2][2], 4008, test_suite, "vector_vector_vector_double[4][2][2]"); + TRICK_EXPECT_EQ( string_vector[0], std::string("It"), test_suite, "string_vector"); + + TRICK_EXPECT_EQ( double_map[44.4], 444.4, test_suite, "double_map[44.4]" ); + + TRICK_EXPECT_EQ( string_data_map[7], std::string("seiben"), test_suite, "string_data_map[7]" ); + TRICK_EXPECT_EQ( string_data_map[9], std::string("neun") , test_suite, "string_data_map[9]"); + + std::vector< int > v ; + v.push_back(2) ; + v.push_back(4) ; + v.push_back(6) ; + v.push_back(8) ; + TRICK_EXPECT_EQ( map_int_vector_int[1], v, test_suite, "map_int_vector_int[1]"); + + std::pair< int , int > p ; + p.first = 24 ; + p.second = 30 ; + TRICK_EXPECT_EQ(gcd[p], 6, test_suite, "gcd[p]" ); + + p.first = 50 ; + p.second = 60 ; + std::pair< int , int > q ; + q.first = 70 ; + q.second = 80 ; + TRICK_EXPECT_EQ( map_pair_pair[p], q, test_suite, "map_pair_pair[p]" ); + + p.first = 3 ; + p.second = 5 ; + v.clear() ; + v.push_back(15) ; + v.push_back(30) ; + v.push_back(45) ; + v.push_back(60) ; + TRICK_EXPECT_EQ( common_multiples[p], v, test_suite, "common_multiples" ); + + p.first = 3 ; + p.second = 7 ; + v.clear() ; + v.push_back(21) ; + v.push_back(42) ; + v.push_back(84) ; + v.push_back(168) ; + TRICK_EXPECT_EQ( common_multiples[p], v, test_suite, "common_multiples" ); + + + TRICK_EXPECT_EQ( string_map["sister"], "Lisa", test_suite, "string_map[sister]" ); + TRICK_EXPECT_EQ( string_map["dog"], "Santa's Little Helper", test_suite, "string_map[dog]" ); + + + // The easiest way to test the multimaps is to just rebuild copies and compare + std::multimap int_multimap_copy; + int_multimap_copy.insert(std::pair(44,444)) ; + int_multimap_copy.insert(std::pair(55,555)) ; + int_multimap_copy.insert(std::pair(66,666)) ; + int_multimap_copy.insert(std::pair(44,4444)) ; + int_multimap_copy.insert(std::pair(55,5555)) ; + int_multimap_copy.insert(std::pair(66,6666)) ; + TRICK_EXPECT_EQ(int_multimap, int_multimap_copy , test_suite, "int_multimap"); + + int_multimap_copy.insert(std::pair(66,66666)) ; + TRICK_EXPECT_NE(int_multimap, int_multimap_copy , test_suite, "int_multimap_fail"); + + std::multimap string_key_multimap_copy; + string_key_multimap_copy.insert(std::pair("four", 4)) ; + string_key_multimap_copy.insert(std::pair("five", 5)) ; + string_key_multimap_copy.insert(std::pair("six", 6)) ; + string_key_multimap_copy.insert(std::pair("four", 44)) ; + string_key_multimap_copy.insert(std::pair("five", 55)) ; + string_key_multimap_copy.insert(std::pair("six", 66)) ; + TRICK_EXPECT_EQ(string_key_multimap, string_key_multimap_copy , test_suite, "string_key_multimap"); + + std::multimap string_data_multimap_copy; + string_data_multimap_copy.insert(std::pair(7, "seiben")) ; + string_data_multimap_copy.insert(std::pair(8, "acht")) ; + string_data_multimap_copy.insert(std::pair(9, "neun")) ; + string_data_multimap_copy.insert(std::pair(7, "seven")) ; + string_data_multimap_copy.insert(std::pair(8, "eight")) ; + string_data_multimap_copy.insert(std::pair(9, "nine")) ; + TRICK_EXPECT_EQ(string_data_multimap, string_data_multimap_copy , test_suite, "string_data_multimap"); + + std::multimap string_multimap_copy; + string_multimap_copy.insert(std::pair("sister","Lisa")) ; + string_multimap_copy.insert(std::pair("dog","Santa's Little Helper")) ; + string_multimap_copy.insert(std::pair("sister","Meg")) ; + string_multimap_copy.insert(std::pair("dog","Brian")) ; + TRICK_EXPECT_EQ(string_multimap, string_multimap_copy , test_suite, "string_multimap"); + + + // TODO: fix this case + // TRICK_EXPECT_EQ(vec_user_defined.size(), 10, test_suite, "vec_user_defined"); + // for (int i = 0; i < vec_user_defined.size(); i++) { + // TRICK_EXPECT_EQ(vec_user_defined[i].vec.size(), 10, test_suite, "vec_user_defined"); + // TRICK_EXPECT_EQ(vec_user_defined[i].a, 888, test_suite, "vec_user_defined"); + // for (int j = i; j < i+vec_user_defined[i].vec.size(); j++) { + // TRICK_EXPECT_EQ(vec_user_defined[i].vec[j-i], j, test_suite, "vec_user_defined"); + // } + // } + + TRICK_EXPECT_EQ(vec_user_defined_ptr.size(), 10, test_suite, "vec_user_defined_ptr"); + for (int i = 0; i < vec_user_defined_ptr.size(); i++) { + TRICK_EXPECT_EQ(vec_user_defined_ptr[i]->vec.size(), 10, test_suite, "vec_user_defined_ptr"); + TRICK_EXPECT_EQ(vec_user_defined_ptr[i]->a, 888, test_suite, "vec_user_defined_ptr"); + std::vector test_vec; + for (int j = i; j < i+vec_user_defined_ptr[i]->vec.size(); j++) { + test_vec.push_back(j); + } + TRICK_EXPECT_EQ(vec_user_defined_ptr[i]->vec, test_vec, test_suite, "vec_user_defined_ptr"); + } + + + std::vector string_vector_copy = {"It", "has", "the", "Wi-Fies"}; + TRICK_EXPECT_EQ(string_vector, string_vector_copy, test_suite, "string_vector"); + + std::list short_list_copy = {400, 401, 402}; + int list_index = 0; + TRICK_EXPECT_EQ(short_list, short_list_copy, test_suite, "short_list"); + + std::list string_list_copy = {"I", "don't", "care"}; + TRICK_EXPECT_EQ(string_list, string_list_copy, test_suite, "string_list"); + + std::deque float_deque_copy = {98.7, 65.4, 32.1}; + TRICK_EXPECT_EQ(float_deque, float_deque_copy, test_suite, "float_deque"); + + std::deque string_deque_copy = {"Welcome", "to", "PhoneMart"}; + TRICK_EXPECT_EQ(string_deque, string_deque_copy, test_suite, "string_deque"); + + std::set int_set_copy = {8000, 4000, 2000, 1000}; + TRICK_EXPECT_EQ(int_set, int_set_copy, test_suite, "int_set"); + + std::set string_set_copy = {"efg", "abc", "def"}; + TRICK_EXPECT_EQ(string_set, string_set_copy, test_suite, "string_set"); + + std::set> vector_set_copy; + for (int j = 0; j < 5; j++) { + std::vector temp; + for (int i = j; i < 10; i++) { + temp.push_back(i); + } + vector_set_copy.insert(temp); + } + TRICK_EXPECT_EQ(vector_set, vector_set_copy, test_suite, "vector_set"); + + std::set> pair_set_copy; + pair_set_copy.emplace("One", 1); + pair_set_copy.emplace("Two", 2); + pair_set_copy.emplace("Three", 3); + TRICK_EXPECT_EQ(pair_set, pair_set_copy, test_suite, "pair_set"); + + std::set> nested_map_set_copy; + std::map m; + m[5] = 500.5; + m[1] = 100.1; + std::map m2; + m2[5] = 5000.5; + m2[1] = 1000.1; + nested_map_set_copy.insert(m); + nested_map_set_copy.insert(m2); + TRICK_EXPECT_EQ(nested_map_set, nested_map_set_copy, test_suite, "nested_map_set"); + + std::queue> vector_queue_copy; + for (int j = 0; j < 5; j++) { + std::vector temp; + for (int i = j; i < 10; i++) { + temp.push_back(i); + } + vector_queue_copy.push(temp); + } + TRICK_EXPECT_EQ(vector_queue, vector_queue_copy, test_suite, "vector_queue"); + + std::multiset long_multiset_copy = {8000, 4000, 4000, 2000, 1000}; + TRICK_EXPECT_EQ(long_multiset, long_multiset_copy, test_suite, "long_multiset"); + + std::multiset string_multiset_copy = {"efg", "abc", "def", "efg", "abc", "def"}; + TRICK_EXPECT_EQ(string_multiset, string_multiset_copy, test_suite, "string_multiset"); + + std::multiset> pair_multiset_copy; + pair_multiset_copy.emplace(5, 5); + pair_multiset_copy.emplace(5, 5); + pair_multiset_copy.emplace(5, 4); + pair_multiset_copy.emplace(4, 4); + TRICK_EXPECT_EQ(pair_multiset, pair_multiset_copy, test_suite, "pair_multiset"); + + std::multiset> vec_multiset_copy; + vec_multiset_copy.emplace(std::vector({1,2,3,4})); + vec_multiset_copy.emplace(std::vector({1,2,3,4})); + vec_multiset_copy.emplace(std::vector({1,2,3,4,5})); + TRICK_EXPECT_EQ(vec_multiset, vec_multiset_copy, test_suite, "vec_multiset"); + + std::stack uint_stack_copy; + uint_stack_copy.push(1) ; + uint_stack_copy.push(2) ; + uint_stack_copy.push(3) ; + uint_stack_copy.push(4) ; + TRICK_EXPECT_EQ(uint_stack, uint_stack_copy, test_suite, "uint_stack"); + + std::stack string_stack_copy; + string_stack_copy.push("I") ; + string_stack_copy.push("want the one") ; + string_stack_copy.push("with the bigger") ; + string_stack_copy.push("Gee Bees") ; + TRICK_EXPECT_EQ(string_stack, string_stack_copy, test_suite, "string_stack"); + + std::stack> stack_vector_int_copy; + std::vector temp_v1 = {1, 2, 3, 4}; + std::vector temp_v2 = {5, 6, 7, 8}; + stack_vector_int_copy.emplace(temp_v1) ; + stack_vector_int_copy.emplace(temp_v2) ; + TRICK_EXPECT_EQ(stack_vector_int, stack_vector_int_copy, test_suite, "stack_vector_int"); + + std::queue int_queue_copy; + int_queue_copy.push(1) ; + int_queue_copy.push(2) ; + int_queue_copy.push(3) ; + int_queue_copy.push(4) ; + TRICK_EXPECT_EQ(int_queue, int_queue_copy, test_suite, "int_queue"); + + std::queue string_queue_copy; + string_queue_copy.push("I") ; + string_queue_copy.push("want") ; + string_queue_copy.push("an") ; + string_queue_copy.push("iPhone 4") ; + TRICK_EXPECT_EQ(string_queue, string_queue_copy, test_suite, "string_queue"); + + // Why doesn't priority_queue have the == operator but literally everything else does >:( + std::priority_queue int_priority_queue_copy; + int_priority_queue_copy.push(3) ; + int_priority_queue_copy.push(2) ; + int_priority_queue_copy.push(4) ; + int_priority_queue_copy.push(1) ; + compare_data_structures_with_top(int_priority_queue_copy, int_priority_queue, "int_priority_queue"); + + std::priority_queue string_priority_queue_copy; + string_priority_queue_copy.push("I") ; + string_priority_queue_copy.push("want") ; + string_priority_queue_copy.push("an") ; + string_priority_queue_copy.push("iPhone 4") ; + compare_data_structures_with_top(string_priority_queue_copy, string_priority_queue, "string_priority_queue"); + + std::queue> queue_vector_int_copy; + queue_vector_int_copy.emplace(temp_v1) ; + queue_vector_int_copy.emplace(temp_v2) ; + TRICK_EXPECT_EQ(queue_vector_int, queue_vector_int_copy, test_suite, "queue_vector_int"); + + std::priority_queue> priority_queue_vector_int_copy; + priority_queue_vector_int_copy.emplace(temp_v1) ; + priority_queue_vector_int_copy.emplace(temp_v2) ; + compare_data_structures_with_top(priority_queue_vector_int_copy, priority_queue_vector_int, "priority_queue_vector_int"); + + std::pair int_pair_copy(10,20); + TRICK_EXPECT_EQ(int_pair, int_pair_copy, test_suite, "int_pair"); + + std::pair< std::string , int > string_first_pair_copy ("string first", 25); + TRICK_EXPECT_EQ(string_first_pair, string_first_pair_copy, test_suite, "string_first_pair"); + + std::pair< int , std::string > string_second_pair_copy (25, "string second"); + TRICK_EXPECT_EQ(string_second_pair_copy, string_second_pair, test_suite, "string_second_pair"); + + std::pair< std::string , std::string > string_pair_copy ("pair first string", "pair second string"); + TRICK_EXPECT_EQ(string_pair_copy, string_pair, test_suite, "string_pair"); + + + std::pair< int , std::pair< int, int > > int_pair_int_int_copy; + int_pair_int_int_copy.first = 200 ; + p.first = 10 ; + p.second = 20 ; + int_pair_int_int_copy.second = p ; + TRICK_EXPECT_EQ(int_pair_int_int_copy, int_pair_int_int, test_suite, "int_pair_int_int"); + + std::pair< std::pair< int, int > , int > pair_int_int_int_copy; + p.first = 15 ; + p.second = 12 ; + pair_int_int_int_copy.first = p ; + pair_int_int_int_copy.second = 180 ; + TRICK_EXPECT_EQ(pair_int_int_int_copy, pair_int_int_int, test_suite, "pair_int_int_int"); + + std::pair< std::pair< int, int > , std::pair< int, int > > pair_pair_pair_copy ; + pair_pair_pair_copy.first.first = 51 ; + pair_pair_pair_copy.first.second = 52 ; + pair_pair_pair_copy.second.first = 53 ; + pair_pair_pair_copy.second.second = 54 ; + TRICK_EXPECT_EQ(pair_pair_pair_copy, pair_pair_pair, test_suite, "pair_pair_pair"); + + // Check all the int/vec combo pairs together, for laziness + TRICK_EXPECT_EQ(int_vec_pair.first, 5, test_suite, "int_vec_pair.first"); + TRICK_EXPECT_EQ(vec_int_pair.second, 5, test_suite, "vec_int_pair.second"); + + TRICK_EXPECT_EQ(int_vec_pair.second.size(), 4, test_suite, "int_vec_pair.second.size"); + TRICK_EXPECT_EQ(vec_int_pair.first.size(), 4, test_suite, "vec_int_pair.first.size"); + TRICK_EXPECT_EQ(vec_vec_pair.first.size(), 4, test_suite, "vec_vec_pair.first.size"); + TRICK_EXPECT_EQ(vec_vec_pair.second.size(), 4, test_suite, "vec_vec_pair.second.size"); + + for (int i = 0; i < int_vec_pair.second.size(); i++) { + TRICK_EXPECT_EQ(int_vec_pair.second[i], (i+1)*5, test_suite, "int_vec_pair.second elems"); + TRICK_EXPECT_EQ(vec_int_pair.first[i], (i+1)*5, test_suite, "vec_int_pair.first elems"); + TRICK_EXPECT_EQ(vec_vec_pair.first[i], (i+1)*5, test_suite, "vec_vec_pair.first elems"); + TRICK_EXPECT_EQ(vec_vec_pair.second[i], (i+1)*5, test_suite, "vec_vec_pair.second elems"); + + } + + + TRICK_EXPECT_EQ(vec_user_simple.size(), 10, test_suite, "vec_user_simple") + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 5; j++) { + TRICK_EXPECT_EQ(vec_user_simple[i].a[j], i+j, test_suite, "vec_user_simple"); + TRICK_EXPECT_EQ(vec_user_simple[i].d->a[j], i+j, test_suite, "vec_user_simple"); + } + + TRICK_EXPECT_EQ(vec_user_simple[i].b, 8888888888, test_suite, "vec_user_simple"); + TRICK_EXPECT_EQ(vec_user_simple[i].d->b, 8888888888, test_suite, "vec_user_simple"); + + TRICK_EXPECT_EQ(vec_user_simple[i].c, "Here is a test string", test_suite, "vec_user_simple"); + TRICK_EXPECT_EQ(vec_user_simple[i].d->c, "Here is a test string", test_suite, "vec_user_simple"); + } + + } diff --git a/test/SIM_target_specific_variables/models/many/a.cpp b/test/SIM_target_specific_variables/models/many/a.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/many/a.cpp +++ b/test/SIM_target_specific_variables/models/many/a.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_target_specific_variables/models/many/b.cpp b/test/SIM_target_specific_variables/models/many/b.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/many/b.cpp +++ b/test/SIM_target_specific_variables/models/many/b.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_target_specific_variables/models/many/c.cpp b/test/SIM_target_specific_variables/models/many/c.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/many/c.cpp +++ b/test/SIM_target_specific_variables/models/many/c.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_target_specific_variables/models/nested/x.cpp b/test/SIM_target_specific_variables/models/nested/x.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/nested/x.cpp +++ b/test/SIM_target_specific_variables/models/nested/x.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_target_specific_variables/models/nested/y/y.cpp b/test/SIM_target_specific_variables/models/nested/y/y.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/nested/y/y.cpp +++ b/test/SIM_target_specific_variables/models/nested/y/y.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_target_specific_variables/models/nested/z/z.cpp b/test/SIM_target_specific_variables/models/nested/z/z.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/nested/z/z.cpp +++ b/test/SIM_target_specific_variables/models/nested/z/z.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_target_specific_variables/models/one/1.cpp b/test/SIM_target_specific_variables/models/one/1.cpp index b23abf618..6b61dd292 100644 --- a/test/SIM_target_specific_variables/models/one/1.cpp +++ b/test/SIM_target_specific_variables/models/one/1.cpp @@ -1 +1 @@ -/* /* */ +/* /* */ diff --git a/test/SIM_test_dr/models/dr/src/DR.cpp b/test/SIM_test_dr/models/dr/src/DR.cpp index 0a68d7264..aa7adbacd 100644 --- a/test/SIM_test_dr/models/dr/src/DR.cpp +++ b/test/SIM_test_dr/models/dr/src/DR.cpp @@ -1,14 +1,14 @@ -/******************************TRICK HEADER************************************* -PURPOSE: ( Test data record ) -REFERENCE: ( None ) -ASSUMPTIONS AND LIMITATIONS: ( None ) -CLASS: ( scheduled ) -LIBRARY DEPENDENCY: ( DR.o ) -PROGRAMMERS: ( (Lindsay Landry) (L3) (7-22-2013) ) +/******************************TRICK HEADER************************************* +PURPOSE: ( Test data record ) +REFERENCE: ( None ) +ASSUMPTIONS AND LIMITATIONS: ( None ) +CLASS: ( scheduled ) +LIBRARY DEPENDENCY: ( DR.o ) +PROGRAMMERS: ( (Lindsay Landry) (L3) (7-22-2013) ) *******************************************************************************/ -#include -#include "../include/DR.hh" +#include +#include "../include/DR.hh" -DRTypes::DRTypes() {} -DRTypes::~DRTypes() {} +DRTypes::DRTypes() {} +DRTypes::~DRTypes() {} diff --git a/test/SIM_test_dr/models/dr/src/DR_default_data.cpp b/test/SIM_test_dr/models/dr/src/DR_default_data.cpp index 38ac316be..5e655b951 100644 --- a/test/SIM_test_dr/models/dr/src/DR_default_data.cpp +++ b/test/SIM_test_dr/models/dr/src/DR_default_data.cpp @@ -1,104 +1,104 @@ -/******************************TRICK HEADER************************************* -PURPOSE: ( Test data record ) -REFERENCE: ( None ) -ASSUMPTIONS AND LIMITATIONS: ( None ) -CLASS: ( scheduled ) -LIBRARY DEPENDENCY: ( DR.o ) -PROGRAMMERS: ( (Lindsay Landry) (L3) (7-22-2013) ) +/******************************TRICK HEADER************************************* +PURPOSE: ( Test data record ) +REFERENCE: ( None ) +ASSUMPTIONS AND LIMITATIONS: ( None ) +CLASS: ( scheduled ) +LIBRARY DEPENDENCY: ( DR.o ) +PROGRAMMERS: ( (Lindsay Landry) (L3) (7-22-2013) ) *******************************************************************************/ -#include "../include/DR.hh" +#include "../include/DR.hh" -int DRTypes::init() { +int DRTypes::init() { - a = 'a'; //char - b = 'b'; //unsigned char - c = -1234; //short - d = 1234; //unsigned short - e = -123456; //int - f = 123456; //unsigned int - g = -1234567; //long - h = 123456789; //unsigned long - i = 1234.5678; //float - j = -1234.567890; //double - k = -12345678912345;//long long - l = 12345678912345; //unsigned long - m = false; //boolean - n = THREE; //enumerated type - o = "3 May. Bistritz.—Left Munich at 8:35 P. M., on 1st May, arriving at Vienna early next morning; should have arrived at 6:46, but train was an hour late. Buda-Pesth seems a wonderful place, from the glimpse which I got of it from the train and the little I could walk through the streets. I feared to go very far from the station, as we had arrived late and would start as near the correct time as possible. The impression I had was that we were leaving the West and entering the East; the most western of splendid bridges over the Danube, which is here of noble width and depth, took us among the traditions of Turkish rule."; - p = "We left in pretty good time, and came after nightfall to Klausenburgh. Here I stopped for the night at the Hotel Royale. I had for dinner, or rather supper, a chicken done up some way with red pepper, which was very good but thirsty. (Mem., get recipe for Mina.) I asked the waiter, and he said it was called “paprika hendl,” and that, as it was a national dish, I should be able to get it anywhere along the Carpathians. I found my smattering of German very useful here; indeed, I don't know how I should be able to get on without it."; - for (int i = 0; i < 5; i++) { - q[i] = i; + a = 'a'; //char + b = 'b'; //unsigned char + c = -1234; //short + d = 1234; //unsigned short + e = -123456; //int + f = 123456; //unsigned int + g = -1234567; //long + h = 123456789; //unsigned long + i = 1234.5678; //float + j = -1234.567890; //double + k = -12345678912345;//long long + l = 12345678912345; //unsigned long + m = false; //boolean + n = THREE; //enumerated type + o = "3 May. Bistritz.—Left Munich at 8:35 P. M., on 1st May, arriving at Vienna early next morning; should have arrived at 6:46, but train was an hour late. Buda-Pesth seems a wonderful place, from the glimpse which I got of it from the train and the little I could walk through the streets. I feared to go very far from the station, as we had arrived late and would start as near the correct time as possible. The impression I had was that we were leaving the West and entering the East; the most western of splendid bridges over the Danube, which is here of noble width and depth, took us among the traditions of Turkish rule."; + p = "We left in pretty good time, and came after nightfall to Klausenburgh. Here I stopped for the night at the Hotel Royale. I had for dinner, or rather supper, a chicken done up some way with red pepper, which was very good but thirsty. (Mem., get recipe for Mina.) I asked the waiter, and he said it was called “paprika hendl,” and that, as it was a national dish, I should be able to get it anywhere along the Carpathians. I found my smattering of German very useful here; indeed, I don't know how I should be able to get on without it."; + for (int i = 0; i < 5; i++) { + q[i] = i; } - r[0][0] = 10; - r[0][1] = 20; - r[1][0] = 30; - r[1][1] = 40; + r[0][0] = 10; + r[0][1] = 20; + r[1][0] = 30; + r[1][1] = 40; /*============================================================================ - Bitfields - ============================================================================ + Bitfields + ============================================================================ UNSIGNED - var1: Larger value than will fit - var2: Min value - var3: Middle value - var4: Max value + var1: Larger value than will fit + var2: Min value + var3: Middle value + var4: Max value */ - /* Unsigned Int */ - //14 5 12 1 - uintB.var1 = (1 << 14) + (1 << 14/2); - uintB.var2 = 0; - uintB.var3 = (1 << 12/2) - 1; - uintB.var4 = (1 << 1) - 1; + /* Unsigned Int */ + //14 5 12 1 + uintB.var1 = (1 << 14) + (1 << 14/2); + uintB.var2 = 0; + uintB.var3 = (1 << 12/2) - 1; + uintB.var4 = (1 << 1) - 1; - /* Unsigned Char */ - // 3 2 2 1 - ucharB.var1 = (1 << 3) + (1 << 3/2); - ucharB.var2 = 0; - ucharB.var3 = (1 << 2/2) - 1; - ucharB.var4 = (1 << 1) - 1; + /* Unsigned Char */ + // 3 2 2 1 + ucharB.var1 = (1 << 3) + (1 << 3/2); + ucharB.var2 = 0; + ucharB.var3 = (1 << 2/2) - 1; + ucharB.var4 = (1 << 1) - 1; - /* Unsigned Short */ - // 4 2 9 1 - ushortB.var1 = (1 << 4) + (1 << 4/2); - ushortB.var2 = 0; - ushortB.var3 = (1 << 9/2) - 1; - ushortB.var4 = (1 << 1) - 1; + /* Unsigned Short */ + // 4 2 9 1 + ushortB.var1 = (1 << 4) + (1 << 4/2); + ushortB.var2 = 0; + ushortB.var3 = (1 << 9/2) - 1; + ushortB.var4 = (1 << 1) - 1; /* SIGNED - var1: Max positive value - var2: Max negative value - var3: Zero - var4: Too large value -> negative + var1: Max positive value + var2: Max negative value + var3: Zero + var4: Too large value -> negative */ - /* Int */ - // 7 16 3 6 - intB.var1 = (1 << (7 - 1)) - 1; - intB.var2 = -(1 << (16 - 1)); - intB.var3 = 0; - intB.var4 = (1 << (6 - 1)) + (1 << 6/2);; + /* Int */ + // 7 16 3 6 + intB.var1 = (1 << (7 - 1)) - 1; + intB.var2 = -(1 << (16 - 1)); + intB.var3 = 0; + intB.var4 = (1 << (6 - 1)) + (1 << 6/2);; - /* Char */ - // 2 2 2 2 - charB.var1 = (1 << (2 - 1)) - 1; - charB.var2 = -(1 << (2 - 1)); - charB.var3 = 0; - charB.var4 = (1 << (2 - 1)) + (1 << 2/2);; + /* Char */ + // 2 2 2 2 + charB.var1 = (1 << (2 - 1)) - 1; + charB.var2 = -(1 << (2 - 1)); + charB.var3 = 0; + charB.var4 = (1 << (2 - 1)) + (1 << 2/2);; - /* Short */ - // 8 1 2 5 - shortB.var1 = (1 << (8 - 1)) - 1; - shortB.var2 = -(1 << (1 - 1)); - shortB.var3 = 0; - shortB.var4 = (1 << (5 - 1)) + (1 << 5/2);; + /* Short */ + // 8 1 2 5 + shortB.var1 = (1 << (8 - 1)) - 1; + shortB.var2 = -(1 << (1 - 1)); + shortB.var3 = 0; + shortB.var4 = (1 << (5 - 1)) + (1 << 5/2);; - /* Mixed Types */ - // 3 8 9 12 - mixB.var1 = (1 << (3 - 1)) - 1; - mixB.var2 = -(1 << (8 - 1)); - mixB.var3 = 0; - mixB.var4 = (1 << (12 - 1)) + (1 << 12/2);; + /* Mixed Types */ + // 3 8 9 12 + mixB.var1 = (1 << (3 - 1)) - 1; + mixB.var2 = -(1 << (8 - 1)); + mixB.var3 = 0; + mixB.var4 = (1 << (12 - 1)) + (1 << 12/2);; - return (0); + return (0); } diff --git a/test/SIM_test_ip/models/test_ip/src/ClassOfEverything.cpp b/test/SIM_test_ip/models/test_ip/src/ClassOfEverything.cpp index cfd352e1b..cbb4c2944 100644 --- a/test/SIM_test_ip/models/test_ip/src/ClassOfEverything.cpp +++ b/test/SIM_test_ip/models/test_ip/src/ClassOfEverything.cpp @@ -1,21 +1,21 @@ -#include "test_ip/include/ClassOfEverything.hh" +#include "test_ip/include/ClassOfEverything.hh" -double ClassOfEverything::sdaa[3][3] ; -const double ClassOfEverything::scd = 1.2345 ; -const double ClassOfEverything::csd = 6.7890 ; -const double ClassOfEverything::sdc = 9.8765 ; +double ClassOfEverything::sdaa[3][3] ; +const double ClassOfEverything::scd = 1.2345 ; +const double ClassOfEverything::csd = 6.7890 ; +const double ClassOfEverything::sdc = 9.8765 ; -ClassOfEverything::ClassOfEverything() : cir(i), icr(i) { +ClassOfEverything::ClassOfEverything() : cir(i), icr(i) { - unsigned int ii ; + unsigned int ii ; - ep = NULL ; - epp = NULL ; + ep = NULL ; + epp = NULL ; - for ( ii = 0 ; ii < 4 ; ii++ ) { - eap[ii] = NULL ; - } + for ( ii = 0 ; ii < 4 ; ii++ ) { + eap[ii] = NULL ; + } } diff --git a/test/SIM_test_output_dir/models/starter.cpp b/test/SIM_test_output_dir/models/starter.cpp index 30809e266..c2f10c748 100644 --- a/test/SIM_test_output_dir/models/starter.cpp +++ b/test/SIM_test_output_dir/models/starter.cpp @@ -1,66 +1,66 @@ -#include -#include "starter.h" -#include "trick/integrator_c_intf.h" -#include "trick/exec_proto.h" -#include "trick/message_proto.h" -#include "trick/mm_macros.hh" +#include +#include "starter.h" +#include "trick/integrator_c_intf.h" +#include "trick/exec_proto.h" +#include "trick/message_proto.h" +#include "trick/mm_macros.hh" -Starter::Starter() { +Starter::Starter() { } -int Starter::default_data() { - // Allocate a dynamic object - DynamicObj * obj = new DynamicObj() ; - obj->a = 5; - obj->b = "Hello world!"; - obj->c = (double *) malloc (sizeof(double) * 3); - obj->c[0] = 0.0; - obj->c[1] = 1.0; - obj->c[2] = 2.0; +int Starter::default_data() { + // Allocate a dynamic object + DynamicObj * obj = new DynamicObj() ; + obj->a = 5; + obj->b = "Hello world!"; + obj->c = (double *) malloc (sizeof(double) * 3); + obj->c[0] = 0.0; + obj->c[1] = 1.0; + obj->c[2] = 2.0; - TMM_declare_ext_var(obj, TRICK_STRUCTURED,"DynamicObj", 0, "DynamicObj_alloc", 0, NULL) ; + TMM_declare_ext_var(obj, TRICK_STRUCTURED,"DynamicObj", 0, "DynamicObj_alloc", 0, NULL) ; - return 0; + return 0; } -int Starter::init() { - return 0; +int Starter::init() { + return 0; } -int Starter::scheduled() { - message_publish(MSG_NORMAL, "Hello World!\n"); - return 0; +int Starter::scheduled() { + message_publish(MSG_NORMAL, "Hello World!\n"); + return 0; } -int Starter::deriv() { - return 0; +int Starter::deriv() { + return 0; } -int Starter::integ() { +int Starter::integ() { - int ipass; - load_state( - NULL /* list is NULL terminated */ - ); + int ipass; + load_state( + NULL /* list is NULL terminated */ + ); - /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */ - load_deriv( - NULL /* list is NULL terminated */ - ); + /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */ + load_deriv( + NULL /* list is NULL terminated */ + ); - /* Call the Trick integrate service */ - ipass = integrate(); + /* Call the Trick integrate service */ + ipass = integrate(); - /* unload new state */ - unload_state( - NULL /* list is NULL terminated */ - ); + /* unload new state */ + unload_state( + NULL /* list is NULL terminated */ + ); - /* returns 0 if integerate() was successful */ - return ipass; + /* returns 0 if integerate() was successful */ + return ipass; } -int Starter::shutdown() { - return 0; +int Starter::shutdown() { + return 0; } diff --git a/test/SIM_test_varserv/models/test_client/test_client.cpp b/test/SIM_test_varserv/models/test_client/test_client.cpp index fc36f7134..6430c1e1b 100644 --- a/test/SIM_test_varserv/models/test_client/test_client.cpp +++ b/test/SIM_test_varserv/models/test_client/test_client.cpp @@ -1,1565 +1,1565 @@ -#include "test_client.hh" -#include "trick/var_binary_parser.hh" -#include - - -class VariableServerUDPTest : public ::testing::Test { - protected: - VariableServerUDPTest() { - socket_status = socket.init("localhost", 48000, SOCK_DGRAM); - - if (socket_status == 0) { - std::stringstream request; - request << "trick.var_set_client_tag(\"UDP_VSTest"; - request << numSession++; - request << "\") \n"; - - socket << request.str(); - } - } - ~VariableServerUDPTest() { - socket.close(); - } - - Socket socket; - int socket_status; - - static int numSession; +#include "test_client.hh" +#include "trick/var_binary_parser.hh" +#include + + +class VariableServerUDPTest : public ::testing::Test { + protected: + VariableServerUDPTest() { + socket_status = socket.init("localhost", 48000, SOCK_DGRAM); + + if (socket_status == 0) { + std::stringstream request; + request << "trick.var_set_client_tag(\"UDP_VSTest"; + request << numSession++; + request << "\") \n"; + + socket << request.str(); + } + } + ~VariableServerUDPTest() { + socket.close(); + } + + Socket socket; + int socket_status; + + static int numSession; }; -class VariableServerTestAltListener : public ::testing::Test { - protected: - VariableServerTestAltListener() { - socket_status = socket.init("localhost", 49000); - - if (socket_status == 0) { - std::stringstream request; - request << "trick.var_set_client_tag(\"altListener_VSTest"; - request << numSession++; - request << "\") \n"; - - socket << request.str(); - } - } - ~VariableServerTestAltListener() { - socket << "trick.var_exit()\n"; - socket.close(); - } - - Socket socket; - int socket_status; - - static int numSession; +class VariableServerTestAltListener : public ::testing::Test { + protected: + VariableServerTestAltListener() { + socket_status = socket.init("localhost", 49000); + + if (socket_status == 0) { + std::stringstream request; + request << "trick.var_set_client_tag(\"altListener_VSTest"; + request << numSession++; + request << "\") \n"; + + socket << request.str(); + } + } + ~VariableServerTestAltListener() { + socket << "trick.var_exit()\n"; + socket.close(); + } + + Socket socket; + int socket_status; + + static int numSession; }; -int VariableServerTest::numSession = 0; -int VariableServerUDPTest::numSession = 0; -int VariableServerTestAltListener::numSession = 0; - -#ifndef __APPLE__ -class VariableServerTestMulticast : public ::testing::Test { - protected: - VariableServerTestMulticast() { - socket_status = socket.init("", 47000, SOCK_DGRAM); - socket_status = multicast_listener.init_multicast("224.10.10.10", 47000); - - if (socket_status == 0) { - std::stringstream request; - request << "trick.var_set_client_tag(\"multicast_VSTest"; - request << numSession++; - request << "\") \n"; - - socket << request.str(); - } - } - ~VariableServerTestMulticast() { - socket.close(); - multicast_listener.close(); - } - - Socket socket; - Socket multicast_listener; - - int socket_status; - - static int numSession; +int VariableServerTest::numSession = 0; +int VariableServerUDPTest::numSession = 0; +int VariableServerTestAltListener::numSession = 0; + +#ifndef __APPLE__ +class VariableServerTestMulticast : public ::testing::Test { + protected: + VariableServerTestMulticast() { + socket_status = socket.init("", 47000, SOCK_DGRAM); + socket_status = multicast_listener.init_multicast("224.10.10.10", 47000); + + if (socket_status == 0) { + std::stringstream request; + request << "trick.var_set_client_tag(\"multicast_VSTest"; + request << numSession++; + request << "\") \n"; + + socket << request.str(); + } + } + ~VariableServerTestMulticast() { + socket.close(); + multicast_listener.close(); + } + + Socket socket; + Socket multicast_listener; + + int socket_status; + + static int numSession; }; -int VariableServerTestMulticast::numSession = 0; +int VariableServerTestMulticast::numSession = 0; #endif /**********************************************************/ -/* Helpful constants and functions */ +/* Helpful constants and functions */ /**********************************************************/ -const int MODE_RUN = 5; -const int MODE_FREEZE = 1; - -int strcmp_IgnoringWhiteSpace(std::string s1_str, std::string s2_str) { - const char * s1 = s1_str.c_str(); - const char * s2 = s2_str.c_str(); - - int i1 = 0; - int i2 = 0; - - while (1) { - while ( !isgraph( s1[i1] ) && s1[i1] != '\0') { i1++; } - while ( !isgraph( s2[i2] ) && s2[i2] != '\0') { i2++; } - if ( s1[i1] == '\0' && s2[i2] == '\0') { return 0; } - if ( s1[i1] != s2[i2]) { - if (s1[i1] < s2[i2]) { - return -1; - } else { - return 1; - } - } - i1++; i2++; - } +const int MODE_RUN = 5; +const int MODE_FREEZE = 1; + +int strcmp_IgnoringWhiteSpace(std::string s1_str, std::string s2_str) { + const char * s1 = s1_str.c_str(); + const char * s2 = s2_str.c_str(); + + int i1 = 0; + int i2 = 0; + + while (1) { + while ( !isgraph( s1[i1] ) && s1[i1] != '\0') { i1++; } + while ( !isgraph( s2[i2] ) && s2[i2] != '\0') { i2++; } + if ( s1[i1] == '\0' && s2[i2] == '\0') { return 0; } + if ( s1[i1] != s2[i2]) { + if (s1[i1] < s2[i2]) { + return -1; + } else { + return 1; + } + } + i1++; i2++; + } } -void spin (Socket& socket, int wait_cycles = 5) { - for (int i = 0; i < wait_cycles; i++) - socket.receive(); +void spin (Socket& socket, int wait_cycles = 5) { + for (int i = 0; i < wait_cycles; i++) + socket.receive(); } -void wait_for_mode_change (Socket& socket, int expected_mode, int max_wait_iterations = 10) { - int iteration = 0; - std::string mode_reply; - std::string expected_reply = "5\t" + std::to_string(expected_mode) + "\n"; - while (iteration++ < max_wait_iterations) { - socket << "trick.var_send_once(\"trick_sys.sched.mode\")\n"; - socket >> mode_reply; - if (mode_reply == expected_reply) - break; - } +void wait_for_mode_change (Socket& socket, int expected_mode, int max_wait_iterations = 10) { + int iteration = 0; + std::string mode_reply; + std::string expected_reply = "5\t" + std::to_string(expected_mode) + "\n"; + while (iteration++ < max_wait_iterations) { + socket << "trick.var_send_once(\"trick_sys.sched.mode\")\n"; + socket >> mode_reply; + if (mode_reply == expected_reply) + break; + } } -void dump_checkpoint (Socket& socket, const std::string& checkpoint_name) { - socket << "trick.var_pause()\ntrick.exec_freeze()\n"; - wait_for_mode_change(socket, MODE_FREEZE); +void dump_checkpoint (Socket& socket, const std::string& checkpoint_name) { + socket << "trick.var_pause()\ntrick.exec_freeze()\n"; + wait_for_mode_change(socket, MODE_FREEZE); - std::string checkpoint_cmd = "trick.checkpoint(\"" + checkpoint_name + "\")\n"; - socket << checkpoint_cmd; + std::string checkpoint_cmd = "trick.checkpoint(\"" + checkpoint_name + "\")\n"; + socket << checkpoint_cmd; - socket << "trick.exec_run()\n"; - wait_for_mode_change(socket, MODE_RUN); - socket << "trick.var_unpause()\n"; + socket << "trick.exec_run()\n"; + wait_for_mode_change(socket, MODE_RUN); + socket << "trick.var_unpause()\n"; } -void load_checkpoint (Socket& socket, const std::string& checkpoint_name) { - socket << "trick.var_pause()\ntrick.exec_freeze()\n"; - wait_for_mode_change(socket, MODE_FREEZE); +void load_checkpoint (Socket& socket, const std::string& checkpoint_name) { + socket << "trick.var_pause()\ntrick.exec_freeze()\n"; + wait_for_mode_change(socket, MODE_FREEZE); - std::string checkpoint_cmd = "trick.load_checkpoint(\"" + checkpoint_name + "\")\n"; - socket << checkpoint_cmd; - sleep(5); + std::string checkpoint_cmd = "trick.load_checkpoint(\"" + checkpoint_name + "\")\n"; + socket << checkpoint_cmd; + sleep(5); - socket << "trick.exec_run()\n"; - wait_for_mode_change(socket, MODE_RUN); - socket << "trick.var_unpause()\n"; + socket << "trick.exec_run()\n"; + wait_for_mode_change(socket, MODE_RUN); + socket << "trick.var_unpause()\n"; } /*****************************************/ -/* Multicast Test */ +/* Multicast Test */ /*****************************************/ -#ifndef __APPLE__ +#ifndef __APPLE__ -TEST_F (VariableServerTestMulticast, Strings) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTestMulticast, Strings) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - socket << "trick.var_send_once(\"vsx.vst.o\")\n"; - std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); + std::string reply; + socket << "trick.var_send_once(\"vsx.vst.o\")\n"; + std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); - multicast_listener >> reply; + multicast_listener >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); - socket << "trick.var_send_once(\"vsx.vst.p\")\n"; + expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); + socket << "trick.var_send_once(\"vsx.vst.p\")\n"; - multicast_listener >> reply; + multicast_listener >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTestMulticast, AddRemove) { - if (socket_status != 0) { - FAIL(); - } - - std::string reply; - std::string expected; - - int max_tries = 3; - int tries = 0; - - socket << "trick.var_add(\"vsx.vst.c\")\n"; - multicast_listener >> reply; - expected = std::string("0 -1234"); - - tries = 0; - while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { - multicast_listener >> reply; - } - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; - - multicast_listener >> reply; - tries = 0; - while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { - multicast_listener >> reply; - } - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; - - socket << "trick.var_add(\"vsx.vst.m\")\n"; - multicast_listener >> reply; - expected = std::string("0 -1234 1"); - tries = 0; - while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { - multicast_listener >> reply; - } - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; - - socket << "trick.var_remove(\"vsx.vst.m\")\n"; - multicast_listener >> reply; - expected = std::string("0 -1234"); - tries = 0; - while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { - multicast_listener >> reply; - } - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; - - socket << "trick.var_add(\"vsx.vst.n\")\n"; - multicast_listener >> reply; - expected = std::string("0 -1234 0,1,2,3,4"); - tries = 0; - while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { - multicast_listener >> reply; - } - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; - - socket << "trick.var_exit()\n"; +TEST_F (VariableServerTestMulticast, AddRemove) { + if (socket_status != 0) { + FAIL(); + } + + std::string reply; + std::string expected; + + int max_tries = 3; + int tries = 0; + + socket << "trick.var_add(\"vsx.vst.c\")\n"; + multicast_listener >> reply; + expected = std::string("0 -1234"); + + tries = 0; + while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { + multicast_listener >> reply; + } + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; + + multicast_listener >> reply; + tries = 0; + while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { + multicast_listener >> reply; + } + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; + + socket << "trick.var_add(\"vsx.vst.m\")\n"; + multicast_listener >> reply; + expected = std::string("0 -1234 1"); + tries = 0; + while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { + multicast_listener >> reply; + } + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; + + socket << "trick.var_remove(\"vsx.vst.m\")\n"; + multicast_listener >> reply; + expected = std::string("0 -1234"); + tries = 0; + while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { + multicast_listener >> reply; + } + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; + + socket << "trick.var_add(\"vsx.vst.n\")\n"; + multicast_listener >> reply; + expected = std::string("0 -1234 0,1,2,3,4"); + tries = 0; + while (strcmp_IgnoringWhiteSpace(reply, expected) != 0 && tries++ < max_tries) { + multicast_listener >> reply; + } + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Expected: " << expected << "\tAcutal: " << reply; + + socket << "trick.var_exit()\n"; } #endif /************************************/ -/* UDP Tests */ +/* UDP Tests */ /************************************/ -TEST_F (VariableServerUDPTest, Strings) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerUDPTest, Strings) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - socket << "trick.var_send_once(\"vsx.vst.o\")\n"; - socket >> reply; - std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); + std::string reply; + socket << "trick.var_send_once(\"vsx.vst.o\")\n"; + socket >> reply; + std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); - socket << "trick.var_send_once(\"vsx.vst.p\")\n"; + expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); + socket << "trick.var_send_once(\"vsx.vst.p\")\n"; - socket >> reply; + socket >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerUDPTest, AddRemove) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerUDPTest, AddRemove) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.c\")\n"; - socket >> reply; - expected = std::string("0 -1234"); + socket << "trick.var_add(\"vsx.vst.c\")\n"; + socket >> reply; + expected = std::string("0 -1234"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket >> reply; + socket >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0 -1234 1"); - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_add(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0 -1234 1"); + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_remove(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0 -1234"); - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_remove(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0 -1234"); + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.n\")\n"; - socket >> reply; - expected = std::string("0 -1234 0,1,2,3,4"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_add(\"vsx.vst.n\")\n"; + socket >> reply; + expected = std::string("0 -1234 0,1,2,3,4"); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_exit()\n"; + socket << "trick.var_exit()\n"; } /*********************************************/ -/* Alt Listener Tests */ +/* Alt Listener Tests */ /*********************************************/ -TEST_F (VariableServerTestAltListener, Strings) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTestAltListener, Strings) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - socket << "trick.var_send_once(\"vsx.vst.o\")\n"; - socket >> reply; - std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); + std::string reply; + socket << "trick.var_send_once(\"vsx.vst.o\")\n"; + socket >> reply; + std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); - socket << "trick.var_send_once(\"vsx.vst.p\")\n"; + expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); + socket << "trick.var_send_once(\"vsx.vst.p\")\n"; - socket >> reply; + socket >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTestAltListener, AddRemove) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTestAltListener, AddRemove) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.c\")\n"; - socket >> reply; - expected = std::string("0 -1234"); + socket << "trick.var_add(\"vsx.vst.c\")\n"; + socket >> reply; + expected = std::string("0 -1234"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket >> reply; + socket >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0 -1234 1"); - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_add(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0 -1234 1"); + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_remove(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0 -1234"); - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_remove(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0 -1234"); + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.n\")\n"; - socket >> reply; - expected = std::string("0 -1234 0,1,2,3,4"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_add(\"vsx.vst.n\")\n"; + socket >> reply; + expected = std::string("0 -1234 0,1,2,3,4"); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTestAltListener, RestartAndSet) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTestAltListener, RestartAndSet) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.c\")\n"; - socket >> reply; - expected = std::string("0\t-1234\n"); + socket << "trick.var_add(\"vsx.vst.c\")\n"; + socket >> reply; + expected = std::string("0\t-1234\n"); - EXPECT_EQ(reply, expected); + EXPECT_EQ(reply, expected); - dump_checkpoint(socket, "reload_file.ckpnt"); + dump_checkpoint(socket, "reload_file.ckpnt"); - socket << "trick.var_add(\"vsx.vst.e\",\"m\")\n"; - socket >> reply; - expected = std::string("0\t-1234\t-123456 {m}\n"); + socket << "trick.var_add(\"vsx.vst.e\",\"m\")\n"; + socket >> reply; + expected = std::string("0\t-1234\t-123456 {m}\n"); - socket << "trick.var_set(\"vsx.vst.c\", 5)\n"; - socket >> reply; - expected = std::string("0\t5\t-123456 {m}\n"); + socket << "trick.var_set(\"vsx.vst.c\", 5)\n"; + socket >> reply; + expected = std::string("0\t5\t-123456 {m}\n"); - EXPECT_EQ(reply, expected); + EXPECT_EQ(reply, expected); - load_checkpoint(socket, "RUN_test/reload_file.ckpnt"); + load_checkpoint(socket, "RUN_test/reload_file.ckpnt"); - socket >> reply; - expected = std::string("0\t-1234\t-123456 {m}\n"); + socket >> reply; + expected = std::string("0\t-1234\t-123456 {m}\n"); - EXPECT_EQ(reply, expected); + EXPECT_EQ(reply, expected); } /*********************************************/ -/* Normal case tests */ +/* Normal case tests */ /*********************************************/ -TEST_F (VariableServerTest, Strings) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, Strings) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - socket << "trick.var_send_once(\"vsx.vst.o\")\n"; - socket >> reply; - std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); + std::string reply; + socket << "trick.var_send_once(\"vsx.vst.o\")\n"; + socket >> reply; + std::string expected("5\tYou will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking."); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); - socket << "trick.var_send_once(\"vsx.vst.p\")\n"; + expected = std::string("5\tI am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling?"); + socket << "trick.var_send_once(\"vsx.vst.p\")\n"; - socket >> reply; + socket >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - // TODO: Does wchar actually work? - // expected = std::string("5\tThis breeze, which has travelled from the regions towards which I am advancing, gives me a foretaste of those icy climes. Inspirited by this wind of promise, my daydreams become more fervent and vivid."); - // socket << "trick.var_send_once(\"vsx.vst.q\")\n"; + // TODO: Does wchar actually work? + // expected = std::string("5\tThis breeze, which has travelled from the regions towards which I am advancing, gives me a foretaste of those icy climes. Inspirited by this wind of promise, my daydreams become more fervent and vivid."); + // socket << "trick.var_send_once(\"vsx.vst.q\")\n"; - // socket >> reply; + // socket >> reply; - // std::cout << "\tExpected: " << expected << "\n\tActual: " << reply << std::endl; + // std::cout << "\tExpected: " << expected << "\n\tActual: " << reply << std::endl; - // EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + // EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTest, NoExtraTab) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, NoExtraTab) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.c\")\n"; - socket >> reply; - expected = std::string("0\t-1234\n"); + socket << "trick.var_add(\"vsx.vst.c\")\n"; + socket >> reply; + expected = std::string("0\t-1234\n"); - EXPECT_STREQ(reply.c_str(), expected.c_str()); + EXPECT_STREQ(reply.c_str(), expected.c_str()); - socket >> reply; + socket >> reply; - EXPECT_STREQ(reply.c_str(), expected.c_str()); + EXPECT_STREQ(reply.c_str(), expected.c_str()); - socket << "trick.var_add(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0\t-1234\t1\n"); - - EXPECT_STREQ(reply.c_str(), expected.c_str()); + socket << "trick.var_add(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0\t-1234\t1\n"); + + EXPECT_STREQ(reply.c_str(), expected.c_str()); - socket << "trick.var_remove(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0\t-1234\n"); + socket << "trick.var_remove(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0\t-1234\n"); - socket << "trick.var_add(\"vsx.vst.n\")\n"; - socket >> reply; - expected = std::string("0\t-1234\t0,1,2,3,4\n"); - - EXPECT_STREQ(reply.c_str(), expected.c_str()); + socket << "trick.var_add(\"vsx.vst.n\")\n"; + socket >> reply; + expected = std::string("0\t-1234\t0,1,2,3,4\n"); + + EXPECT_STREQ(reply.c_str(), expected.c_str()); } -TEST_F (VariableServerTest, AddRemove) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, AddRemove) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.c\")\n"; - socket >> reply; - expected = std::string("0 -1234"); + socket << "trick.var_add(\"vsx.vst.c\")\n"; + socket >> reply; + expected = std::string("0 -1234"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket >> reply; + socket >> reply; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0 -1234 1"); - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_add(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0 -1234 1"); + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_remove(\"vsx.vst.m\")\n"; - socket >> reply; - expected = std::string("0 -1234"); - - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_remove(\"vsx.vst.m\")\n"; + socket >> reply; + expected = std::string("0 -1234"); + + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.n\")\n"; - socket >> reply; - expected = std::string("0 -1234 0,1,2,3,4"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + socket << "trick.var_add(\"vsx.vst.n\")\n"; + socket >> reply; + expected = std::string("0 -1234 0,1,2,3,4"); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTest, BadRefResponse) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, BadRefResponse) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - std::cerr << "The purpose of this test is to cause an error. Error messages are expected." << std::endl; + std::cerr << "The purpose of this test is to cause an error. Error messages are expected." << std::endl; - socket << "trick.var_send_once(\"vsx.vst.no_such_variable\")\n"; - socket >> reply; - expected = std::string("5 BAD_REF"); + socket << "trick.var_send_once(\"vsx.vst.no_such_variable\")\n"; + socket >> reply; + expected = std::string("5 BAD_REF"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTest, Units) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, Units) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - std::cerr << "The purpose of this test is to cause an error. Error messages are expected." << std::endl; - socket << "trick.var_add(\"vsx.vst.c\")\ntrick.var_units(\"vsx.vst.c\",\"g\")\n"; - socket >> reply; - expected = std::string("0 -1234"); + std::cerr << "The purpose of this test is to cause an error. Error messages are expected." << std::endl; + socket << "trick.var_add(\"vsx.vst.c\")\ntrick.var_units(\"vsx.vst.c\",\"g\")\n"; + socket >> reply; + expected = std::string("0 -1234"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_add(\"vsx.vst.e\",\"m\")\n"; - socket >> reply; - expected = std::string("0 -1234 -123456 {m}"); + socket << "trick.var_add(\"vsx.vst.e\",\"m\")\n"; + socket >> reply; + expected = std::string("0 -1234 -123456 {m}"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_units(\"vsx.vst.e\",\"ft\")\n"; - socket >> reply; - expected = std::string("0 -1234 -405039 {ft}"); + socket << "trick.var_units(\"vsx.vst.e\",\"ft\")\n"; + socket >> reply; + expected = std::string("0 -1234 -405039 {ft}"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); } -TEST_F (VariableServerTest, dump_info) { - if (socket_status != 0) { - FAIL(); - } - socket << "trick.var_add(\"vsx.vst.c\")\n"; +TEST_F (VariableServerTest, dump_info) { + if (socket_status != 0) { + FAIL(); + } + socket << "trick.var_add(\"vsx.vst.c\")\n"; - std::string command = "trick.var_server_list_connections()\n"; - socket << command; - sleep(1); + std::string command = "trick.var_server_list_connections()\n"; + socket << command; + sleep(1); } -TEST_F (VariableServerTest, SendOnce) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, SendOnce) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_send_once(\"vsx.vst.e\")\n"; - socket >> reply; - expected = std::string("5 -123456"); + socket << "trick.var_send_once(\"vsx.vst.e\")\n"; + socket >> reply; + expected = std::string("5 -123456"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - // Check that nothing is sent cyclically - EXPECT_EQ(socket.check_for_message_availible(), false); + // Check that nothing is sent cyclically + EXPECT_EQ(socket.check_for_message_availible(), false); - socket << "trick.var_send_once(\"vsx.vst.n[0], vsx.vst.n[1], vsx.vst.n[2],\", 3)\n"; - socket >> reply; - expected = std::string("5 0 1 2"); + socket << "trick.var_send_once(\"vsx.vst.n[0], vsx.vst.n[1], vsx.vst.n[2],\", 3)\n"; + socket >> reply; + expected = std::string("5 0 1 2"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - std::cerr << "The purpose of this test is to cause an error. Error messages are expected." << std::endl; - socket << "trick.var_send_once(\"vsx.vst.n[0], vsx.vst.n[1], vsx.vst.n[2],\", 4)\n"; + std::cerr << "The purpose of this test is to cause an error. Error messages are expected." << std::endl; + socket << "trick.var_send_once(\"vsx.vst.n[0], vsx.vst.n[1], vsx.vst.n[2],\", 4)\n"; - // Wrong number of variables, should not send a response but should see an error message from the Trick side - EXPECT_EQ(socket.check_for_message_availible(), false); + // Wrong number of variables, should not send a response but should see an error message from the Trick side + EXPECT_EQ(socket.check_for_message_availible(), false); } -TEST_F (VariableServerTest, Exists) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, Exists) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_exists(\"vsx.vst.e\")\n"; - socket >> reply; - expected = std::string("1 1"); + socket << "trick.var_exists(\"vsx.vst.e\")\n"; + socket >> reply; + expected = std::string("1 1"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_exists(\"vsx.vst.z\")\n"; - socket >> reply; - expected = std::string("1 0"); + socket << "trick.var_exists(\"vsx.vst.z\")\n"; + socket >> reply; + expected = std::string("1 0"); - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0); - socket << "trick.var_binary()\n"; + socket << "trick.var_binary()\n"; - std::vector actual_bytes; - std::vector expected_bytes; - socket << "trick.var_exists(\"vsx.vst.e\")\n"; - actual_bytes = socket.receive_bytes(); - expected_bytes = {0x01, 0x00, 0x00, 0x00, 0x01}; + std::vector actual_bytes; + std::vector expected_bytes; + socket << "trick.var_exists(\"vsx.vst.e\")\n"; + actual_bytes = socket.receive_bytes(); + expected_bytes = {0x01, 0x00, 0x00, 0x00, 0x01}; - EXPECT_EQ(expected_bytes, actual_bytes); + EXPECT_EQ(expected_bytes, actual_bytes); - socket << "trick.var_exists(\"vsx.vst.z\")\n"; - actual_bytes = socket.receive_bytes(); - expected_bytes = {0x01, 0x00, 0x00, 0x00, 0x00}; + socket << "trick.var_exists(\"vsx.vst.z\")\n"; + actual_bytes = socket.receive_bytes(); + expected_bytes = {0x01, 0x00, 0x00, 0x00, 0x00}; - EXPECT_EQ(expected_bytes, actual_bytes); + EXPECT_EQ(expected_bytes, actual_bytes); } -TEST_F (VariableServerTest, ListSize) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, ListSize) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.a\")\ntrick.var_add(\"vsx.vst.b\")\ntrick.var_add(\"vsx.vst.c\")\ntrick.var_add(\"vsx.vst.d\")\ntrick.var_pause()\n"; - socket << "trick.var_send_list_size()\n"; + socket << "trick.var_add(\"vsx.vst.a\")\ntrick.var_add(\"vsx.vst.b\")\ntrick.var_add(\"vsx.vst.c\")\ntrick.var_add(\"vsx.vst.d\")\ntrick.var_pause()\n"; + socket << "trick.var_send_list_size()\n"; - socket >> reply; - expected = "3 4"; + socket >> reply; + expected = "3 4"; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Reply: " << reply << "\tExpected: " << expected; + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Reply: " << reply << "\tExpected: " << expected; - // Adding a variable to the list more than once is allowed - socket << "trick.var_add(\"vsx.vst.a\")\n"; - socket << "trick.var_send_list_size()\n"; + // Adding a variable to the list more than once is allowed + socket << "trick.var_add(\"vsx.vst.a\")\n"; + socket << "trick.var_send_list_size()\n"; - socket >> reply; - expected = "3 5"; + socket >> reply; + expected = "3 5"; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Reply: " << reply << "\tExpected: " << expected; + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply, expected), 0) << "Reply: " << reply << "\tExpected: " << expected; - socket << "trick.var_add(\"vsx.vst.e\")\ntrick.var_binary()\ntrick.var_send_list_size()\n"; + socket << "trick.var_add(\"vsx.vst.e\")\ntrick.var_binary()\ntrick.var_send_list_size()\n"; - std::vector actual_bytes; - std::vector expected_bytes; - actual_bytes = socket.receive_bytes(); - expected_bytes = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00}; + std::vector actual_bytes; + std::vector expected_bytes; + actual_bytes = socket.receive_bytes(); + expected_bytes = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00}; - EXPECT_EQ(expected_bytes, actual_bytes); + EXPECT_EQ(expected_bytes, actual_bytes); } -TEST_F (VariableServerTest, bitfields) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, bitfields) { + if (socket_status != 0) { + FAIL(); + } - socket << "trick.var_send_once(\"vsx.vst.my_bitfield.var1,vsx.vst.my_bitfield.var2,vsx.vst.my_bitfield.var3,vsx.vst.my_bitfield.var4\", 4)\n"; - std::string reply_str; - socket >> reply_str; + socket << "trick.var_send_once(\"vsx.vst.my_bitfield.var1,vsx.vst.my_bitfield.var2,vsx.vst.my_bitfield.var3,vsx.vst.my_bitfield.var4\", 4)\n"; + std::string reply_str; + socket >> reply_str; - EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply_str, "5 3 -128 0 2112"), 0); + EXPECT_EQ(strcmp_IgnoringWhiteSpace(reply_str, "5 3 -128 0 2112"), 0); - socket << "trick.var_binary()\ntrick.var_send_once(\"vsx.vst.my_bitfield.var1,vsx.vst.my_bitfield.var2,vsx.vst.my_bitfield.var3,vsx.vst.my_bitfield.var4\", 4)\n"; + socket << "trick.var_binary()\ntrick.var_send_once(\"vsx.vst.my_bitfield.var1,vsx.vst.my_bitfield.var2,vsx.vst.my_bitfield.var3,vsx.vst.my_bitfield.var4\", 4)\n"; - std::vector reply = socket.receive_bytes(); + std::vector reply = socket.receive_bytes(); - ParsedBinaryMessage message; - try { - message.parse(reply); - } catch (const MalformedMessageException& ex) { - FAIL() << "Parser threw an exception: " << ex.what(); - } + ParsedBinaryMessage message; + try { + message.parse(reply); + } catch (const MalformedMessageException& ex) { + FAIL() << "Parser threw an exception: " << ex.what(); + } - for (int i = 0; i < message.getNumVars(); i++) { - EXPECT_TRUE(message.variables[i].getType() == 12 || message.variables[i].getType() == 13); - } + for (int i = 0; i < message.getNumVars(); i++) { + EXPECT_TRUE(message.variables[i].getType() == 12 || message.variables[i].getType() == 13); + } } -TEST_F (VariableServerTest, transmit_file) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, transmit_file) { + if (socket_status != 0) { + FAIL(); + } - socket << "trick.send_file(\"file_to_send.txt\")\n"; + socket << "trick.send_file(\"file_to_send.txt\")\n"; - std::stringstream file_contents; + std::stringstream file_contents; - while (socket.check_for_message_availible()) { - socket >> file_contents; - } + while (socket.check_for_message_availible()) { + socket >> file_contents; + } - std::ifstream actual_file("file_to_send.txt"); - std::string expected_contents; - getline(actual_file, expected_contents); + std::ifstream actual_file("file_to_send.txt"); + std::string expected_contents; + getline(actual_file, expected_contents); - std::string expected_header = "2\t" + std::to_string(expected_contents.size()); + std::string expected_header = "2\t" + std::to_string(expected_contents.size()); - std::string test_line; + std::string test_line; - std::getline(file_contents, test_line); - EXPECT_EQ(test_line, expected_header); + std::getline(file_contents, test_line); + EXPECT_EQ(test_line, expected_header); - std::getline(file_contents, test_line); - EXPECT_EQ(test_line, expected_contents); + std::getline(file_contents, test_line); + EXPECT_EQ(test_line, expected_contents); } -TEST_F (VariableServerTest, SendSieResource) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, SendSieResource) { + if (socket_status != 0) { + FAIL(); + } - socket << "trick.send_sie_resource()\n"; + socket << "trick.send_sie_resource()\n"; - std::stringstream received_file; + std::stringstream received_file; - while (socket.check_for_message_availible()) { - socket >> received_file; - } + while (socket.check_for_message_availible()) { + socket >> received_file; + } - std::string first_line; - std::getline(received_file, first_line); + std::string first_line; + std::getline(received_file, first_line); - // We're not gonna bother comparing the contents - // Just check to see that the message type is correct - ASSERT_EQ(first_line.at(0), '2'); + // We're not gonna bother comparing the contents + // Just check to see that the message type is correct + ASSERT_EQ(first_line.at(0), '2'); } -TEST_F (VariableServerTest, SendSieClass) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, SendSieClass) { + if (socket_status != 0) { + FAIL(); + } - socket << "trick.send_sie_class()\n"; + socket << "trick.send_sie_class()\n"; - std::stringstream received_file; - std::string file_temp; + std::stringstream received_file; + std::string file_temp; - while (socket.check_for_message_availible()) { - socket >> file_temp; - received_file << file_temp; - } + while (socket.check_for_message_availible()) { + socket >> file_temp; + received_file << file_temp; + } - std::string first_line; - std::getline(received_file, first_line); + std::string first_line; + std::getline(received_file, first_line); - // We're not gonna bother comparing the contents - // Just check to see that the message type is correct - ASSERT_EQ(first_line.at(0), '2'); + // We're not gonna bother comparing the contents + // Just check to see that the message type is correct + ASSERT_EQ(first_line.at(0), '2'); } -TEST_F (VariableServerTest, SendSieEnum) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, SendSieEnum) { + if (socket_status != 0) { + FAIL(); + } - socket << "trick.send_sie_enum()\n"; + socket << "trick.send_sie_enum()\n"; - std::stringstream received_file; - std::string file_temp; + std::stringstream received_file; + std::string file_temp; - while (socket.check_for_message_availible()) { - socket >> file_temp; - received_file << file_temp; - } + while (socket.check_for_message_availible()) { + socket >> file_temp; + received_file << file_temp; + } - std::string first_line; - std::getline(received_file, first_line); + std::string first_line; + std::getline(received_file, first_line); - // We're not gonna bother comparing the contents - // Just check to see that the message type is correct - ASSERT_EQ(first_line.at(0), '2'); + // We're not gonna bother comparing the contents + // Just check to see that the message type is correct + ASSERT_EQ(first_line.at(0), '2'); } -TEST_F (VariableServerTest, SendSieClassTopLevelObjects) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, SendSieClassTopLevelObjects) { + if (socket_status != 0) { + FAIL(); + } - socket << "trick.send_sie_top_level_objects()\n"; + socket << "trick.send_sie_top_level_objects()\n"; - std::stringstream received_file; - std::string file_temp; + std::stringstream received_file; + std::string file_temp; - while (socket.check_for_message_availible()) { - socket >> file_temp; - received_file << file_temp; - } + while (socket.check_for_message_availible()) { + socket >> file_temp; + received_file << file_temp; + } - std::string first_line; - std::getline(received_file, first_line); + std::string first_line; + std::getline(received_file, first_line); - // We're not gonna bother comparing the contents - // Just check to see that the message type is correct - ASSERT_EQ(first_line.at(0), '2'); + // We're not gonna bother comparing the contents + // Just check to see that the message type is correct + ASSERT_EQ(first_line.at(0), '2'); } -TEST_F (VariableServerTest, RestartAndSet) { - if (socket_status != 0) { - FAIL(); - } +TEST_F (VariableServerTest, RestartAndSet) { + if (socket_status != 0) { + FAIL(); + } - std::string reply; - std::string expected; + std::string reply; + std::string expected; - socket << "trick.var_add(\"vsx.vst.c\")\n"; - socket >> reply; - expected = std::string("0\t-1234\n"); + socket << "trick.var_add(\"vsx.vst.c\")\n"; + socket >> reply; + expected = std::string("0\t-1234\n"); - EXPECT_EQ(reply, expected); + EXPECT_EQ(reply, expected); - dump_checkpoint(socket, "reload_file.ckpnt"); + dump_checkpoint(socket, "reload_file.ckpnt"); - socket << "trick.var_add(\"vsx.vst.e\",\"m\")\n"; - socket >> reply; - expected = std::string("0\t-1234\t-123456 {m}\n"); + socket << "trick.var_add(\"vsx.vst.e\",\"m\")\n"; + socket >> reply; + expected = std::string("0\t-1234\t-123456 {m}\n"); - socket << "trick.var_set(\"vsx.vst.c\", 5)\n"; - socket >> reply; - expected = std::string("0\t5\t-123456 {m}\n"); + socket << "trick.var_set(\"vsx.vst.c\", 5)\n"; + socket >> reply; + expected = std::string("0\t5\t-123456 {m}\n"); - EXPECT_EQ(reply, expected); + EXPECT_EQ(reply, expected); - load_checkpoint(socket, "RUN_test/reload_file.ckpnt"); + load_checkpoint(socket, "RUN_test/reload_file.ckpnt"); - socket >> reply; - expected = std::string("0\t-1234\t-123456 {m}\n"); + socket >> reply; + expected = std::string("0\t-1234\t-123456 {m}\n"); - EXPECT_EQ(reply, expected); + EXPECT_EQ(reply, expected); } -TEST_F (VariableServerTest, Cycle) { - if (socket_status != 0) { - FAIL(); - } - - double cycle = 1.0; - int num_cycles = 5; - - // Challenge: no loops allowed - // I've been reading about lamdbas and when you have a hammer........ - - // Test: compare the differences in the returned sim time, make sure the difference - // between them are equal to var_cycle - // In copy mode VS_COPY_SCHEDULED and write mode VS_WRITE_WHEN_COPY, we should see exactly the correct copy rate - // Use a very small tolerance to compensate for floating point error - - auto parse_message_for_sim_time = [](const std::string& message) { - // For this case the message will be - // 0\t