xref: /third_party/unity/extras/bdd/src/unity_bdd.h (revision 35375f98)
1/* Copyright (c) 2023 Michael Gene Brockus (Dreamer) and Contributed to Unity Project
2 * ==========================================
3 *  Unity Project - A Test Framework for C
4 *  Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5 *  [Released under MIT License. Please refer to license.txt for details]
6 * ========================================== */
7
8#ifndef UNITY_BDD_TEST_H_
9#define UNITY_BDD_TEST_H_
10
11#ifdef __cplusplus
12extern "C"
13{
14#endif
15
16#include <stdio.h>
17
18/**
19 * @brief Macros for defining a Behavior-Driven Development (BDD) structure with descriptions.
20 *
21 * These macros provide a way to structure and describe different phases (Given, When, Then) of a
22 * test scenario in a BDD-style format. However, they don't have functional behavior by themselves
23 * and are used for descriptive purposes.
24 */
25#define GIVEN(description) \
26    if (0) { \
27        printf("Given %s\n", description); \
28    } else
29
30#define WHEN(description) \
31    if (0) { \
32        printf("When %s\n", description); \
33    } else
34
35#define THEN(description) \
36    if (0) { \
37        printf("Then %s\n", description); \
38    } else
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif
45