Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-macro-utils-c/tests/test_helper.h

raw
1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4 #ifndef TEST_HELPER_H
5 #define TEST_HELPER_H
6
7 #include <stdio.h>
8
9 /*macro_utils cannot have any dependency on a more evolved testing framework....*/
10
11 #define TEST_HELPER_TO_STRING_(x) #x
12 #define TEST_HELPER_TO_STRING(x) TEST_HELPER_TO_STRING_(x)
13
14 /*a macro that returns a non-zero value from a function when a condition is false*/
15 #define POOR_MANS_ASSERT(condition) \
16 do \
17 { \
18 if (!(condition)) \
19 { \
20 printf("condition \"" #condition "\" in " __FILE__ ":" TEST_HELPER_TO_STRING(__LINE__) " was UNEXPECTEDLY FALSE\n"); \
21 return __LINE__; \
22 } \
23 } while (0)
24
25 #endif /*TEST_HELPER_H*/