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
This commit is contained in:
tx_haggis 2024-05-29 00:27:50 -05:00 committed by GitHub
parent 40463c51d6
commit cb78a45326
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 126 additions and 9 deletions

View File

@ -4,6 +4,7 @@
#include "FordST170.h" #include "FordST170.h"
#include "scheduler.h" #include "scheduler.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../../test_utils.h"
extern uint16_t ignition1EndTooth; extern uint16_t ignition1EndTooth;
extern uint16_t ignition2EndTooth; extern uint16_t ignition2EndTooth;
@ -159,6 +160,8 @@ void test_fordst170_newIgn_12_trigNeg360_1()
void testFordST170() void testFordST170()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_fordst170_newIgn_12_trig0_1); RUN_TEST(test_fordst170_newIgn_12_trig0_1);
RUN_TEST(test_fordst170_newIgn_12_trig90_1); RUN_TEST(test_fordst170_newIgn_12_trig90_1);
RUN_TEST(test_fordst170_newIgn_12_trig180_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_trigNeg180_1);
RUN_TEST(test_fordst170_newIgn_12_trigNeg270_1); RUN_TEST(test_fordst170_newIgn_12_trigNeg270_1);
RUN_TEST(test_fordst170_newIgn_12_trigNeg360_1); RUN_TEST(test_fordst170_newIgn_12_trigNeg360_1);
}
} }

View File

@ -4,6 +4,7 @@
#include "test_ngc.h" #include "test_ngc.h"
#include "scheduler.h" #include "scheduler.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../../test_utils.h"
extern uint16_t ignition1EndTooth; extern uint16_t ignition1EndTooth;
extern uint16_t ignition2EndTooth; extern uint16_t ignition2EndTooth;
@ -133,6 +134,8 @@ void test_ngc_newIgn_12_trigNeg360_1()
void testNGC() void testNGC()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_ngc_newIgn_12_trig0_1); RUN_TEST(test_ngc_newIgn_12_trig0_1);
RUN_TEST(test_ngc_newIgn_12_trig90_1); RUN_TEST(test_ngc_newIgn_12_trig90_1);
RUN_TEST(test_ngc_newIgn_12_trig180_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_trigNeg180_1);
RUN_TEST(test_ngc_newIgn_12_trigNeg270_1); RUN_TEST(test_ngc_newIgn_12_trigNeg270_1);
RUN_TEST(test_ngc_newIgn_12_trigNeg360_1); RUN_TEST(test_ngc_newIgn_12_trigNeg360_1);
}
} }

View File

@ -4,6 +4,7 @@
#include "Nissan360.h" #include "Nissan360.h"
#include "scheduler.h" #include "scheduler.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../../test_utils.h"
extern uint16_t ignition1EndTooth; extern uint16_t ignition1EndTooth;
extern uint16_t ignition2EndTooth; extern uint16_t ignition2EndTooth;
@ -157,6 +158,9 @@ void test_nissan360_newIgn_12_trigNeg360_1()
void testNissan360() void testNissan360()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_nissan360_newIgn_12_trig0_1); RUN_TEST(test_nissan360_newIgn_12_trig0_1);
RUN_TEST(test_nissan360_newIgn_12_trig90_1); RUN_TEST(test_nissan360_newIgn_12_trig90_1);
RUN_TEST(test_nissan360_newIgn_12_trig180_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_trigNeg180_1);
RUN_TEST(test_nissan360_newIgn_12_trigNeg270_1); RUN_TEST(test_nissan360_newIgn_12_trigNeg270_1);
RUN_TEST(test_nissan360_newIgn_12_trigNeg360_1); RUN_TEST(test_nissan360_newIgn_12_trigNeg360_1);
}
} }

View File

@ -3,6 +3,7 @@
#include <unity.h> #include <unity.h>
#include "dual_wheel.h" #include "dual_wheel.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../../test_utils.h"
void test_setup_dualwheel_12_1() void test_setup_dualwheel_12_1()
@ -324,6 +325,8 @@ void test_dualwheel_newIgn_4()
void testDualWheel() void testDualWheel()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_dualwheel_newIgn_12_1_trig0_1); 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_trig90_1);
RUN_TEST(test_dualwheel_newIgn_12_1_trig180_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_trig181_2);
//RUN_TEST(test_dualwheel_newIgn_60_2_trig182_2); //RUN_TEST(test_dualwheel_newIgn_60_2_trig182_2);
}
} }

View File

@ -3,6 +3,7 @@
#include <unity.h> #include <unity.h>
#include "missing_tooth.h" #include "missing_tooth.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../../test_utils.h"
void test_setup_36_1() void test_setup_36_1()
{ {
@ -344,6 +345,8 @@ void test_missingtooth_newIgn_4()
void testMissingTooth() void testMissingTooth()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_missingtooth_newIgn_36_1_trig0_1); 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_trig90_1);
RUN_TEST(test_missingtooth_newIgn_36_1_trig180_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_trig181_2);
//RUN_TEST(test_missingtooth_newIgn_60_2_trig182_2); //RUN_TEST(test_missingtooth_newIgn_60_2_trig182_2);
}
} }

View File

@ -3,6 +3,7 @@
#include <unity.h> #include <unity.h>
#include "renix.h" #include "renix.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../../test_utils.h"
void test_setup_renix44() void test_setup_renix44()
{ {
@ -310,6 +311,8 @@ void test_Renix_newIgn_66_trig181_2()
void testRenix() void testRenix()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_Renix_newIgn_44_trig0_1); RUN_TEST(test_Renix_newIgn_44_trig0_1);
RUN_TEST(test_Renix_newIgn_44_trig90_1); RUN_TEST(test_Renix_newIgn_44_trig90_1);
RUN_TEST(test_Renix_newIgn_44_trig180_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_trig0_2);
RUN_TEST(test_Renix_newIgn_66_trig181_2); RUN_TEST(test_Renix_newIgn_66_trig181_2);
}
} }

View File

@ -2,11 +2,14 @@
#include <speeduino.h> #include <speeduino.h>
#include <unity.h> #include <unity.h>
#include "test_PW.h" #include "test_PW.h"
#include "../test_utils.h"
#define PW_ALLOWED_ERROR 30 #define PW_ALLOWED_ERROR 30
void testPW(void) void testPW(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_PW_No_Multiply); RUN_TEST(test_PW_No_Multiply);
RUN_TEST(test_PW_MAP_Multiply); RUN_TEST(test_PW_MAP_Multiply);
RUN_TEST(test_PW_MAP_Multiply_Compatibility); RUN_TEST(test_PW_MAP_Multiply_Compatibility);
@ -16,6 +19,7 @@ void testPW(void)
RUN_TEST(test_PW_4Cyl_PW0); RUN_TEST(test_PW_4Cyl_PW0);
RUN_TEST(test_PW_Limit_Long_Revolution); RUN_TEST(test_PW_Limit_Long_Revolution);
RUN_TEST(test_PW_Limit_90pct); RUN_TEST(test_PW_Limit_90pct);
}
} }
int16_t REQ_FUEL; int16_t REQ_FUEL;

View File

@ -2,10 +2,13 @@
#include <corrections.h> #include <corrections.h>
#include <unity.h> #include <unity.h>
#include "test_corrections.h" #include "test_corrections.h"
#include "../test_utils.h"
void testCorrections() void testCorrections()
{ {
SET_UNITY_FILENAME() {
test_corrections_WUE(); test_corrections_WUE();
test_corrections_dfco(); test_corrections_dfco();
test_corrections_TAE(); //TPS based accel enrichment corrections 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_launch); //Not written yet
RUN_TEST(test_corrections_dfco); //Not written yet RUN_TEST(test_corrections_dfco); //Not written yet
*/ */
}
} }
void test_corrections_WUE_active(void) void test_corrections_WUE_active(void)

View File

@ -2,15 +2,19 @@
#include <speeduino.h> #include <speeduino.h>
#include <unity.h> #include <unity.h>
#include "test_staging.h" #include "test_staging.h"
#include "../test_utils.h"
void testStaging(void) void testStaging(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_Staging_Off); RUN_TEST(test_Staging_Off);
RUN_TEST(test_Staging_4cyl_Auto_Inactive); RUN_TEST(test_Staging_4cyl_Auto_Inactive);
RUN_TEST(test_Staging_4cyl_Table_Inactive); RUN_TEST(test_Staging_4cyl_Table_Inactive);
RUN_TEST(test_Staging_4cyl_Auto_50pct); RUN_TEST(test_Staging_4cyl_Auto_50pct);
RUN_TEST(test_Staging_4cyl_Auto_33pct); RUN_TEST(test_Staging_4cyl_Auto_33pct);
RUN_TEST(test_Staging_4cyl_Table_50pct); RUN_TEST(test_Staging_4cyl_Table_50pct);
}
} }
void test_Staging_setCommon() void test_Staging_setCommon()

View File

@ -982,6 +982,8 @@ static void test_partial_sync(void)
void testFuelScheduleInit() void testFuelScheduleInit()
{ {
SET_UNITY_FILENAME() {
run_1_cylinder_4stroke_tests(); run_1_cylinder_4stroke_tests();
run_1_cylinder_2stroke_tests(); run_1_cylinder_2stroke_tests();
run_2_cylinder_4stroke_tests(); run_2_cylinder_4stroke_tests();
@ -999,4 +1001,5 @@ void testFuelScheduleInit()
run_oddfire_tests(); run_oddfire_tests();
RUN_TEST_P(test_partial_sync); RUN_TEST_P(test_partial_sync);
}
} }

View File

@ -336,6 +336,8 @@ static void test_partial_sync(void)
void testIgnitionScheduleInit() void testIgnitionScheduleInit()
{ {
SET_UNITY_FILENAME() {
run_1_cylinder_4stroke_tests(); run_1_cylinder_4stroke_tests();
run_2_cylinder_4stroke_tests(); run_2_cylinder_4stroke_tests();
run_3_cylinder_4stroke_tests(); run_3_cylinder_4stroke_tests();
@ -345,4 +347,5 @@ void testIgnitionScheduleInit()
run_8_cylinder_4stroke_tests(); run_8_cylinder_4stroke_tests();
RUN_TEST_P(test_partial_sync); RUN_TEST_P(test_partial_sync);
}
} }

View File

@ -304,6 +304,8 @@ void test_initialisation_input_user_pin_does_not_override_outputpin(void)
void testInitialisation() void testInitialisation()
{ {
SET_UNITY_FILENAME() {
RUN_TEST_P(test_initialisation_complete); RUN_TEST_P(test_initialisation_complete);
RUN_TEST_P(test_initialisation_ports); RUN_TEST_P(test_initialisation_ports);
RUN_TEST_P(test_initialisation_outputs_V03); 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_outputs_reset_control_override_board_default);
RUN_TEST_P(test_initialisation_user_pin_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); RUN_TEST_P(test_initialisation_input_user_pin_does_not_override_outputpin);
}
} }

View File

@ -3,6 +3,7 @@
#include "maths.h" #include "maths.h"
#include "crankMaths.h" #include "crankMaths.h"
#include "../timer.hpp" #include "../timer.hpp"
#include "../test_utils.h"
template <typename T> template <typename T>
@ -222,6 +223,8 @@ void test_maths_div100_s32_perf(void)
} }
void testDivision(void) { void testDivision(void) {
SET_UNITY_FILENAME() {
RUN_TEST(test_maths_div100_U16); RUN_TEST(test_maths_div100_U16);
RUN_TEST(test_maths_div100_U32); RUN_TEST(test_maths_div100_U32);
RUN_TEST(test_maths_div100_S16); RUN_TEST(test_maths_div100_S16);
@ -232,4 +235,5 @@ void testDivision(void) {
RUN_TEST(test_maths_div360); RUN_TEST(test_maths_div360);
RUN_TEST(test_maths_div100_s16_perf); RUN_TEST(test_maths_div100_s16_perf);
RUN_TEST(test_maths_div100_s32_perf); RUN_TEST(test_maths_div100_s32_perf);
}
} }

View File

@ -2,6 +2,7 @@
#include "test_fp_support.h" #include "test_fp_support.h"
#include "maths.h" #include "maths.h"
#include "../timer.hpp" #include "../timer.hpp"
#include "../test_utils.h"
static void test_percent(uint8_t percent, uint16_t value) { static void test_percent(uint8_t percent, uint16_t value) {
assert_rounded_div((uint32_t)percent*value, 100, percentage(percent, value)); assert_rounded_div((uint32_t)percent*value, 100, percentage(percent, value));
@ -107,10 +108,13 @@ void test_maths_percentage_perf(void)
void testPercent() void testPercent()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_maths_percent_U8); RUN_TEST(test_maths_percent_U8);
RUN_TEST(test_maths_percent_U16); RUN_TEST(test_maths_percent_U16);
RUN_TEST(test_maths_halfpercent_U8); RUN_TEST(test_maths_halfpercent_U8);
RUN_TEST(test_maths_halfpercent_U16); RUN_TEST(test_maths_halfpercent_U16);
RUN_TEST(test_maths_halfPercentage_perf); RUN_TEST(test_maths_halfPercentage_perf);
RUN_TEST(test_maths_percentage_perf); RUN_TEST(test_maths_percentage_perf);
}
} }

View File

@ -1,6 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "../test_utils.h"
static void nullIgnCallback(void) {}; static void nullIgnCallback(void) {};
@ -75,7 +76,10 @@ void test_adjust_crank_angle_running()
void test_adjust_crank_angle() void test_adjust_crank_angle()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_adjust_crank_angle_pending_below_minrevolutions); RUN_TEST(test_adjust_crank_angle_pending_below_minrevolutions);
RUN_TEST(test_adjust_crank_angle_pending_above_minrevolutions); RUN_TEST(test_adjust_crank_angle_pending_above_minrevolutions);
RUN_TEST(test_adjust_crank_angle_running); RUN_TEST(test_adjust_crank_angle_running);
}
} }

View File

@ -4,6 +4,7 @@
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "crankMaths.h" #include "crankMaths.h"
#include "decoders.h" #include "decoders.h"
#include "../test_utils.h"
#define _countof(x) (sizeof(x) / sizeof (x[0])) #define _countof(x) (sizeof(x) / sizeof (x[0]))
@ -612,7 +613,10 @@ void test_rotary_channel_calcs(void)
void test_calc_ign_timeout(void) void test_calc_ign_timeout(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_calc_ign_timeout_360); RUN_TEST(test_calc_ign_timeout_360);
RUN_TEST(test_calc_ign_timeout_720); RUN_TEST(test_calc_ign_timeout_720);
RUN_TEST(test_rotary_channel_calcs); RUN_TEST(test_rotary_channel_calcs);
}
} }

View File

@ -3,6 +3,7 @@
#include "test_calcs_common.h" #include "test_calcs_common.h"
#include "schedule_calcs.h" #include "schedule_calcs.h"
#include "crankMaths.h" #include "crankMaths.h"
#include "../test_utils.h"
#define _countof(x) (sizeof(x) / sizeof (x[0])) #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) void test_calc_inj_timeout(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_calc_inj_timeout_360); RUN_TEST(test_calc_inj_timeout_360);
RUN_TEST(test_calc_inj_timeout_720); RUN_TEST(test_calc_inj_timeout_720);
}
} }

View File

@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
#define TIMEOUT 1000 #define TIMEOUT 1000
@ -130,6 +130,8 @@ void test_accuracy_duration_ign8(void)
void test_accuracy_duration(void) void test_accuracy_duration(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_accuracy_duration_inj1); RUN_TEST(test_accuracy_duration_inj1);
RUN_TEST(test_accuracy_duration_inj2); RUN_TEST(test_accuracy_duration_inj2);
RUN_TEST(test_accuracy_duration_inj3); RUN_TEST(test_accuracy_duration_inj3);
@ -163,4 +165,5 @@ void test_accuracy_duration(void)
#if INJ_CHANNELS >= 8 #if INJ_CHANNELS >= 8
RUN_TEST(test_accuracy_duration_ign8); RUN_TEST(test_accuracy_duration_ign8);
#endif #endif
}
} }

View File

@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
#include "scheduledIO.h" #include "scheduledIO.h"
@ -133,6 +133,8 @@ void test_accuracy_timeout_ign8(void)
void test_accuracy_timeout(void) void test_accuracy_timeout(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_accuracy_timeout_inj1); RUN_TEST(test_accuracy_timeout_inj1);
RUN_TEST(test_accuracy_timeout_inj2); RUN_TEST(test_accuracy_timeout_inj2);
RUN_TEST(test_accuracy_timeout_inj3); RUN_TEST(test_accuracy_timeout_inj3);
@ -166,4 +168,5 @@ void test_accuracy_timeout(void)
#if IGN_CHANNELS >= 8 #if IGN_CHANNELS >= 8
RUN_TEST(test_accuracy_timeout_ign8); RUN_TEST(test_accuracy_timeout_ign8);
#endif #endif
}
} }

View File

@ -1,6 +1,6 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
void test_status_initial_off_inj1(void) void test_status_initial_off_inj1(void)
@ -118,6 +118,8 @@ void test_status_initial_off_ign8(void)
void test_status_initial_off(void) void test_status_initial_off(void)
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_status_initial_off_inj1); RUN_TEST(test_status_initial_off_inj1);
RUN_TEST(test_status_initial_off_inj2); RUN_TEST(test_status_initial_off_inj2);
RUN_TEST(test_status_initial_off_inj3); RUN_TEST(test_status_initial_off_inj3);
@ -151,4 +153,5 @@ void test_status_initial_off(void)
#if IGN_CHANNELS >= 8 #if IGN_CHANNELS >= 8
RUN_TEST(test_status_initial_off_ign8); RUN_TEST(test_status_initial_off_ign8);
#endif #endif
}
} }

View File

@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
#define TIMEOUT 1000 #define TIMEOUT 1000
@ -156,6 +156,8 @@ void test_status_off_to_pending_ign8(void)
void test_status_off_to_pending(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_inj1);
RUN_TEST(test_status_off_to_pending_inj2); RUN_TEST(test_status_off_to_pending_inj2);
RUN_TEST(test_status_off_to_pending_inj3); RUN_TEST(test_status_off_to_pending_inj3);
@ -189,4 +191,5 @@ void test_status_off_to_pending(void)
#if IGN_CHANNELS >= 8 #if IGN_CHANNELS >= 8
RUN_TEST(test_status_off_to_pending_ign8); RUN_TEST(test_status_off_to_pending_ign8);
#endif #endif
}
} }

View File

@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
#define TIMEOUT 1000 #define TIMEOUT 1000
@ -172,6 +172,8 @@ void test_status_pending_to_running_ign8(void)
void test_status_pending_to_running(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_inj1);
RUN_TEST(test_status_pending_to_running_inj2); RUN_TEST(test_status_pending_to_running_inj2);
RUN_TEST(test_status_pending_to_running_inj3); 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_ign6);
RUN_TEST(test_status_pending_to_running_ign7); RUN_TEST(test_status_pending_to_running_ign7);
RUN_TEST(test_status_pending_to_running_ign8); RUN_TEST(test_status_pending_to_running_ign8);
}
} }

View File

@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
#define TIMEOUT 1000 #define TIMEOUT 1000
@ -172,6 +172,8 @@ void test_status_running_to_off_ign8(void)
void test_status_running_to_off(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_inj1);
RUN_TEST(test_status_running_to_off_inj2); RUN_TEST(test_status_running_to_off_inj2);
RUN_TEST(test_status_running_to_off_inj3); 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_ign6);
RUN_TEST(test_status_running_to_off_ign7); RUN_TEST(test_status_running_to_off_ign7);
RUN_TEST(test_status_running_to_off_ign8); RUN_TEST(test_status_running_to_off_ign8);
}
} }

View File

@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <unity.h> #include <unity.h>
#include "../test_utils.h"
#include "scheduler.h" #include "scheduler.h"
#define TIMEOUT 1000 #define TIMEOUT 1000
@ -204,6 +204,8 @@ void test_status_running_to_pending_ign8(void)
void test_status_running_to_pending(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_inj1);
RUN_TEST(test_status_running_to_pending_inj2); RUN_TEST(test_status_running_to_pending_inj2);
RUN_TEST(test_status_running_to_pending_inj3); 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_ign6);
RUN_TEST(test_status_running_to_pending_ign7); RUN_TEST(test_status_running_to_pending_ign7);
RUN_TEST(test_status_running_to_pending_ign8); RUN_TEST(test_status_running_to_pending_ign8);
}
} }

View File

@ -4,6 +4,7 @@
typedef uint8_t byte; typedef uint8_t byte;
#include "test_table2d.h" #include "test_table2d.h"
#include "table2d.h" #include "table2d.h"
#include "../test_utils.h"
static constexpr uint8_t TEST_TABLE2D_SIZE = 9; static constexpr uint8_t TEST_TABLE2D_SIZE = 9;
@ -147,9 +148,12 @@ void test_table2d_all_decrementing(void)
void testTable2d() void testTable2d()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_table2dLookup_50pct); RUN_TEST(test_table2dLookup_50pct);
RUN_TEST(test_table2dLookup_exactAxis); RUN_TEST(test_table2dLookup_exactAxis);
RUN_TEST(test_table2dLookup_overMax); RUN_TEST(test_table2dLookup_overMax);
RUN_TEST(test_table2dLookup_underMin); RUN_TEST(test_table2dLookup_underMin);
RUN_TEST(test_table2d_all_decrementing); RUN_TEST(test_table2d_all_decrementing);
}
} }

View File

@ -4,6 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include "tests_tables.h" #include "tests_tables.h"
#include "table3d.h" #include "table3d.h"
#include "../test_utils.h"
#define _countof(x) (sizeof(x) / sizeof (x[0])) #define _countof(x) (sizeof(x) / sizeof (x[0]))
@ -113,6 +114,8 @@ void setup_TestTable(void)
void testTables() void testTables()
{ {
SET_UNITY_FILENAME() {
RUN_TEST(test_tableLookup_50pct); RUN_TEST(test_tableLookup_50pct);
RUN_TEST(test_tableLookup_exact1Axis); RUN_TEST(test_tableLookup_exact1Axis);
RUN_TEST(test_tableLookup_exact2Axis); RUN_TEST(test_tableLookup_exact2Axis);
@ -123,6 +126,7 @@ void testTables()
RUN_TEST(test_tableLookup_roundUp); RUN_TEST(test_tableLookup_roundUp);
//RUN_TEST(test_all_incrementing); //RUN_TEST(test_all_incrementing);
}
} }
void test_tableLookup_50pct(void) void test_tableLookup_50pct(void)

View File

@ -1,6 +1,9 @@
#pragma once #pragma once
#include <stdint.h>
#include <unity.h>
// Unity macro to reduce memory usage (RAM, .bss) // Unity macro to reduce memory usage (RAM, .bss)
// //
// Unity supplied RUN_TEST captures the function name // Unity supplied RUN_TEST captures the function name
@ -16,3 +19,21 @@
strcpy_P(funcName, PSTR(#func)); \ strcpy_P(funcName, PSTR(#func)); \
UnityDefaultTestRun(func, funcName, __LINE__); \ 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 )