mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-26 12:50:30 +00:00
unity: separate common and IDF specific functionality
New unity component can be used for testing other applications. Upstream version of Unity is included as a submodule. Utilities specific to ESP-IDF unit tests (partitions, leak checking setup/teardown functions, etc) are kept only in unit-test-app. Kconfig options are added to allow disabling certain Unity features.
This commit is contained in:
61
components/unity/include/unity_config.h
Normal file
61
components/unity/include/unity_config.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef UNITY_CONFIG_H
|
||||
#define UNITY_CONFIG_H
|
||||
|
||||
// This file gets included from unity.h via unity_internals.h
|
||||
// It is inside #ifdef __cplusplus / extern "C" block, so we can
|
||||
// only use C features here
|
||||
|
||||
#include <esp_err.h>
|
||||
#include <stddef.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_UNITY_ENABLE_FLOAT
|
||||
#define UNITY_INCLUDE_FLOAT
|
||||
#else
|
||||
#define UNITY_EXCLUDE_FLOAT
|
||||
#endif //CONFIG_UNITY_ENABLE_FLOAT
|
||||
|
||||
#ifdef CONFIG_UNITY_ENABLE_DOUBLE
|
||||
#define UNITY_INCLUDE_DOUBLE
|
||||
#else
|
||||
#define UNITY_EXCLUDE_DOUBLE
|
||||
#endif //CONFIG_UNITY_ENABLE_DOUBLE
|
||||
|
||||
#ifdef CONFIG_UNITY_ENABLE_COLOR
|
||||
#define UNITY_OUTPUT_COLOR
|
||||
#endif
|
||||
|
||||
#define UNITY_EXCLUDE_TIME_H
|
||||
|
||||
void unity_flush(void);
|
||||
void unity_putc(int c);
|
||||
void unity_gets(char* dst, size_t len);
|
||||
void unity_exec_time_start(void);
|
||||
void unity_exec_time_stop(void);
|
||||
uint32_t unity_exec_time_get_ms(void);
|
||||
|
||||
#define UNITY_OUTPUT_CHAR(a) unity_putc(a)
|
||||
#define UNITY_OUTPUT_FLUSH() unity_flush()
|
||||
#define UNITY_EXEC_TIME_START() unity_exec_time_start()
|
||||
#define UNITY_EXEC_TIME_STOP() unity_exec_time_stop()
|
||||
#define UNITY_EXEC_TIME_MS() unity_exec_time_get_ms()
|
||||
|
||||
#ifdef CONFIG_UNITY_ENABLE_TEST_RUNNER
|
||||
|
||||
#include "unity_test_case.h"
|
||||
|
||||
void unity_run_menu() __attribute__((noreturn));
|
||||
|
||||
void unity_run_tests_with_filter(const char* filter);
|
||||
|
||||
void unity_run_all_tests();
|
||||
|
||||
void unity_run_single_test_by_name(const char* name);
|
||||
|
||||
#endif //CONFIG_UNITY_ENABLE_TEST_RUNNER
|
||||
|
||||
// shorthand to check esp_err_t return code
|
||||
#define TEST_ESP_OK(rc) TEST_ASSERT_EQUAL_HEX32(ESP_OK, rc)
|
||||
#define TEST_ESP_ERR(err, rc) TEST_ASSERT_EQUAL_HEX32(err, rc)
|
||||
|
||||
#endif //UNITY_CONFIG_H
|
||||
Reference in New Issue
Block a user