Added Enable into the tests.
This commit is contained in:
parent
9e41bdc578
commit
bf62e8ad15
|
@ -10,6 +10,7 @@ add_subdirectory(simple_test)
|
|||
add_subdirectory(ADC)
|
||||
add_subdirectory(MockADC)
|
||||
add_subdirectory(load)
|
||||
add_subdirectory(Enable)
|
||||
add_subdirectory(zero_cross_detection)
|
||||
|
||||
|
||||
|
@ -27,6 +28,7 @@ target_link_libraries(AllTests
|
|||
# TEST_LINKS
|
||||
test_Relays
|
||||
test_SuperLoop
|
||||
test_Enable
|
||||
test_ADC
|
||||
test_RegEdit
|
||||
simple_test
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# TEST_RUNNER
|
||||
add_library(test_Enable
|
||||
test_Enable.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(test_Enable
|
||||
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||
MockRegEdit
|
||||
Enable
|
||||
)
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Author: username
|
||||
* Date: todays_date
|
||||
* filename: test_Enable.c
|
||||
* description: module_purpose
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "CppUTest/CommandLineTestRunner.h"
|
||||
#include "CppUTestExt/MockSupport.h"
|
||||
|
||||
//This define allows us to dircetly include the device header without error.
|
||||
#define _AVR_IO_H_
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <iotn404.h>
|
||||
#include "Enable.h"
|
||||
#include "MockRegEdit.h"
|
||||
}
|
||||
|
||||
TEST_GROUP(test_Enable)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
|
||||
}
|
||||
void teardown()
|
||||
{
|
||||
mock().checkExpectations();
|
||||
mock().clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST(test_Enable, SetEnablePinsHighCallsCorrectFuncs)
|
||||
{
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||
.withUnsignedIntParameter("bit_num", EN1);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.DIR)
|
||||
.withUnsignedIntParameter("bit_num", EN2);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.DIR)
|
||||
.withUnsignedIntParameter("bit_num", EN3);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||
.withUnsignedIntParameter("bit_num", EN1);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
||||
.withUnsignedIntParameter("bit_num", EN2);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
||||
.withUnsignedIntParameter("bit_num", EN3);
|
||||
|
||||
Enable_SetPinsHigh();
|
||||
}
|
||||
|
||||
TEST(test_Enable, SetEnablePinsLow)
|
||||
{
|
||||
|
||||
mock().expectOneCall("RegEdit_ClearBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||
.withUnsignedIntParameter("bit_num", EN1);
|
||||
|
||||
mock().expectOneCall("RegEdit_ClearBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
||||
.withUnsignedIntParameter("bit_num", EN2);
|
||||
|
||||
mock().expectOneCall("RegEdit_ClearBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
||||
.withUnsignedIntParameter("bit_num", EN3);
|
||||
|
||||
Enable_SetPinsLow();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue