From cb78a45326719e9b9ed0ec3c99d7ae0d780df224 Mon Sep 17 00:00:00 2001 From: tx_haggis <13982343+adbancroft@users.noreply.github.com> Date: Wed, 29 May 2024 00:27:50 -0500 Subject: [PATCH] Unit Tests: provide correct filename in test messages (#1211) * Make Unity print the correct file name - VS code output will then provide a clickable link :-) * Provide macro to save, set & restore Unity filename --- test/test_decoders/FordST170/ForsdST170.cpp | 5 +++++ test/test_decoders/NGC/test_ngc.cpp | 4 ++++ test/test_decoders/Nissan360/Nissan360.cpp | 5 +++++ test/test_decoders/dual_wheel/dual_wheel.cpp | 5 +++++ .../missing_tooth/missing_tooth.cpp | 4 ++++ test/test_decoders/renix/renix.cpp | 5 ++++- test/test_fuel/test_PW.cpp | 4 ++++ test/test_fuel/test_corrections.cpp | 4 ++++ test/test_fuel/test_staging.cpp | 4 ++++ test/test_init/test_fuel_schedule_init.cpp | 3 +++ .../test_init/test_ignition_schedule_init.cpp | 3 +++ test/test_init/tests_init.cpp | 3 +++ test/test_math/test_division.cpp | 4 ++++ test/test_math/tests_percent.cpp | 4 ++++ .../test_adjust_crank_angle.cpp | 4 ++++ test/test_schedule_calcs/test_ign_calcs.cpp | 4 ++++ test/test_schedule_calcs/test_inj_calcs.cpp | 4 ++++ .../test_schedules/test_accuracy_duration.cpp | 5 ++++- test/test_schedules/test_accuracy_timeout.cpp | 5 ++++- .../test_status_initial_off.cpp | 5 ++++- .../test_status_off_to_pending.cpp | 5 ++++- .../test_status_pending_to_running.cpp | 5 ++++- .../test_status_running_to_off.cpp | 5 ++++- .../test_status_running_to_pending.cpp | 5 ++++- test/test_tables/test_table2d.cpp | 4 ++++ test/test_tables/tests_tables.cpp | 6 +++++- test/test_utils.h | 21 +++++++++++++++++++ 27 files changed, 126 insertions(+), 9 deletions(-) diff --git a/test/test_decoders/FordST170/ForsdST170.cpp b/test/test_decoders/FordST170/ForsdST170.cpp index a98eccc5..bc617847 100644 --- a/test/test_decoders/FordST170/ForsdST170.cpp +++ b/test/test_decoders/FordST170/ForsdST170.cpp @@ -4,6 +4,7 @@ #include "FordST170.h" #include "scheduler.h" #include "schedule_calcs.h" +#include "../../test_utils.h" extern uint16_t ignition1EndTooth; extern uint16_t ignition2EndTooth; @@ -159,6 +160,8 @@ void test_fordst170_newIgn_12_trigNeg360_1() void testFordST170() { + SET_UNITY_FILENAME() { + RUN_TEST(test_fordst170_newIgn_12_trig0_1); RUN_TEST(test_fordst170_newIgn_12_trig90_1); RUN_TEST(test_fordst170_newIgn_12_trig180_1); @@ -168,4 +171,6 @@ void testFordST170() RUN_TEST(test_fordst170_newIgn_12_trigNeg180_1); RUN_TEST(test_fordst170_newIgn_12_trigNeg270_1); RUN_TEST(test_fordst170_newIgn_12_trigNeg360_1); + + } } \ No newline at end of file diff --git a/test/test_decoders/NGC/test_ngc.cpp b/test/test_decoders/NGC/test_ngc.cpp index f5196242..231b7b01 100644 --- a/test/test_decoders/NGC/test_ngc.cpp +++ b/test/test_decoders/NGC/test_ngc.cpp @@ -4,6 +4,7 @@ #include "test_ngc.h" #include "scheduler.h" #include "schedule_calcs.h" +#include "../../test_utils.h" extern uint16_t ignition1EndTooth; extern uint16_t ignition2EndTooth; @@ -133,6 +134,8 @@ void test_ngc_newIgn_12_trigNeg360_1() void testNGC() { + SET_UNITY_FILENAME() { + RUN_TEST(test_ngc_newIgn_12_trig0_1); RUN_TEST(test_ngc_newIgn_12_trig90_1); RUN_TEST(test_ngc_newIgn_12_trig180_1); @@ -142,4 +145,5 @@ void testNGC() RUN_TEST(test_ngc_newIgn_12_trigNeg180_1); RUN_TEST(test_ngc_newIgn_12_trigNeg270_1); RUN_TEST(test_ngc_newIgn_12_trigNeg360_1); + } } \ No newline at end of file diff --git a/test/test_decoders/Nissan360/Nissan360.cpp b/test/test_decoders/Nissan360/Nissan360.cpp index f1600a32..1eee602a 100644 --- a/test/test_decoders/Nissan360/Nissan360.cpp +++ b/test/test_decoders/Nissan360/Nissan360.cpp @@ -4,6 +4,7 @@ #include "Nissan360.h" #include "scheduler.h" #include "schedule_calcs.h" +#include "../../test_utils.h" extern uint16_t ignition1EndTooth; extern uint16_t ignition2EndTooth; @@ -157,6 +158,9 @@ void test_nissan360_newIgn_12_trigNeg360_1() void testNissan360() { + SET_UNITY_FILENAME() { + + RUN_TEST(test_nissan360_newIgn_12_trig0_1); RUN_TEST(test_nissan360_newIgn_12_trig90_1); RUN_TEST(test_nissan360_newIgn_12_trig180_1); @@ -166,4 +170,5 @@ void testNissan360() RUN_TEST(test_nissan360_newIgn_12_trigNeg180_1); RUN_TEST(test_nissan360_newIgn_12_trigNeg270_1); RUN_TEST(test_nissan360_newIgn_12_trigNeg360_1); + } } \ No newline at end of file diff --git a/test/test_decoders/dual_wheel/dual_wheel.cpp b/test/test_decoders/dual_wheel/dual_wheel.cpp index 58b4179f..2be6de95 100644 --- a/test/test_decoders/dual_wheel/dual_wheel.cpp +++ b/test/test_decoders/dual_wheel/dual_wheel.cpp @@ -3,6 +3,7 @@ #include #include "dual_wheel.h" #include "schedule_calcs.h" +#include "../../test_utils.h" void test_setup_dualwheel_12_1() @@ -324,6 +325,8 @@ void test_dualwheel_newIgn_4() void testDualWheel() { + SET_UNITY_FILENAME() { + RUN_TEST(test_dualwheel_newIgn_12_1_trig0_1); RUN_TEST(test_dualwheel_newIgn_12_1_trig90_1); RUN_TEST(test_dualwheel_newIgn_12_1_trig180_1); @@ -347,4 +350,6 @@ void testDualWheel() */ //RUN_TEST(test_dualwheel_newIgn_60_2_trig181_2); //RUN_TEST(test_dualwheel_newIgn_60_2_trig182_2); + + } } \ No newline at end of file diff --git a/test/test_decoders/missing_tooth/missing_tooth.cpp b/test/test_decoders/missing_tooth/missing_tooth.cpp index d86f5782..ed3fb07d 100644 --- a/test/test_decoders/missing_tooth/missing_tooth.cpp +++ b/test/test_decoders/missing_tooth/missing_tooth.cpp @@ -3,6 +3,7 @@ #include #include "missing_tooth.h" #include "schedule_calcs.h" +#include "../../test_utils.h" void test_setup_36_1() { @@ -344,6 +345,8 @@ void test_missingtooth_newIgn_4() void testMissingTooth() { + SET_UNITY_FILENAME() { + RUN_TEST(test_missingtooth_newIgn_36_1_trig0_1); RUN_TEST(test_missingtooth_newIgn_36_1_trig90_1); RUN_TEST(test_missingtooth_newIgn_36_1_trig180_1); @@ -366,4 +369,5 @@ void testMissingTooth() //RUN_TEST(test_missingtooth_newIgn_60_2_trig181_2); //RUN_TEST(test_missingtooth_newIgn_60_2_trig182_2); + } } \ No newline at end of file diff --git a/test/test_decoders/renix/renix.cpp b/test/test_decoders/renix/renix.cpp index d8b5bc66..5edae432 100644 --- a/test/test_decoders/renix/renix.cpp +++ b/test/test_decoders/renix/renix.cpp @@ -3,6 +3,7 @@ #include #include "renix.h" #include "schedule_calcs.h" +#include "../../test_utils.h" void test_setup_renix44() { @@ -310,6 +311,8 @@ void test_Renix_newIgn_66_trig181_2() void testRenix() { + SET_UNITY_FILENAME() { + RUN_TEST(test_Renix_newIgn_44_trig0_1); RUN_TEST(test_Renix_newIgn_44_trig90_1); RUN_TEST(test_Renix_newIgn_44_trig180_1); @@ -332,5 +335,5 @@ void testRenix() RUN_TEST(test_Renix_newIgn_66_trig0_2); RUN_TEST(test_Renix_newIgn_66_trig181_2); - + } } \ No newline at end of file diff --git a/test/test_fuel/test_PW.cpp b/test/test_fuel/test_PW.cpp index 6070adec..5d4c1559 100644 --- a/test/test_fuel/test_PW.cpp +++ b/test/test_fuel/test_PW.cpp @@ -2,11 +2,14 @@ #include #include #include "test_PW.h" +#include "../test_utils.h" #define PW_ALLOWED_ERROR 30 void testPW(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_PW_No_Multiply); RUN_TEST(test_PW_MAP_Multiply); RUN_TEST(test_PW_MAP_Multiply_Compatibility); @@ -16,6 +19,7 @@ void testPW(void) RUN_TEST(test_PW_4Cyl_PW0); RUN_TEST(test_PW_Limit_Long_Revolution); RUN_TEST(test_PW_Limit_90pct); + } } int16_t REQ_FUEL; diff --git a/test/test_fuel/test_corrections.cpp b/test/test_fuel/test_corrections.cpp index 1205c973..f5356b4b 100644 --- a/test/test_fuel/test_corrections.cpp +++ b/test/test_fuel/test_corrections.cpp @@ -2,10 +2,13 @@ #include #include #include "test_corrections.h" +#include "../test_utils.h" void testCorrections() { + SET_UNITY_FILENAME() { + test_corrections_WUE(); test_corrections_dfco(); test_corrections_TAE(); //TPS based accel enrichment corrections @@ -21,6 +24,7 @@ void testCorrections() RUN_TEST(test_corrections_launch); //Not written yet RUN_TEST(test_corrections_dfco); //Not written yet */ + } } void test_corrections_WUE_active(void) diff --git a/test/test_fuel/test_staging.cpp b/test/test_fuel/test_staging.cpp index c67d58ed..88d91d1c 100644 --- a/test/test_fuel/test_staging.cpp +++ b/test/test_fuel/test_staging.cpp @@ -2,15 +2,19 @@ #include #include #include "test_staging.h" +#include "../test_utils.h" void testStaging(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_Staging_Off); RUN_TEST(test_Staging_4cyl_Auto_Inactive); RUN_TEST(test_Staging_4cyl_Table_Inactive); RUN_TEST(test_Staging_4cyl_Auto_50pct); RUN_TEST(test_Staging_4cyl_Auto_33pct); RUN_TEST(test_Staging_4cyl_Table_50pct); + } } void test_Staging_setCommon() diff --git a/test/test_init/test_fuel_schedule_init.cpp b/test/test_init/test_fuel_schedule_init.cpp index 4229df99..72336b51 100644 --- a/test/test_init/test_fuel_schedule_init.cpp +++ b/test/test_init/test_fuel_schedule_init.cpp @@ -982,6 +982,8 @@ static void test_partial_sync(void) void testFuelScheduleInit() { + SET_UNITY_FILENAME() { + run_1_cylinder_4stroke_tests(); run_1_cylinder_2stroke_tests(); run_2_cylinder_4stroke_tests(); @@ -999,4 +1001,5 @@ void testFuelScheduleInit() run_oddfire_tests(); RUN_TEST_P(test_partial_sync); + } } \ No newline at end of file diff --git a/test/test_init/test_ignition_schedule_init.cpp b/test/test_init/test_ignition_schedule_init.cpp index 166ccd2e..3ae34b6f 100644 --- a/test/test_init/test_ignition_schedule_init.cpp +++ b/test/test_init/test_ignition_schedule_init.cpp @@ -336,6 +336,8 @@ static void test_partial_sync(void) void testIgnitionScheduleInit() { + SET_UNITY_FILENAME() { + run_1_cylinder_4stroke_tests(); run_2_cylinder_4stroke_tests(); run_3_cylinder_4stroke_tests(); @@ -345,4 +347,5 @@ void testIgnitionScheduleInit() run_8_cylinder_4stroke_tests(); RUN_TEST_P(test_partial_sync); + } } \ No newline at end of file diff --git a/test/test_init/tests_init.cpp b/test/test_init/tests_init.cpp index 0851e103..2bb1ab7a 100644 --- a/test/test_init/tests_init.cpp +++ b/test/test_init/tests_init.cpp @@ -304,6 +304,8 @@ void test_initialisation_input_user_pin_does_not_override_outputpin(void) void testInitialisation() { + SET_UNITY_FILENAME() { + RUN_TEST_P(test_initialisation_complete); RUN_TEST_P(test_initialisation_ports); RUN_TEST_P(test_initialisation_outputs_V03); @@ -316,4 +318,5 @@ void testInitialisation() RUN_TEST_P(test_initialisation_outputs_reset_control_override_board_default); RUN_TEST_P(test_initialisation_user_pin_override_board_default); RUN_TEST_P(test_initialisation_input_user_pin_does_not_override_outputpin); + } } \ No newline at end of file diff --git a/test/test_math/test_division.cpp b/test/test_math/test_division.cpp index f4a547e1..6f5a32df 100644 --- a/test/test_math/test_division.cpp +++ b/test/test_math/test_division.cpp @@ -3,6 +3,7 @@ #include "maths.h" #include "crankMaths.h" #include "../timer.hpp" +#include "../test_utils.h" template @@ -222,6 +223,8 @@ void test_maths_div100_s32_perf(void) } void testDivision(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_maths_div100_U16); RUN_TEST(test_maths_div100_U32); RUN_TEST(test_maths_div100_S16); @@ -232,4 +235,5 @@ void testDivision(void) { RUN_TEST(test_maths_div360); RUN_TEST(test_maths_div100_s16_perf); RUN_TEST(test_maths_div100_s32_perf); + } } \ No newline at end of file diff --git a/test/test_math/tests_percent.cpp b/test/test_math/tests_percent.cpp index e5ae9cd0..f7d8742c 100644 --- a/test/test_math/tests_percent.cpp +++ b/test/test_math/tests_percent.cpp @@ -2,6 +2,7 @@ #include "test_fp_support.h" #include "maths.h" #include "../timer.hpp" +#include "../test_utils.h" static void test_percent(uint8_t percent, uint16_t value) { assert_rounded_div((uint32_t)percent*value, 100, percentage(percent, value)); @@ -107,10 +108,13 @@ void test_maths_percentage_perf(void) void testPercent() { + SET_UNITY_FILENAME() { + RUN_TEST(test_maths_percent_U8); RUN_TEST(test_maths_percent_U16); RUN_TEST(test_maths_halfpercent_U8); RUN_TEST(test_maths_halfpercent_U16); RUN_TEST(test_maths_halfPercentage_perf); RUN_TEST(test_maths_percentage_perf); + } } diff --git a/test/test_schedule_calcs/test_adjust_crank_angle.cpp b/test/test_schedule_calcs/test_adjust_crank_angle.cpp index 94f448da..081fc717 100644 --- a/test/test_schedule_calcs/test_adjust_crank_angle.cpp +++ b/test/test_schedule_calcs/test_adjust_crank_angle.cpp @@ -1,6 +1,7 @@ #include #include #include "schedule_calcs.h" +#include "../test_utils.h" static void nullIgnCallback(void) {}; @@ -75,7 +76,10 @@ void test_adjust_crank_angle_running() void test_adjust_crank_angle() { + SET_UNITY_FILENAME() { + RUN_TEST(test_adjust_crank_angle_pending_below_minrevolutions); RUN_TEST(test_adjust_crank_angle_pending_above_minrevolutions); RUN_TEST(test_adjust_crank_angle_running); + } } \ No newline at end of file diff --git a/test/test_schedule_calcs/test_ign_calcs.cpp b/test/test_schedule_calcs/test_ign_calcs.cpp index d23f2f89..9720429c 100644 --- a/test/test_schedule_calcs/test_ign_calcs.cpp +++ b/test/test_schedule_calcs/test_ign_calcs.cpp @@ -4,6 +4,7 @@ #include "schedule_calcs.h" #include "crankMaths.h" #include "decoders.h" +#include "../test_utils.h" #define _countof(x) (sizeof(x) / sizeof (x[0])) @@ -612,7 +613,10 @@ void test_rotary_channel_calcs(void) void test_calc_ign_timeout(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_calc_ign_timeout_360); RUN_TEST(test_calc_ign_timeout_720); RUN_TEST(test_rotary_channel_calcs); + } } \ No newline at end of file diff --git a/test/test_schedule_calcs/test_inj_calcs.cpp b/test/test_schedule_calcs/test_inj_calcs.cpp index 2326eb7b..571134bf 100644 --- a/test/test_schedule_calcs/test_inj_calcs.cpp +++ b/test/test_schedule_calcs/test_inj_calcs.cpp @@ -3,6 +3,7 @@ #include "test_calcs_common.h" #include "schedule_calcs.h" #include "crankMaths.h" +#include "../test_utils.h" #define _countof(x) (sizeof(x) / sizeof (x[0])) @@ -279,6 +280,9 @@ static void test_calc_inj_timeout_720() // void test_calc_inj_timeout(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_calc_inj_timeout_360); RUN_TEST(test_calc_inj_timeout_720); + } } \ No newline at end of file diff --git a/test/test_schedules/test_accuracy_duration.cpp b/test/test_schedules/test_accuracy_duration.cpp index 5dca1bfd..ad226107 100644 --- a/test/test_schedules/test_accuracy_duration.cpp +++ b/test/test_schedules/test_accuracy_duration.cpp @@ -1,7 +1,7 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" #define TIMEOUT 1000 @@ -130,6 +130,8 @@ void test_accuracy_duration_ign8(void) void test_accuracy_duration(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_accuracy_duration_inj1); RUN_TEST(test_accuracy_duration_inj2); RUN_TEST(test_accuracy_duration_inj3); @@ -163,4 +165,5 @@ void test_accuracy_duration(void) #if INJ_CHANNELS >= 8 RUN_TEST(test_accuracy_duration_ign8); #endif + } } diff --git a/test/test_schedules/test_accuracy_timeout.cpp b/test/test_schedules/test_accuracy_timeout.cpp index 9fe2ae13..dc83600c 100644 --- a/test/test_schedules/test_accuracy_timeout.cpp +++ b/test/test_schedules/test_accuracy_timeout.cpp @@ -1,7 +1,7 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" #include "scheduledIO.h" @@ -133,6 +133,8 @@ void test_accuracy_timeout_ign8(void) void test_accuracy_timeout(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_accuracy_timeout_inj1); RUN_TEST(test_accuracy_timeout_inj2); RUN_TEST(test_accuracy_timeout_inj3); @@ -166,4 +168,5 @@ void test_accuracy_timeout(void) #if IGN_CHANNELS >= 8 RUN_TEST(test_accuracy_timeout_ign8); #endif + } } diff --git a/test/test_schedules/test_status_initial_off.cpp b/test/test_schedules/test_status_initial_off.cpp index 908a09fa..04f20545 100644 --- a/test/test_schedules/test_status_initial_off.cpp +++ b/test/test_schedules/test_status_initial_off.cpp @@ -1,6 +1,6 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" void test_status_initial_off_inj1(void) @@ -118,6 +118,8 @@ void test_status_initial_off_ign8(void) void test_status_initial_off(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_status_initial_off_inj1); RUN_TEST(test_status_initial_off_inj2); RUN_TEST(test_status_initial_off_inj3); @@ -151,4 +153,5 @@ void test_status_initial_off(void) #if IGN_CHANNELS >= 8 RUN_TEST(test_status_initial_off_ign8); #endif + } } \ No newline at end of file diff --git a/test/test_schedules/test_status_off_to_pending.cpp b/test/test_schedules/test_status_off_to_pending.cpp index ca3e330c..61bb1570 100644 --- a/test/test_schedules/test_status_off_to_pending.cpp +++ b/test/test_schedules/test_status_off_to_pending.cpp @@ -1,7 +1,7 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" #define TIMEOUT 1000 @@ -156,6 +156,8 @@ void test_status_off_to_pending_ign8(void) void test_status_off_to_pending(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_status_off_to_pending_inj1); RUN_TEST(test_status_off_to_pending_inj2); RUN_TEST(test_status_off_to_pending_inj3); @@ -189,4 +191,5 @@ void test_status_off_to_pending(void) #if IGN_CHANNELS >= 8 RUN_TEST(test_status_off_to_pending_ign8); #endif + } } diff --git a/test/test_schedules/test_status_pending_to_running.cpp b/test/test_schedules/test_status_pending_to_running.cpp index 201ddafb..76561256 100644 --- a/test/test_schedules/test_status_pending_to_running.cpp +++ b/test/test_schedules/test_status_pending_to_running.cpp @@ -1,7 +1,7 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" #define TIMEOUT 1000 @@ -172,6 +172,8 @@ void test_status_pending_to_running_ign8(void) void test_status_pending_to_running(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_status_pending_to_running_inj1); RUN_TEST(test_status_pending_to_running_inj2); RUN_TEST(test_status_pending_to_running_inj3); @@ -189,4 +191,5 @@ void test_status_pending_to_running(void) RUN_TEST(test_status_pending_to_running_ign6); RUN_TEST(test_status_pending_to_running_ign7); RUN_TEST(test_status_pending_to_running_ign8); + } } diff --git a/test/test_schedules/test_status_running_to_off.cpp b/test/test_schedules/test_status_running_to_off.cpp index ee25c255..794430b9 100644 --- a/test/test_schedules/test_status_running_to_off.cpp +++ b/test/test_schedules/test_status_running_to_off.cpp @@ -1,7 +1,7 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" #define TIMEOUT 1000 @@ -172,6 +172,8 @@ void test_status_running_to_off_ign8(void) void test_status_running_to_off(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_status_running_to_off_inj1); RUN_TEST(test_status_running_to_off_inj2); RUN_TEST(test_status_running_to_off_inj3); @@ -189,4 +191,5 @@ void test_status_running_to_off(void) RUN_TEST(test_status_running_to_off_ign6); RUN_TEST(test_status_running_to_off_ign7); RUN_TEST(test_status_running_to_off_ign8); + } } diff --git a/test/test_schedules/test_status_running_to_pending.cpp b/test/test_schedules/test_status_running_to_pending.cpp index 6b005fd1..b194d82a 100644 --- a/test/test_schedules/test_status_running_to_pending.cpp +++ b/test/test_schedules/test_status_running_to_pending.cpp @@ -1,7 +1,7 @@ #include #include - +#include "../test_utils.h" #include "scheduler.h" #define TIMEOUT 1000 @@ -204,6 +204,8 @@ void test_status_running_to_pending_ign8(void) void test_status_running_to_pending(void) { + SET_UNITY_FILENAME() { + RUN_TEST(test_status_running_to_pending_inj1); RUN_TEST(test_status_running_to_pending_inj2); RUN_TEST(test_status_running_to_pending_inj3); @@ -221,4 +223,5 @@ void test_status_running_to_pending(void) RUN_TEST(test_status_running_to_pending_ign6); RUN_TEST(test_status_running_to_pending_ign7); RUN_TEST(test_status_running_to_pending_ign8); + } } diff --git a/test/test_tables/test_table2d.cpp b/test/test_tables/test_table2d.cpp index 5a6ce3c1..176d7b6b 100644 --- a/test/test_tables/test_table2d.cpp +++ b/test/test_tables/test_table2d.cpp @@ -4,6 +4,7 @@ typedef uint8_t byte; #include "test_table2d.h" #include "table2d.h" +#include "../test_utils.h" static constexpr uint8_t TEST_TABLE2D_SIZE = 9; @@ -147,9 +148,12 @@ void test_table2d_all_decrementing(void) void testTable2d() { + SET_UNITY_FILENAME() { + RUN_TEST(test_table2dLookup_50pct); RUN_TEST(test_table2dLookup_exactAxis); RUN_TEST(test_table2dLookup_overMax); RUN_TEST(test_table2dLookup_underMin); RUN_TEST(test_table2d_all_decrementing); + } } \ No newline at end of file diff --git a/test/test_tables/tests_tables.cpp b/test/test_tables/tests_tables.cpp index ba1a7ef4..8163bbc4 100644 --- a/test/test_tables/tests_tables.cpp +++ b/test/test_tables/tests_tables.cpp @@ -4,6 +4,7 @@ #include #include "tests_tables.h" #include "table3d.h" +#include "../test_utils.h" #define _countof(x) (sizeof(x) / sizeof (x[0])) @@ -113,6 +114,8 @@ void setup_TestTable(void) void testTables() { + SET_UNITY_FILENAME() { + RUN_TEST(test_tableLookup_50pct); RUN_TEST(test_tableLookup_exact1Axis); RUN_TEST(test_tableLookup_exact2Axis); @@ -122,7 +125,8 @@ void testTables() RUN_TEST(test_tableLookup_underMinY); RUN_TEST(test_tableLookup_roundUp); //RUN_TEST(test_all_incrementing); - + + } } void test_tableLookup_50pct(void) diff --git a/test/test_utils.h b/test/test_utils.h index 350c3818..552a78cd 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -1,6 +1,9 @@ #pragma once +#include +#include + // Unity macro to reduce memory usage (RAM, .bss) // // Unity supplied RUN_TEST captures the function name @@ -16,3 +19,21 @@ strcpy_P(funcName, PSTR(#func)); \ UnityDefaultTestRun(func, funcName, __LINE__); \ } + +static __inline__ uint8_t ufname_set(const char *newFName) +{ + Unity.TestFile = newFName; + return 1; +} +static __inline__ void ufname_szrestore(char** __s) +{ + Unity.TestFile = *__s; + __asm__ volatile ("" ::: "memory"); +} + +#define UNITY_FILENAME_RESTORE char* _ufname_saved \ + __attribute__((__cleanup__(ufname_szrestore))) = (char*)Unity.TestFile + +#define SET_UNITY_FILENAME() \ +for ( UNITY_FILENAME_RESTORE, _ufname_done = ufname_set(__FILE__); \ + _ufname_done; _ufname_done = 0 )