2024-07-27 19:48:34 +00:00
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
2024-07-27 19:53:45 +00:00
|
|
|
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);
|
|
|
|
|
2024-07-27 19:48:34 +00:00
|
|
|
Enable_SetPinsHigh();
|
|
|
|
}
|
2024-07-27 19:53:45 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|