Software APIs
dif_test_base.h
Go to the documentation of this file.
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_TEST_BASE_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_TEST_BASE_H_
7 
8 /**
9  * @file
10  * @brief Shared helpers for DIF unit tests.
11  */
12 
13 #include <stdbool.h>
14 
15 #include "gtest/gtest.h"
17 
18 /**
19  * Creates a test expectation for `expr_` to evaluate to `kDifOk`.
20  */
21 #define EXPECT_DIF_OK(expr_) EXPECT_EQ(expr_, kDifOk)
22 
23 /**
24  * Creates a test assertion for `expr_` to evaluate to `kDifOk`.
25  */
26 #define ASSERT_DIF_OK(expr_) ASSERT_EQ(expr_, kDifOk)
27 
28 /**
29  * Creates a test expectation for `expr_` to evaluate to `kDifBadArg`.
30  */
31 #define EXPECT_DIF_BADARG(expr_) EXPECT_EQ(expr_, kDifBadArg)
32 
33 /**
34  * Creates a test assertion for `expr_` to evaluate to `kDifBadArg`.
35  */
36 #define ASSERT_DIF_BADARG(expr_) ASSERT_EQ(expr_, kDifBadArg)
37 
38 /**
39  * Creates a test expectataion for `expr` to evaluate to `kDifLocked`.
40  */
41 #define EXPECT_DIF_LOCKED(expr_) EXPECT_EQ(expr_, kDifLocked)
42 
43 /**
44  * Creates a test expectataion for `expr` to evaluate to `kDifOutOfRange`.
45  */
46 #define EXPECT_DIF_OUTOFRANGE(expr_) EXPECT_EQ(expr_, kDifOutOfRange)
47 
48 #endif // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_TEST_BASE_H_