-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Added tests for preprocessing feature
- Loading branch information
Showing
15 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#include "adc_hardwareA.h" | ||
#include "adc_hardware_configuratorA.h" | ||
|
||
void AdcHardware_Init(void) | ||
{ | ||
// Reusing outer test file preprocessing symbol to prevent linking failure | ||
#ifdef PREPROCESSING_TESTS | ||
Adc_Reset(); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#ifndef _ADCHARDWARE_H | ||
#define _ADCHARDWARE_H | ||
|
||
void AdcHardware_Init(void); | ||
|
||
#endif // _ADCHARDWARE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#include "adc_hardwareB.h" | ||
#include "adc_hardware_configuratorB.h" | ||
|
||
void AdcHardware_Init(void) | ||
{ | ||
Adc_Reset(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#ifndef _ADCHARDWARE_H | ||
#define _ADCHARDWARE_H | ||
|
||
void AdcHardware_Init(void); | ||
|
||
#endif // _ADCHARDWARE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#include "adc_hardwareC.h" | ||
#include "adc_hardware_configuratorC.h" | ||
|
||
void AdcHardware_Init(void) | ||
{ | ||
Adc_Reset(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#ifndef _ADCHARDWARE_H | ||
#define _ADCHARDWARE_H | ||
|
||
void AdcHardware_Init(void); | ||
|
||
#endif // _ADCHARDWARE_H |
13 changes: 13 additions & 0 deletions
13
assets/tests_with_preprocessing/src/adc_hardware_configuratorA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#ifndef _ADCHARDWARECONFIGURATOR_H | ||
#define _ADCHARDWARECONFIGURATOR_H | ||
|
||
void Adc_Reset(void); | ||
|
||
#endif // _ADCHARDWARECONFIGURATOR_H |
15 changes: 15 additions & 0 deletions
15
assets/tests_with_preprocessing/src/adc_hardware_configuratorB.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#ifndef _ADCHARDWARECONFIGURATOR_H | ||
#define _ADCHARDWARECONFIGURATOR_H | ||
|
||
#ifdef PREPROCESSING_MOCKS | ||
void Adc_Reset(void); | ||
#endif | ||
|
||
#endif // _ADCHARDWARECONFIGURATOR_H |
15 changes: 15 additions & 0 deletions
15
assets/tests_with_preprocessing/src/adc_hardware_configuratorC.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#ifndef _ADCHARDWARECONFIGURATOR_H | ||
#define _ADCHARDWARECONFIGURATOR_H | ||
|
||
#ifdef PREPROCESSING_MOCKS | ||
void Adc_Reset(void); | ||
#endif | ||
|
||
#endif // _ADCHARDWARECONFIGURATOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#include "unity.h" | ||
#include "adc_hardwareA.h" | ||
#ifdef PREPROCESSING_TESTS | ||
#include "mock_adc_hardware_configuratorA.h" | ||
#endif | ||
|
||
void setUp(void) | ||
{ | ||
} | ||
|
||
void tearDown(void) | ||
{ | ||
} | ||
|
||
#ifdef PREPROCESSING_TESTS | ||
void test_init_should_call_adc_reset(void) | ||
{ | ||
Adc_Reset_Expect(); | ||
|
||
AdcHardware_Init(); | ||
} | ||
#endif | ||
|
||
#ifndef PREPROCESSING_TESTS | ||
void test_caseA_should_fail(void) | ||
{ | ||
TEST_FAIL_MESSAGE("Intentional failure"); | ||
} | ||
|
||
void test_caseB_should_fail(void) | ||
{ | ||
TEST_FAIL_MESSAGE("Intentional failure"); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#include "unity.h" | ||
#include "adc_hardwareB.h" | ||
#include "mock_adc_hardware_configuratorB.h" | ||
|
||
void setUp(void) | ||
{ | ||
} | ||
|
||
void tearDown(void) | ||
{ | ||
} | ||
|
||
void test_init_should_call_adc_reset(void) | ||
{ | ||
Adc_Reset_Expect(); | ||
|
||
AdcHardware_Init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* ========================================================================= | ||
Ceedling - Test-Centered Build System for C | ||
ThrowTheSwitch.org | ||
Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | ||
SPDX-License-Identifier: MIT | ||
========================================================================= */ | ||
|
||
#include "unity.h" | ||
#include "adc_hardwareC.h" | ||
#ifdef PREPROCESSING_TESTS | ||
#include "mock_adc_hardware_configuratorC.h" | ||
#endif | ||
|
||
void setUp(void) | ||
{ | ||
} | ||
|
||
void tearDown(void) | ||
{ | ||
} | ||
|
||
#ifdef PREPROCESSING_TESTS | ||
void test_init_should_call_adc_reset(void) | ||
{ | ||
Adc_Reset_Expect(); | ||
|
||
AdcHardware_Init(); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters