thermostat/tests/EnOut/test_EnOut.cpp

81 lines
1.5 KiB
C++

/*
* Author: username
* Date: todays_date
* filename: test_EnOut.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 "EnOut.h"
#include "MockRegEdit.h"
}
void FakeDelay(double us)
{
//do Nothing.
}
void (*Delay_MicroSeconds)(double us) = FakeDelay;
TEST_GROUP(test_EnOut)
{
void setup()
{
//UT_PTR_SET(Delay_MicroSeconds, FakeDelay);
}
void teardown()
{
mock().checkExpectations();
mock().clear();
}
};
TEST(test_EnOut, FirstTest)
{
//FAIL("Fail me!");
CHECK(true);
}
TEST(test_EnOut, EnOut_SetupPins)
{
//Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTA.DIR)
.withUnsignedIntParameter("bit_num", G1);
EnOut_SetupPins();
}
TEST(test_EnOut, EnOut_SetAllHigh)
{
//Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTA.OUT)
.withUnsignedIntParameter("bit_num", G1);
EnOut_SetAllHigh();
}
TEST(test_EnOut, EnOut_PulsePins)
{
//Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTA.OUT)
.withUnsignedIntParameter("bit_num", G1);
EnOut_PulsePins(1000);
}