fg004_a1/tests/TriacOut/test_TriacOut.cpp

120 lines
2.7 KiB
C++
Raw Normal View History

/*
* Author: username
* Date: todays_date
* filename: test_TriacOut.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 "TriacOut.h"
#include "MockRegEdit.h"
}
TEST_GROUP(test_TriacOut)
{
void setup()
{
}
void teardown()
{
mock().checkExpectations();
mock().clear();
}
};
TEST(test_TriacOut, FirstTest)
{
//FAIL("Fail me!");
CHECK(true);
}
TEST(test_TriacOut, TriacOut_SetupPins)
{
//Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTA.DIR)
.withUnsignedIntParameter("bit_num", (1<<1));
//Expect that pin PB3 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.DIR)
.withUnsignedIntParameter("bit_num", (1<<3));
//Expect that pin PB2 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.DIR)
.withUnsignedIntParameter("bit_num", (1<<2));
TriacOut_SetupPins();
}
/*
TEST(test_TriacOut, TriacOut_SetAllHigh)
{
//Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTA.OUT)
.withUnsignedIntParameter("bit_num", (1<<1));
//Expect that pin PB3 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", (1<<3));
//Expect that pin PB2 is set to output
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", (1<<2));
TriacOut_SetAllHigh();
}
*/
/*
TEST(test_TriacOut, TriacOut_InitTimerA)
{
}
void FakeDelay(double us)
{
//do Nothing.
}
*/
/*
TEST(test_TriacOut, TriacOut_PulsePins)
{
UT_PTR_SET(Delay_MicroSeconds, FakeDelay);
//Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTA.OUT)
.withUnsignedIntParameter("bit_num", (1<<1));
//Expect that pin PB3 is set to output
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", (1<<3));
//Expect that pin PB2 is set to output
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", (1<<2));
TriacOut_PulsePins(1000);
}
*/