High/tests/EnOut/test_EnOut.cpp

81 lines
1.5 KiB
C++
Raw Normal View History

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