Compare commits
9 commits
670f15116a
...
1f17f8dcdf
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f17f8dcdf | |||
| 96b0a72533 | |||
| c4bc661f8b | |||
| d4a0d09dd6 | |||
| 90729c2ff7 | |||
| 9920702102 | |||
| 490fb96445 | |||
| 455c70c34b | |||
| 34afa025aa |
38 changed files with 3223 additions and 1718 deletions
|
|
@ -22,13 +22,13 @@ endif()
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
# Request C standard features
|
# Request C standard features
|
||||||
set(CMAKE_C_STANDARD 23)
|
set(CMAKE_C_STANDARD 17)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||||
set(CMAKE_C_FLAGS "-Wall -Wpedantic")
|
set(CMAKE_C_FLAGS "-Wall -Wpedantic")
|
||||||
#set(CMAKE_C_FLAGS "-Wall -Werror -Wpedantic")
|
#set(CMAKE_C_FLAGS "-Wall -Werror -Wpedantic")
|
||||||
|
|
||||||
# SETUP THE CXX flags for .cpp
|
# SETUP THE CXX flags for .cpp
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
set(CMAKE_CXX_FLAGS "-Wall -Werror -Wpedantic")
|
set(CMAKE_CXX_FLAGS "-Wall -Werror -Wpedantic")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,5 @@ instructions.
|
||||||
- [ ] Add useful mock examples.
|
- [ ] Add useful mock examples.
|
||||||
- [X] Get Blinky to run on hardware.
|
- [X] Get Blinky to run on hardware.
|
||||||
- [ ] Set conditional compile/linker flags?
|
- [ ] Set conditional compile/linker flags?
|
||||||
|
- [ ] Get RegEdit setup for 32bit addresses.
|
||||||
|
|
||||||
|
|
|
||||||
71
inc/RegEdit.h
Normal file
71
inc/RegEdit.h
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
/**
|
||||||
|
* @brief Module/Interface for editing AVR registers
|
||||||
|
* @details This file is an interface to AVR registers or the avr/io.h
|
||||||
|
* @author Jake G
|
||||||
|
* @date 2024
|
||||||
|
* @copyright None
|
||||||
|
* @file RegEdit.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REGEDIT_H
|
||||||
|
#define REGEDIT_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the value of the register to 0xFF.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
*/
|
||||||
|
void RegEdit_SetRegister(void *reg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the value of the register to 0x00.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
*/
|
||||||
|
void RegEdit_ClearRegister(void *reg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets a single bit in the register.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
* @param The bit's index or number in the register
|
||||||
|
*/
|
||||||
|
void RegEdit_SetBit(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clears a single bit in the register.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
* @param The bit's index or number in the register
|
||||||
|
*/
|
||||||
|
void RegEdit_ClearBit(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a single bit is set in the register.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
* @param The bit's index or number in the register
|
||||||
|
*/
|
||||||
|
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Preforms logical OR Equals with the passed num.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
* @param The bit's index or number in the register
|
||||||
|
*/
|
||||||
|
void RegEdit_OR_Num(void *reg, uint8_t num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Preforms logical AND Equals with the passed num.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
* @param The bit's index or number in the register
|
||||||
|
*/
|
||||||
|
void RegEdit_AND_Num(void *reg, uint8_t num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the register to the passed number value.
|
||||||
|
* @param reg A pointer to a register
|
||||||
|
* @param The bit's index or number in the register
|
||||||
|
*/
|
||||||
|
void RegEdit_SetNum(void *reg, uint8_t num);
|
||||||
|
|
||||||
|
#endif //REGEDIT_H
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
add_subdirectory(MockRegEdit)
|
||||||
|
add_subdirectory(MockADC)
|
||||||
|
add_subdirectory(TimerMock)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
7
mocks/MockADC/CMakeLists.txt
Normal file
7
mocks/MockADC/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
add_library(MockADC STATIC
|
||||||
|
MockADC.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(MockADC PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
)
|
||||||
84
mocks/MockADC/MockADC.c
Normal file
84
mocks/MockADC/MockADC.c
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: 2024
|
||||||
|
* filename: MockADC.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "MockADC.h"
|
||||||
|
#include "CppUTestExt/MockSupport_c.h"
|
||||||
|
|
||||||
|
#define FAKESIZE 256
|
||||||
|
|
||||||
|
uint16_t fake_data[FAKESIZE];
|
||||||
|
int fake_index = 0;
|
||||||
|
|
||||||
|
static bool is_setup = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ADC_SetPin(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Setup(void)
|
||||||
|
{
|
||||||
|
is_setup = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Init(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("ADC_Init")
|
||||||
|
->withUnsignedIntParameters("pin_num", pin_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Enable(void)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("ADC_Enable");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Disable()
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("ADC_Disable");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ADC_ReadValue_Impl(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("ADC_ReadValue_Impl")
|
||||||
|
->withUnsignedIntParameters("pin_num", pin_num);
|
||||||
|
|
||||||
|
if(fake_index == 0){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return fake_data[--fake_index];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t (*ADC_ReadValue)(uint8_t pin_num) = ADC_ReadValue_Impl;
|
||||||
|
|
||||||
|
|
||||||
|
void MockADC_PushValue(uint16_t value){
|
||||||
|
if(fake_index >= FAKESIZE - 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fake_data[fake_index++] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MockADC_ZeroIndex(void)
|
||||||
|
{
|
||||||
|
fake_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int MockADC_GetIndex(void)
|
||||||
|
{
|
||||||
|
return fake_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MockADC_IsSetup(void)
|
||||||
|
{
|
||||||
|
return is_setup;
|
||||||
|
}
|
||||||
30
mocks/MockADC/MockADC.h
Normal file
30
mocks/MockADC/MockADC.h
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
* @brief PUT_TEXT_HERE
|
||||||
|
* @details This file is...
|
||||||
|
* @author username
|
||||||
|
* @date todays_date
|
||||||
|
* @copyright None
|
||||||
|
* @file MOCKADC.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MOCKADC_H
|
||||||
|
#define MOCKADC_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
void ADC_Setup(void);
|
||||||
|
void ADC_SetPin(uint8_t pin_num);
|
||||||
|
void ADC_Init(uint8_t pin_num);
|
||||||
|
void ADC_Enable(void);
|
||||||
|
void ADC_Disable(void);
|
||||||
|
|
||||||
|
extern uint16_t (*ADC_ReadValue)(uint8_t pin_num);
|
||||||
|
|
||||||
|
void MockADC_PushValue(uint16_t value);
|
||||||
|
void MockADC_ZeroIndex(void);
|
||||||
|
int MockADC_GetIndex(void);
|
||||||
|
bool MockADC_IsSetup(void);
|
||||||
|
|
||||||
|
#endif //MOCKADC_H
|
||||||
12
mocks/MockRegEdit/CMakeLists.txt
Normal file
12
mocks/MockRegEdit/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
add_library(MockRegEdit STATIC
|
||||||
|
MockRegEdit.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(MockRegEdit PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(MockRegEdit
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
|
)
|
||||||
85
mocks/MockRegEdit/MockRegEdit.c
Normal file
85
mocks/MockRegEdit/MockRegEdit.c
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: 2024
|
||||||
|
* filename: MockRegEdit.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "MockRegEdit.h"
|
||||||
|
#include "CppUTestExt/MockSupport_c.h"
|
||||||
|
|
||||||
|
|
||||||
|
void RegEdit_SetRegister(void *reg)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_SetRegister")
|
||||||
|
->withPointerParameters("reg", reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_ClearRegister(void *reg)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_ClearRegister")
|
||||||
|
->withPointerParameters("reg", reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RegEdit_SetBit(void *reg, uint8_t bit_num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_SetBit")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->withUnsignedIntParameters("bit_num", bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RegEdit_ClearBit(void *reg, uint8_t bit_num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_ClearBit")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->withUnsignedIntParameters("bit_num", bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num)
|
||||||
|
{
|
||||||
|
|
||||||
|
return mock_c()->actualCall("RegEdit_IsBitSet")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->withUnsignedIntParameters("bit_num", bit_num)
|
||||||
|
->returnBoolValueOrDefault(true);
|
||||||
|
//return mock_c()->returnBoolValueOrDefault(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_OR_Num(void *reg, uint32_t num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_OR_Num")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->withUnsignedIntParameters("num", num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RegEdit_AND_Num(void *reg, uint32_t num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_AND_Num")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->withUnsignedIntParameters("num", num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void RegEdit_SetNum(void *reg, uint32_t num)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("RegEdit_SetNum")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->withUnsignedIntParameters("num", num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t RegEdit_ReadReg(void *reg)
|
||||||
|
{
|
||||||
|
uint8_t value = *(uint8_t *)reg;
|
||||||
|
|
||||||
|
mock_c()->actualCall("RegEdit_ReadReg")
|
||||||
|
->withPointerParameters("reg", reg)
|
||||||
|
->returnUnsignedIntValueOrDefault(value);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
30
mocks/MockRegEdit/MockRegEdit.h
Normal file
30
mocks/MockRegEdit/MockRegEdit.h
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
* @brief PUT_TEXT_HERE
|
||||||
|
* @details This file is...
|
||||||
|
* @author username
|
||||||
|
* @date todays_date
|
||||||
|
* @copyright None
|
||||||
|
* @file MockRegEdit.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MOCKREGEDIT_H
|
||||||
|
#define MOCKREGEDIT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
void RegEdit_SetRegister(void *reg);
|
||||||
|
void RegEdit_ClearRegister(void *reg);
|
||||||
|
void RegEdit_SetBit(void *reg, uint8_t bit_num);
|
||||||
|
void RegEdit_ClearBit(void *reg, uint8_t bit_num);
|
||||||
|
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
void RegEdit_OR_Num(void *reg, uint32_t num);
|
||||||
|
void RegEdit_AND_Num(void *reg, uint32_t num);
|
||||||
|
|
||||||
|
void RegEdit_SetNum(void *reg, uint32_t num);
|
||||||
|
|
||||||
|
uint8_t RegEdit_ReadReg(void *reg);
|
||||||
|
|
||||||
|
#endif //MOCKREGEDIT_H
|
||||||
51
mocks/MockRegEdit/u8_comparator.cpp
Normal file
51
mocks/MockRegEdit/u8_comparator.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
#include "u8_comparator.hpp"
|
||||||
|
#include "CppUTest/SimpleString.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
class MyTypeComparator : public MockNamedValueComparator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool isEqual(const void* object1, const void* object2)
|
||||||
|
{
|
||||||
|
return object1 == object2;
|
||||||
|
}
|
||||||
|
virtual SimpleString valueToString(const void* object)
|
||||||
|
{
|
||||||
|
return StringFrom(object);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool UInt8PointerComparator::isEqual(const void* object1, const void* object2) {
|
||||||
|
const uint8_t* ptr1 = reinterpret_cast<const uint8_t*>(object1);
|
||||||
|
const uint8_t* ptr2 = reinterpret_cast<const uint8_t*>(object2);
|
||||||
|
return std::memcmp(ptr1, ptr2, sizeof(uint8_t)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleString UInt8PointerComparator::valueToString(const void* object) {
|
||||||
|
const uint8_t* ptr = reinterpret_cast<const uint8_t*>(object);
|
||||||
|
return StringFromFormat("0x%02x", *ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
bool UInt8PointerComparator::isEqual(const void* object1, const void* object2) const {
|
||||||
|
const uint8_t* ptr1 = static_cast<const uint8_t*>(object1);
|
||||||
|
const uint8_t* ptr2 = static_cast<const uint8_t*>(object2);
|
||||||
|
return std::memcmp(ptr1, ptr2, sizeof(uint8_t)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleString UInt8PointerComparator::valueToString(const void* object) const {
|
||||||
|
const uint8_t* ptr = static_cast<const uint8_t*>(object);
|
||||||
|
return StringFromFormat("0x%02x", *ptr);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool UInt8Comparator::isEqual(const void* object1, const void* object2) {
|
||||||
|
return (uint8_t*)object1 == (uint8_t *)object2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleString UInt8Comparator::valueToString(const void* object) {
|
||||||
|
//uint8_t value = reinterpret_cast<uint8_t>(object);
|
||||||
|
const uint8_t *ptr = reinterpret_cast<const uint8_t*>(object);
|
||||||
|
return StringFromFormat("0x%02x", *ptr);
|
||||||
|
}
|
||||||
20
mocks/MockRegEdit/u8_comparator.hpp
Normal file
20
mocks/MockRegEdit/u8_comparator.hpp
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef U8_COMPARATOR_H
|
||||||
|
#define U8_COMPARATOR_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <CppUTestExt/MockSupport.h>
|
||||||
|
|
||||||
|
class UInt8PointerComparator : public MockNamedValueComparator {
|
||||||
|
public:
|
||||||
|
virtual bool isEqual(const void* object1, const void* object2) override;
|
||||||
|
SimpleString valueToString(const void* object) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class UInt8Comparator : public MockNamedValueComparator {
|
||||||
|
public:
|
||||||
|
virtual bool isEqual(const void* object1, const void* object2) override;
|
||||||
|
SimpleString valueToString(const void* object) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //U8_COMPARATOR_H
|
||||||
7
mocks/TimerMock/CMakeLists.txt
Normal file
7
mocks/TimerMock/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
add_library(TimerMock STATIC
|
||||||
|
TimerMock.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(TimerMock PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
)
|
||||||
31
mocks/TimerMock/TimerMock.c
Normal file
31
mocks/TimerMock/TimerMock.c
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Author: Jake G
|
||||||
|
* Date: 2024-09-02
|
||||||
|
* filename: TimerMock.c
|
||||||
|
* description: mocks timers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TimerMock.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "CppUTestExt/MockSupport_c.h"
|
||||||
|
|
||||||
|
static bool timer_started = false;
|
||||||
|
|
||||||
|
void Timer_Start(void)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("Timer_Start");
|
||||||
|
timer_started = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Timer_Stop(void)
|
||||||
|
{
|
||||||
|
mock_c()->actualCall("Timer_Stop");
|
||||||
|
timer_started = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t Timer_GetOverflowCount(void)
|
||||||
|
{
|
||||||
|
uint16_t time = 0xAAAA;
|
||||||
|
return mock_c()->actualCall("Timer_GetOverflowCount")
|
||||||
|
->returnUnsignedIntValueOrDefault(time);
|
||||||
|
}
|
||||||
26
mocks/TimerMock/TimerMock.h
Normal file
26
mocks/TimerMock/TimerMock.h
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**
|
||||||
|
* @brief A Mock of the timer module.
|
||||||
|
* @details This file is only used for testing.
|
||||||
|
* @author Jake G
|
||||||
|
* @date 2024-09-02
|
||||||
|
* @copyright None
|
||||||
|
* @file TimerMock.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TIMER_MOCK_H
|
||||||
|
#define TIMER_MOCK_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function
|
||||||
|
* @param a The first argument
|
||||||
|
*/
|
||||||
|
void Timer_Start(void);
|
||||||
|
|
||||||
|
void Timer_Stop(void);
|
||||||
|
|
||||||
|
uint16_t Timer_GetOverflowCount(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif //TIMER_MOCK_H
|
||||||
8
otto.sh
8
otto.sh
|
|
@ -28,9 +28,9 @@ format_source_code () {
|
||||||
|
|
||||||
add_compile_commands () {
|
add_compile_commands () {
|
||||||
if [ -f ./compile_commands.json ]; then
|
if [ -f ./compile_commands.json ]; then
|
||||||
echo "compile_commands.json already exists!\n"
|
echo "compile_commands.json already exists!"
|
||||||
else
|
else
|
||||||
echo "Creating new symlink for compile commands!\n"
|
echo "Creating new symlink for compile commands!"
|
||||||
ln -s ./build/compile_commands.json ./compile_commands.json
|
ln -s ./build/compile_commands.json ./compile_commands.json
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -247,8 +247,8 @@ build_hex () {
|
||||||
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${WCH_TC}"
|
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${WCH_TC}"
|
||||||
|
|
||||||
cmake ${CMAKE_ARGS} ../
|
cmake ${CMAKE_ARGS} ../
|
||||||
make all
|
make main
|
||||||
make hex
|
#make hex
|
||||||
}
|
}
|
||||||
|
|
||||||
build_hex_optimized () {
|
build_hex_optimized () {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ set(DEBUG_BINARY 1)
|
||||||
set(CMAKE_SYSTEM_VERSION 1)
|
set(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Without this flag, CMake is unable to pass the test compilation check
|
||||||
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
# This logic checks the operating system.
|
# This logic checks the operating system.
|
||||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
|
@ -32,6 +35,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
set(NEWLIB /usr/local/riscv/riscv32-unknown-elf/include)
|
set(NEWLIB /usr/local/riscv/riscv32-unknown-elf/include)
|
||||||
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
||||||
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
||||||
|
set(CMAKE_ASM_COMPILER riscv32-unknown-elf-gcc)
|
||||||
set(CMAKE_FIND_ROOT_PATH /usr/local/riscv/)
|
set(CMAKE_FIND_ROOT_PATH /usr/local/riscv/)
|
||||||
|
|
||||||
# Without these two lines it freaks out.
|
# Without these two lines it freaks out.
|
||||||
|
|
@ -43,6 +47,7 @@ elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
set(NEWLIB /opt/riscv/riscv32-unknown-elf/include)
|
set(NEWLIB /opt/riscv/riscv32-unknown-elf/include)
|
||||||
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
|
||||||
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++)
|
||||||
|
set(CMAKE_ASM_COMPILER riscv32-unknown-elf-gcc)
|
||||||
|
|
||||||
# Without these two lines it freaks out.
|
# Without these two lines it freaks out.
|
||||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT GNU)
|
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT GNU)
|
||||||
|
|
@ -111,10 +116,13 @@ set(C_FLAGS_ARCH "\
|
||||||
# They print out from the messages just fine, but they are ignored.
|
# They print out from the messages just fine, but they are ignored.
|
||||||
|
|
||||||
UNSET(CMAKE_C_FLAGS CACHE)
|
UNSET(CMAKE_C_FLAGS CACHE)
|
||||||
|
UNSET(CMAKE_CXX_FLAGS CACHE)
|
||||||
|
|
||||||
# I'm appending to the existing cflags from the cmake file in the root dir.
|
# I'm appending to the existing cflags from the cmake file in the root dir.
|
||||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}")
|
||||||
#set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}")
|
||||||
|
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS} ${C_FLAGS_ARCH} ${OBJECT_GEN_FLAGS}" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
|
||||||
#-------------------
|
#-------------------
|
||||||
|
|
|
||||||
77
src/ADC/ADC.c
Normal file
77
src/ADC/ADC.c
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: 2024
|
||||||
|
* filename: ADC.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ADC.h"
|
||||||
|
#include "RegEdit.h"
|
||||||
|
#include "ch32fun.h"
|
||||||
|
|
||||||
|
#define MAX_PIN_NUM 7
|
||||||
|
|
||||||
|
static bool IsInvalidPin(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
if (pin_num > MAX_PIN_NUM)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Setup(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Init(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
if (IsInvalidPin(pin_num))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Enable(void)
|
||||||
|
{
|
||||||
|
// Set the enable bit in the CTRLA register
|
||||||
|
// RegEdit_SetBit((void *)&ADC0.CTRLA, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_Disable(void)
|
||||||
|
{
|
||||||
|
// Clear the enable ADC flag
|
||||||
|
// RegEdit_ClearBit((void *)&ADC0.CTRLA, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADC_SetPin(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
if (IsInvalidPin(pin_num))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// RegEdit_ClearRegister((void *)&ADC0.MUXPOS);
|
||||||
|
// RegEdit_SetNum((void *)&ADC0.MUXPOS, pin_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ADC_ReadValue_Impl(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
// RegEdit_SetNum((void *)&ADC0.COMMAND, ADC_STCONV_bm);
|
||||||
|
|
||||||
|
/* Wait until ADC conversion done */
|
||||||
|
// while (!(ADC0.INTFLAGS & ADC_RESRDY_bm))
|
||||||
|
//{
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/* Clear the interrupt flag by writing 1: */
|
||||||
|
// ADC0.INTFLAGS = ADC_RESRDY_bm;
|
||||||
|
|
||||||
|
// uint16_t adc_val = (uint16_t)ADC0.RES;
|
||||||
|
// adc_val = adc_val >> 5;
|
||||||
|
uint16_t adc_val = 0;
|
||||||
|
return adc_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the default for the function pointer.
|
||||||
|
uint16_t (*ADC_ReadValue)(uint8_t pin_num) = ADC_ReadValue_Impl;
|
||||||
68
src/ADC/ADC.h
Normal file
68
src/ADC/ADC.h
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
/**
|
||||||
|
* @brief Interface to the AVR ADC hardware.
|
||||||
|
* @details This file is...
|
||||||
|
* @author Jake G
|
||||||
|
* @date 2024
|
||||||
|
* @copyright None
|
||||||
|
* @file ADC.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ADC_H
|
||||||
|
#define ADC_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes the AVR hardware in order to accept
|
||||||
|
* Input for ADC usage.
|
||||||
|
* @param pin_num The number of the pin 0-7 you are initializing.
|
||||||
|
*
|
||||||
|
* This function only makes use of PORTA by default. It sets the direction
|
||||||
|
* register to input, disables the pull-up resistor and also diables interrupts
|
||||||
|
* alongside the input buffer(digital).
|
||||||
|
*
|
||||||
|
* This in turn helps reduce noise when using the ADC.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ADC_Init(uint8_t pin_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ADC
|
||||||
|
*/
|
||||||
|
void ADC_Enable(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disables the ADC
|
||||||
|
*/
|
||||||
|
void ADC_Disable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads ADC value into variable
|
||||||
|
*
|
||||||
|
* @param pin_num The bin number of the ADC pin being read.
|
||||||
|
*
|
||||||
|
* This function depends on the ADC already being initialized and enabled
|
||||||
|
* before being called.
|
||||||
|
*/
|
||||||
|
extern uint16_t (*ADC_ReadValue)(uint8_t pin_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets up the ADC
|
||||||
|
*
|
||||||
|
* This function sets up the ADC to take and accumulate 32 samples. It also
|
||||||
|
* sets the inital delay to 32 ADC clock cycles, and sets the VREF to VDD or
|
||||||
|
* VCC.
|
||||||
|
*
|
||||||
|
* This function should only need to be called once.
|
||||||
|
*/
|
||||||
|
void ADC_Setup(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the pin used in the MUX for ADC0.
|
||||||
|
*
|
||||||
|
* @param pin_num The number of the pin in Port A.
|
||||||
|
*/
|
||||||
|
void ADC_SetPin(uint8_t pin_num);
|
||||||
|
|
||||||
|
#endif // ADC_H
|
||||||
17
src/ADC/CMakeLists.txt
Normal file
17
src/ADC/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
add_library(ADC STATIC
|
||||||
|
ADC.c
|
||||||
|
)
|
||||||
|
target_include_directories(ADC PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(UNIT_TESTING)
|
||||||
|
target_link_libraries(ADC
|
||||||
|
MockRegEdit
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
target_link_libraries(ADC
|
||||||
|
RegEdit
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
@ -56,20 +56,7 @@ target_link_options(${PROJECT_NAME} PUBLIC
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".elf")
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".elf")
|
||||||
|
|
||||||
#target_link_options(${PROJECT_NAME} PRIVATE -static -nostartfiles -T "./linker_script.ld")
|
|
||||||
|
|
||||||
# The other "targets" are size, upload, debug, production, etc
|
#add_subdirectory(attic)
|
||||||
|
add_subdirectory(ADC)
|
||||||
#if(NOT TARGET size)
|
add_subdirectory(RegEdit)
|
||||||
|
|
||||||
#if(NOT TARGET debug)
|
|
||||||
|
|
||||||
#if(NOT TARGET production)
|
|
||||||
|
|
||||||
#if(NOT TARGET upload)
|
|
||||||
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(attic)
|
|
||||||
|
|
|
||||||
7
src/RegEdit/CMakeLists.txt
Normal file
7
src/RegEdit/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
add_library(RegEdit STATIC
|
||||||
|
RegEdit.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(RegEdit PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
)
|
||||||
62
src/RegEdit/RegEdit.c
Normal file
62
src/RegEdit/RegEdit.c
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: 2024
|
||||||
|
* filename: RegEdit.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RegEdit.h"
|
||||||
|
|
||||||
|
void RegEdit_SetRegister(void *reg)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_ClearRegister(void *reg)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_SetBit(void *reg, uint8_t bit_num)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr |= (uint8_t)(1 << bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_ClearBit(void *reg, uint8_t bit_num)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr &= ~(1 << bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
return *reg_ptr & (1 << bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_OR_Num(void *reg, uint8_t num)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr |= num;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_AND_Num(void *reg, uint8_t num)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr &= num;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEdit_SetNum(void *reg, uint8_t num)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
*reg_ptr = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t RegEdit_ReadReg(void *reg)
|
||||||
|
{
|
||||||
|
uint8_t *reg_ptr = (uint8_t *)reg;
|
||||||
|
return *reg_ptr;
|
||||||
|
}
|
||||||
77
src/RegEdit/RegEdit.h
Normal file
77
src/RegEdit/RegEdit.h
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
/**
|
||||||
|
* @brief Register Editing Interface
|
||||||
|
* @details This file is an abstraction to all the bitwise operations
|
||||||
|
* @author Jake G
|
||||||
|
* @date 2024
|
||||||
|
* @copyright None
|
||||||
|
* @file MockRegEdit.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REGEDIT_H
|
||||||
|
#define REGEDIT_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
*/
|
||||||
|
void RegEdit_SetRegister(void *reg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
*/
|
||||||
|
void RegEdit_ClearRegister(void *reg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
* @param bit_num The bit location.
|
||||||
|
*/
|
||||||
|
void RegEdit_SetBit(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
* @param bit_num The bit location.
|
||||||
|
*/
|
||||||
|
void RegEdit_ClearBit(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
* @param bit_num The bit location.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
* @param num The bit location.
|
||||||
|
*/
|
||||||
|
void RegEdit_OR_Num(void *reg, uint8_t num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
* @param num The bit location.
|
||||||
|
*/
|
||||||
|
void RegEdit_AND_Num(void *reg, uint8_t num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
* @param num The bit location.
|
||||||
|
*/
|
||||||
|
void RegEdit_SetNum(void *reg, uint8_t num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reg The register address.
|
||||||
|
*/
|
||||||
|
uint8_t RegEdit_ReadReg(void *reg);
|
||||||
|
|
||||||
|
#endif // REGEDIT_H
|
||||||
2218
src/ch32fun.c
Executable file → Normal file
2218
src/ch32fun.c
Executable file → Normal file
File diff suppressed because it is too large
Load diff
1337
src/ch32fun.h
Executable file → Normal file
1337
src/ch32fun.h
Executable file → Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef _FUNCONFIG_H
|
#ifndef _FUNCONFIG_H
|
||||||
#define _FUNCONFIG_H
|
#define _FUNCONFIG_H
|
||||||
|
|
||||||
#define CH32V003 1
|
#define CH32V003 1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
17
tests/ADC/CMakeLists.txt
Normal file
17
tests/ADC/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# TEST_RUNNER
|
||||||
|
add_library(test_ADC
|
||||||
|
test_ADC.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(test_ADC
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
|
ADC
|
||||||
|
MockRegEdit
|
||||||
|
)
|
||||||
|
|
||||||
|
#Needed for the tests to function
|
||||||
|
include_directories(
|
||||||
|
/usr/local/avr/include/avr
|
||||||
|
#/usr/lib/avr/include/avr
|
||||||
|
)
|
||||||
192
tests/ADC/test_ADC.cpp
Normal file
192
tests/ADC/test_ADC.cpp
Normal file
|
|
@ -0,0 +1,192 @@
|
||||||
|
/*
|
||||||
|
* Author: Jake G
|
||||||
|
* Date: 2024
|
||||||
|
* filename: test_ADC.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
#include "CppUTestExt/MockSupport.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
//This define allows us to dircetly include the device header without error.
|
||||||
|
#define _AVR_IO_H_
|
||||||
|
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include <iotn404.h> //ATtiny404 header fille.
|
||||||
|
#include "ADC.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_GROUP(test_ADC)
|
||||||
|
{
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
mock().checkExpectations();
|
||||||
|
mock().clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(test_ADC, FirstTest)
|
||||||
|
{
|
||||||
|
CHECK(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_SetupSetsRegisters)
|
||||||
|
{
|
||||||
|
//Clears control register A for ADC0
|
||||||
|
mock().expectOneCall("RegEdit_SetNum")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
||||||
|
.withUnsignedIntParameter("num", 0x00);
|
||||||
|
|
||||||
|
//Sets The sample accumulation number to 32.
|
||||||
|
mock().expectOneCall("RegEdit_SetNum")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLB)
|
||||||
|
.withUnsignedIntParameter("num", 0x5);
|
||||||
|
|
||||||
|
//Sets the voltage reference to VDD or VCC.
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLC)
|
||||||
|
.withUnsignedIntParameter("bit_num", 4);
|
||||||
|
|
||||||
|
//Sets the pre-scalar for the adc sample rate.
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLC)
|
||||||
|
.withUnsignedIntParameter("bit_num", 2);
|
||||||
|
|
||||||
|
//Setup an Initalization delay.
|
||||||
|
mock().expectOneCall("RegEdit_OR_Num")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLD)
|
||||||
|
.withUnsignedIntParameter("num", (2<<5));
|
||||||
|
|
||||||
|
//Set the bit for ADC variation during readings.
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLD)
|
||||||
|
.withUnsignedIntParameter("bit_num", 4);
|
||||||
|
|
||||||
|
ADC_Setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_InitPortAPin7UsesCorrectRegisters)
|
||||||
|
{
|
||||||
|
//Check for setting the direction to input.
|
||||||
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
|
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||||
|
.withUnsignedIntParameter("bit_num", 7);
|
||||||
|
|
||||||
|
//Check that the pullup is off
|
||||||
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
|
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||||
|
.withUnsignedIntParameter("bit_num", 7);
|
||||||
|
|
||||||
|
//Set the ISC(input sense config) to disable digital input
|
||||||
|
//buffering and reduce the noise on ADC usage.
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", (void *) &PORTA.PIN7CTRL)
|
||||||
|
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
||||||
|
|
||||||
|
|
||||||
|
ADC_Init(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Check for setting the direction to input.
|
||||||
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
|
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||||
|
.withUnsignedIntParameter("bit_num", 0);
|
||||||
|
|
||||||
|
//Check that the pullup is off
|
||||||
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
|
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||||
|
.withUnsignedIntParameter("bit_num", 0);
|
||||||
|
|
||||||
|
//Set the ISC(input sense config) to disable digital input
|
||||||
|
//buffering and reduce the noise on ADC usage.
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", (void *) &PORTA.PIN0CTRL)
|
||||||
|
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
||||||
|
|
||||||
|
|
||||||
|
ADC_Init(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_InitDoesNothingOnHighPinNumbers)
|
||||||
|
{
|
||||||
|
mock().expectNoCall("RegEdit_SetBit");
|
||||||
|
ADC_Init(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_EnablePasses)
|
||||||
|
{
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
||||||
|
.withUnsignedIntParameter("bit_num", 0);
|
||||||
|
|
||||||
|
ADC_Enable();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_DisablePasses)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
||||||
|
.withUnsignedIntParameter("bit_num", 0);
|
||||||
|
|
||||||
|
ADC_Disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_SetPinSetsRightRegisters)
|
||||||
|
{
|
||||||
|
//It clears existing MUXPOS register values.
|
||||||
|
mock().expectOneCall("RegEdit_ClearRegister")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.MUXPOS);
|
||||||
|
|
||||||
|
//It Correctly sets the pin number.
|
||||||
|
mock().expectOneCall("RegEdit_SetNum")
|
||||||
|
.withPointerParameter("reg", (void *) &ADC0.MUXPOS)
|
||||||
|
.withUnsignedIntParameter("num", 4);
|
||||||
|
|
||||||
|
ADC_SetPin(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_ADC, ADC_SetPinFailsOnInvalidPin)
|
||||||
|
{
|
||||||
|
ADC_SetPin(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static uint16_t ADC_ReadValueFake(uint8_t pin_num)
|
||||||
|
{
|
||||||
|
return 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_GROUP(test_ADCRead)
|
||||||
|
{
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
UT_PTR_SET(ADC_ReadValue, ADC_ReadValueFake);
|
||||||
|
}
|
||||||
|
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(test_ADCRead, FunctionPointerSwapWorks)
|
||||||
|
{
|
||||||
|
uint16_t value = ADC_ReadValue(0);
|
||||||
|
|
||||||
|
LONGS_EQUAL(512, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
//ImportTestGroups
|
//ImportTestGroups
|
||||||
IMPORT_TEST_GROUP(simple_test);
|
IMPORT_TEST_GROUP(simple_test);
|
||||||
|
IMPORT_TEST_GROUP(test_ADC);
|
||||||
|
IMPORT_TEST_GROUP(test_RegEdit);
|
||||||
|
|
||||||
//START: main
|
//START: main
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
project(Tests)
|
project(Tests)
|
||||||
|
|
||||||
# TEST_DIRS
|
# TEST_DIRS
|
||||||
|
add_subdirectory(MockRegEdit)
|
||||||
|
add_subdirectory(RegEdit)
|
||||||
add_subdirectory(simple_test)
|
add_subdirectory(simple_test)
|
||||||
|
add_subdirectory(ADC)
|
||||||
|
add_subdirectory(MockADC)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TEST_RUNNER
|
# TEST_RUNNER
|
||||||
add_executable(AllTests
|
add_executable(AllTests
|
||||||
|
|
@ -11,6 +18,19 @@ add_executable(AllTests
|
||||||
target_link_libraries(AllTests
|
target_link_libraries(AllTests
|
||||||
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
# TEST_LINKS
|
# TEST_LINKS
|
||||||
|
test_ADC
|
||||||
|
test_RegEdit
|
||||||
simple_test
|
simple_test
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_executable(Mock_Tests
|
||||||
|
MockTests.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(Mock_Tests
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
|
test_MockRegEdit
|
||||||
|
test_MockADC
|
||||||
|
)
|
||||||
|
|
|
||||||
10
tests/MockADC/CMakeLists.txt
Normal file
10
tests/MockADC/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# TEST_RUNNER
|
||||||
|
add_library(test_MockADC
|
||||||
|
test_MockADC.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(test_MockADC
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
|
MockADC
|
||||||
|
)
|
||||||
94
tests/MockADC/test_MockADC.cpp
Normal file
94
tests/MockADC/test_MockADC.cpp
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
* Author: Jake G
|
||||||
|
* Date: 2024
|
||||||
|
* filename: test_MockADC.c
|
||||||
|
* description:
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
#include "CppUTestExt/MockSupport.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "MockADC.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_GROUP(test_MockADC)
|
||||||
|
{
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
mock().checkExpectations();
|
||||||
|
mock().clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(test_MockADC, ADC_InitExpects)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("ADC_Init")
|
||||||
|
.withUnsignedIntParameter("pin_num", 7);
|
||||||
|
|
||||||
|
ADC_Init(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockADC, ADC_EnableExpects)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("ADC_Enable");
|
||||||
|
|
||||||
|
ADC_Enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_MockADC, ADC_DisableExpect)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("ADC_Disable");
|
||||||
|
|
||||||
|
ADC_Disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockADC, ADC_ReadValue)
|
||||||
|
{
|
||||||
|
MockADC_ZeroIndex();
|
||||||
|
MockADC_PushValue(512);
|
||||||
|
|
||||||
|
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||||
|
.withUnsignedIntParameter("pin_num", 0x2);
|
||||||
|
|
||||||
|
uint16_t val = ADC_ReadValue(0x2);
|
||||||
|
LONGS_EQUAL(512, val);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockADC, ADC_ReadValueReturnsZeroOnEmptyBuffer)
|
||||||
|
{
|
||||||
|
MockADC_ZeroIndex();
|
||||||
|
|
||||||
|
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||||
|
.withUnsignedIntParameter("pin_num", 0x2)
|
||||||
|
.andReturnValue(0x0000);
|
||||||
|
|
||||||
|
uint16_t val = ADC_ReadValue(0x2);
|
||||||
|
LONGS_EQUAL(0, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockADC, MockADC_PushValueDoesntOverflowArray)
|
||||||
|
{
|
||||||
|
MockADC_ZeroIndex();
|
||||||
|
for(int i = 0; i < 257; i++){
|
||||||
|
MockADC_PushValue(512+i);
|
||||||
|
CHECK_TRUE(MockADC_GetIndex() <= 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockADC, MockADC_SetupSetsGlobal)
|
||||||
|
{
|
||||||
|
CHECK_FALSE(MockADC_IsSetup());
|
||||||
|
|
||||||
|
ADC_Setup();
|
||||||
|
|
||||||
|
CHECK_TRUE(MockADC_IsSetup());
|
||||||
|
}
|
||||||
11
tests/MockRegEdit/CMakeLists.txt
Normal file
11
tests/MockRegEdit/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# TEST_RUNNER
|
||||||
|
add_library(test_MockRegEdit
|
||||||
|
test_MockRegEdit.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(test_MockRegEdit
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
|
MockRegEdit
|
||||||
|
)
|
||||||
|
|
||||||
168
tests/MockRegEdit/test_MockRegEdit.cpp
Normal file
168
tests/MockRegEdit/test_MockRegEdit.cpp
Normal file
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: todays_date
|
||||||
|
* filename: test_MockRegEdit.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
#include "CppUTestExt/MockSupport.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "MockRegEdit.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TEST_GROUP(test_MockRegEdit)
|
||||||
|
{
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
mock().clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_ClearRegisterExpectedCallPasses)
|
||||||
|
{
|
||||||
|
uint8_t a;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_ClearRegister")
|
||||||
|
.withPointerParameter("reg", b);
|
||||||
|
|
||||||
|
RegEdit_ClearRegister(b);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_SetRegisterExpectedCallPasses)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint8_t a;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_SetRegister")
|
||||||
|
.withPointerParameter("reg", b);
|
||||||
|
|
||||||
|
RegEdit_SetRegister(b);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_SetBitExpectedCallPasses)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint8_t a;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.withUnsignedIntParameter("bit_num", 5);
|
||||||
|
|
||||||
|
RegEdit_SetBit(b, 5);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_ClearBitExpectedCallPasses)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint8_t a;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_ClearBit")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.withUnsignedIntParameter("bit_num", 5);
|
||||||
|
|
||||||
|
RegEdit_ClearBit(b, 5);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_IsBitSetExpectedCallPasses)
|
||||||
|
{
|
||||||
|
uint8_t a = 0xFF;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_IsBitSet")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.withUnsignedIntParameter("bit_num", 5)
|
||||||
|
.andReturnValue(true);
|
||||||
|
|
||||||
|
CHECK_TRUE(RegEdit_IsBitSet(b, 5));
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_IsBitSetExpectedCallPassesWithFalse)
|
||||||
|
{
|
||||||
|
uint8_t a = 0xFF;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_IsBitSet")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.withUnsignedIntParameter("bit_num", 5)
|
||||||
|
.andReturnValue(false);
|
||||||
|
|
||||||
|
CHECK_FALSE(RegEdit_IsBitSet(b, 5));
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_OR_NumExpectedWorks)
|
||||||
|
{
|
||||||
|
uint8_t a = 0xFF;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_OR_Num")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.withUnsignedIntParameter("num", 0x4)
|
||||||
|
.andReturnValue(false);
|
||||||
|
|
||||||
|
RegEdit_OR_Num(b, 0x4);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_SetNumPasses)
|
||||||
|
{
|
||||||
|
uint32_t a = 0xFFFFFFFF;
|
||||||
|
uint32_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_SetNum")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.withUnsignedIntParameter("num", 0x4)
|
||||||
|
.andReturnValue(false);
|
||||||
|
|
||||||
|
RegEdit_SetNum(b, 0x4);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, RegEdit_ReadRegPasses)
|
||||||
|
{
|
||||||
|
uint8_t a = 0xFF;
|
||||||
|
uint8_t *b = &a;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_ReadReg")
|
||||||
|
.withPointerParameter("reg", b)
|
||||||
|
.andReturnValue(0xFF);
|
||||||
|
|
||||||
|
uint8_t reg_val = RegEdit_ReadReg(b);
|
||||||
|
LONGS_EQUAL(0xFF, reg_val);
|
||||||
|
|
||||||
|
mock().checkExpectations();
|
||||||
|
}
|
||||||
13
tests/MockTests.cpp
Normal file
13
tests/MockTests.cpp
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
|
||||||
|
|
||||||
|
//ImportTestGroups
|
||||||
|
IMPORT_TEST_GROUP(test_MockRegEdit);
|
||||||
|
IMPORT_TEST_GROUP(test_MockADC);
|
||||||
|
|
||||||
|
//START: main
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
return RUN_ALL_TESTS(argc, argv);
|
||||||
|
}
|
||||||
|
//END: main
|
||||||
10
tests/RegEdit/CMakeLists.txt
Normal file
10
tests/RegEdit/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# TEST_RUNNER
|
||||||
|
add_library(test_RegEdit
|
||||||
|
test_RegEdit.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(test_RegEdit
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||||
|
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||||
|
RegEdit
|
||||||
|
)
|
||||||
32
tests/RegEdit/test_RegEdit.cpp
Normal file
32
tests/RegEdit/test_RegEdit.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: todays_date
|
||||||
|
* filename: test_RegEdit.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "RegEdit.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_GROUP(test_RegEdit)
|
||||||
|
{
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(test_RegEdit, FirstTest)
|
||||||
|
{
|
||||||
|
//FAIL("Fail me!");
|
||||||
|
CHECK(true);
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue