unity同步到当前最新版本

This commit is contained in:
建峰 2025-04-22 15:15:47 +08:00
parent 232f288e8a
commit e53ef3f1a6
12 changed files with 27 additions and 14 deletions

View File

@ -1,12 +1,12 @@
# 问题和解决方案
# 问题和解决方案
## 1. 添加配置文件
在unity_internals.h文件中添加了宏定义方便使用unity_config.h文件。
## 1. 添加配置文件
在unity_internals.h文件中添加了宏定义方便使用unity_config.h文件。
```c
#define UNITY_INCLUDE_CONFIG_H
```
## 2. 多文件打印测试文件路径不合理的问题
修改`RUN_TEST`宏,在测试文件路径前添加`__FILE__`。
借助`UnitySetTestFile`函数,打印的路径信息对多文件测试也有效。
## 2. 多文件打印测试文件路径不合理的问题
修改`RUN_TEST`宏,在测试文件路径前添加`__FILE__`。
借助`UnitySetTestFile`函数,打印的路径信息对多文件测试也有效。

View File

@ -1,7 +1,7 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */

View File

@ -1,7 +1,7 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
@ -11,7 +11,7 @@
#define UNITY_VERSION_MAJOR 2
#define UNITY_VERSION_MINOR 6
#define UNITY_VERSION_BUILD 0
#define UNITY_VERSION_BUILD 1
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
#ifdef __cplusplus

View File

@ -1,15 +1,13 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_INTERNALS_H
#define UNITY_INTERNALS_H
#define UNITY_INCLUDE_CONFIG_H
#ifdef UNITY_INCLUDE_CONFIG_H
#include "unity_config.h"
#endif
@ -817,7 +815,7 @@ extern const char UnityStrErrShorthand[];
#ifndef RUN_TEST
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
#define RUN_TEST(...) RUN_TEST_AT_LINE(__VA_ARGS__, __LINE__, throwaway)
#define RUN_TEST_AT_LINE(func, line, ...) UnitySetTestFile(__FILE__);UnityDefaultTestRun(func, #func, line)
#define RUN_TEST_AT_LINE(func, line, ...) UnityDefaultTestRun(func, #func, line)
#endif
#endif

View File

@ -15,6 +15,7 @@
#include <stdbool.h>
#include <stdio.h>
#define UNITY_INCLUDE_CONFIG_H
#include "unicstl.h"
#include "unity.h"

View File

@ -269,6 +269,8 @@ static void test_deque_struct(void)
void test_deque(void)
{
UnitySetTestFile(__FILE__);
RUN_TEST(test_deque_num);
RUN_TEST(test_deque_struct);
}

View File

@ -59,7 +59,9 @@ void test_graph_from_matrix(void)
void test_graph(void)
{
// RUN_TEST(test_graph_new);
UnitySetTestFile(__FILE__);
RUN_TEST(test_graph_new);
// RUN_TEST(test_graph_print);
// RUN_TEST(test_graph_from_matrix);
}

View File

@ -135,6 +135,8 @@ static void test_heap_struct(void)
void test_heap(void)
{
UnitySetTestFile(__FILE__);
RUN_TEST(test_heap_num);
RUN_TEST(test_heap_struct);
}

View File

@ -356,6 +356,8 @@ static void test_list_iter(void)
void test_list(void)
{
UnitySetTestFile(__FILE__);
RUN_TEST(test_list_init2);
RUN_TEST(test_list_new);
RUN_TEST(test_list_append);

View File

@ -625,6 +625,8 @@ static void test_queue2_struct(void)
void test_queue(void)
{
UnitySetTestFile(__FILE__);
RUN_TEST(test_queue_init);
RUN_TEST(test_queue_new);
RUN_TEST(test_queue_push);

View File

@ -493,6 +493,8 @@ static void test_stack2_struct(void)
void test_stack(void)
{
UnitySetTestFile(__FILE__);
RUN_TEST(test_stack_init);
RUN_TEST(test_stack_new);
RUN_TEST(test_stack_push);

View File

@ -916,6 +916,8 @@ static void test_rbtree_delete(void)
void test_tree(void)
{
UnitySetTestFile(__FILE__);
RUN_TEST(test_avltree_iter);
RUN_TEST(test_avltree_insert);
RUN_TEST(test_avltree_delete);