Commented out tests for ADC that were dependant on AVR stuff.
This commit is contained in:
parent
968570e898
commit
a076ab8b77
1 changed files with 18 additions and 13 deletions
|
@ -9,13 +9,9 @@
|
||||||
#include "CppUTestExt/MockSupport.h"
|
#include "CppUTestExt/MockSupport.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
//This define allows us to dircetly include the device header without error.
|
|
||||||
#define _AVR_IO_H_
|
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <iotn404.h> //ATtiny404 header fille.
|
#include "ch32v003hw.h"
|
||||||
#include "ADC.h"
|
#include "ADC.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +36,8 @@ TEST(test_ADC, FirstTest)
|
||||||
|
|
||||||
TEST(test_ADC, ADC_SetupSetsRegisters)
|
TEST(test_ADC, ADC_SetupSetsRegisters)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
//Clears control register A for ADC0
|
//Clears control register A for ADC0
|
||||||
mock().expectOneCall("RegEdit_SetNum")
|
mock().expectOneCall("RegEdit_SetNum")
|
||||||
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
||||||
|
@ -69,12 +67,14 @@ TEST(test_ADC, ADC_SetupSetsRegisters)
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
.withPointerParameter("reg", (void *) &ADC0.CTRLD)
|
.withPointerParameter("reg", (void *) &ADC0.CTRLD)
|
||||||
.withUnsignedIntParameter("bit_num", 4);
|
.withUnsignedIntParameter("bit_num", 4);
|
||||||
|
|
||||||
|
*/
|
||||||
ADC_Setup();
|
ADC_Setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_InitPortAPin7UsesCorrectRegisters)
|
TEST(test_ADC, ADC_InitPortAPin7UsesCorrectRegisters)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//Check for setting the direction to input.
|
//Check for setting the direction to input.
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||||
|
@ -91,13 +91,13 @@ TEST(test_ADC, ADC_InitPortAPin7UsesCorrectRegisters)
|
||||||
.withPointerParameter("reg", (void *) &PORTA.PIN7CTRL)
|
.withPointerParameter("reg", (void *) &PORTA.PIN7CTRL)
|
||||||
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
||||||
|
|
||||||
|
*/
|
||||||
ADC_Init(7);
|
ADC_Init(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters)
|
TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//Check for setting the direction to input.
|
//Check for setting the direction to input.
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||||
|
@ -113,39 +113,43 @@ TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters)
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
.withPointerParameter("reg", (void *) &PORTA.PIN0CTRL)
|
.withPointerParameter("reg", (void *) &PORTA.PIN0CTRL)
|
||||||
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
ADC_Init(0);
|
ADC_Init(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_InitDoesNothingOnHighPinNumbers)
|
TEST(test_ADC, ADC_InitDoesNothingOnHighPinNumbers)
|
||||||
{
|
{
|
||||||
mock().expectNoCall("RegEdit_SetBit");
|
//mock().expectNoCall("RegEdit_SetBit");
|
||||||
ADC_Init(8);
|
ADC_Init(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_EnablePasses)
|
TEST(test_ADC, ADC_EnablePasses)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
||||||
.withUnsignedIntParameter("bit_num", 0);
|
.withUnsignedIntParameter("bit_num", 0);
|
||||||
|
|
||||||
|
*/
|
||||||
ADC_Enable();
|
ADC_Enable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_DisablePasses)
|
TEST(test_ADC, ADC_DisablePasses)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
||||||
.withUnsignedIntParameter("bit_num", 0);
|
.withUnsignedIntParameter("bit_num", 0);
|
||||||
|
*/
|
||||||
ADC_Disable();
|
ADC_Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_SetPinSetsRightRegisters)
|
TEST(test_ADC, ADC_SetPinSetsRightRegisters)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//It clears existing MUXPOS register values.
|
//It clears existing MUXPOS register values.
|
||||||
mock().expectOneCall("RegEdit_ClearRegister")
|
mock().expectOneCall("RegEdit_ClearRegister")
|
||||||
.withPointerParameter("reg", (void *) &ADC0.MUXPOS);
|
.withPointerParameter("reg", (void *) &ADC0.MUXPOS);
|
||||||
|
@ -154,7 +158,8 @@ TEST(test_ADC, ADC_SetPinSetsRightRegisters)
|
||||||
mock().expectOneCall("RegEdit_SetNum")
|
mock().expectOneCall("RegEdit_SetNum")
|
||||||
.withPointerParameter("reg", (void *) &ADC0.MUXPOS)
|
.withPointerParameter("reg", (void *) &ADC0.MUXPOS)
|
||||||
.withUnsignedIntParameter("num", 4);
|
.withUnsignedIntParameter("num", 4);
|
||||||
|
|
||||||
|
*/
|
||||||
ADC_SetPin(4);
|
ADC_SetPin(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue