LMMP
4.3.0
Lamina High-Precision Arithmetic Library
Toggle main menu visibility
载入中...
搜索中...
未找到
test.h
浏览该文件的文档.
1
/**
2
* Copyright (C) 2026 HJimmyK (Jericho Knox)
3
*
4
* This file is part of LMMP.
5
*
6
* LMMP is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License as
8
* published by the Free Software Foundation; either version 3 of
9
* the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library. If not, see
18
* <https://www.gnu.org/licenses/>.
19
*
20
* SPDX-License-Identifier: LGPL-3.0-or-later
21
*/
22
23
#ifndef LMMP_TEST_H
24
#define LMMP_TEST_H
25
26
#include <stdbool.h>
27
#include <stdio.h>
28
29
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
30
31
void
lmmp_test_check
(
bool
ok,
const
char
*file,
int
line,
const
char
*expr,
const
char
*message);
32
void
lmmp_test_run
(
const
char
*name,
void
(*test)(
void
));
33
int
lmmp_test_finish
(
void
);
34
35
#define TEST_CASE(category, name) static void test_fn_##name(void)
36
#define TEST_RUN(category, name) lmmp_test_run(category "/" #name, test_fn_##name)
37
#define TEST_CHECK(cond) lmmp_test_check((cond), __FILE__, __LINE__, #cond, NULL)
38
#define TEST_CHECK_MSG(cond, msg) lmmp_test_check((cond), __FILE__, __LINE__, #cond, (msg))
39
#define TEST_CHECK_EQ(a, b) lmmp_test_check((a) == (b), __FILE__, __LINE__, #a " == " #b, NULL)
40
41
#endif
lmmp_test_finish
int lmmp_test_finish(void)
定义
test.c:51
lmmp_test_check
void lmmp_test_check(bool ok, const char *file, int line, const char *expr, const char *message)
定义
test.c:30
lmmp_test_run
void lmmp_test_run(const char *name, void(*test)(void))
定义
test.c:41
src
lmmp
support
test.h
生成于
, 为 LMMP使用
1.18.0