|
1 | 1 | /*** |
2 | 2 | * MIT License |
3 | 3 | * |
4 | | - * Copyright (c) 2021 Konychev Valera |
| 4 | + * Copyright (c) 2021-2026 Konychev Valera |
5 | 5 | * |
6 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | 7 | * of this software and associated documentation files (the "Software"), to deal |
|
31 | 31 | #ifndef __cplusplus |
32 | 32 | #include <stdlib.h> |
33 | 33 |
|
34 | | - #define EXPECT_FUNC_EQ(func, res) \ |
35 | | - if ((func) != (res)) { \ |
| 34 | + #define EXPECT_FUNC_EQ(func, result) \ |
| 35 | + if ((func) != (result)) { \ |
36 | 36 | VT_ERROR(STRINGIZE(func) " fail"); \ |
37 | 37 | exit(EXIT_FAILURE); \ |
38 | 38 | } |
39 | 39 |
|
40 | | - #define EXPECT_VAL_EQ(val, res, format) \ |
41 | | - if ((val) != (res)) { \ |
42 | | - VT_ERROR("expect: " format " result: " format, (val), (res));\ |
43 | | - exit(EXIT_FAILURE); \ |
| 40 | + #define EXPECT_VAL_EQ(expect, result, format) \ |
| 41 | + if ((expect) != (result)) { \ |
| 42 | + VT_ERROR("expect: " format " result: " format, (expect), (result));\ |
| 43 | + exit(EXIT_FAILURE); \ |
44 | 44 | } |
45 | 45 |
|
46 | | - #define EXPECT_VAL_NOT_EQ(val, res, format) \ |
47 | | - if ((val) == (res)) { \ |
48 | | - VT_ERROR(format); \ |
49 | | - exit(EXIT_FAILURE); \ |
| 46 | + #define EXPECT_VAL_NOT_EQ(expect, result, format) \ |
| 47 | + if ((expect) == (result)) { \ |
| 48 | + VT_ERROR(format); \ |
| 49 | + exit(EXIT_FAILURE); \ |
50 | 50 | } |
51 | 51 |
|
52 | | - #define EXPECT_BYTE_EQ(val, res) EXPECT_VAL_EQ(val, res, "%.2x") |
53 | | - #define EXPECT_INT_EQ(val, res) EXPECT_VAL_EQ(val, res, "%d") |
54 | | - #define EXPECT_SIZET_EQ(val, res) EXPECT_VAL_EQ(val, res, "%zu") |
55 | | - #define EXPECT_BOOL_EQ(val, res) EXPECT_VAL_EQ(val, res, "%d") |
56 | | - #define EXPECT_POINTER_EQ(val, res) EXPECT_VAL_EQ(val, res, "%p") |
| 52 | + #define EXPECT_BYTE_EQ(expect, result) EXPECT_VAL_EQ(expect, result, "%.2x") |
| 53 | + #define EXPECT_INT_EQ(expect, result) EXPECT_VAL_EQ(expect, result, "%d") |
| 54 | + #define EXPECT_SIZET_EQ(expect, result) EXPECT_VAL_EQ(expect, result, "%zu") |
| 55 | + #define EXPECT_BOOL_EQ(expect, result) EXPECT_VAL_EQ(expect, result, "%d") |
| 56 | + #define EXPECT_POINTER_EQ(expect, result) EXPECT_VAL_EQ(expect, result, "%p") |
57 | 57 |
|
58 | 58 | #define EXPECT_STR_EQ(str0, str1) \ |
59 | 59 | if (strcmp(str0, str1)) { \ |
|
0 commit comments