nomali_test_helpers.h (10915:71ace17ccb3d) nomali_test_helpers.h (11313:89fd4a775287)
1/*
1/*
2 * Copyright (c) 2014-2015 ARM Limited
2 * Copyright (c) 2014-2016 ARM Limited
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *

--- 9 unchanged lines hidden (view full) ---

20#ifndef _TESTS_NOMALI_TEST_HELPERS_H
21#define _TESTS_NOMALI_TEST_HELPERS_H
22
23#include <libnomali/nomali.h>
24#include "test_helpers.h"
25
26#define E_NOMALI_BAIL(c) \
27 do { \
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *

--- 9 unchanged lines hidden (view full) ---

20#ifndef _TESTS_NOMALI_TEST_HELPERS_H
21#define _TESTS_NOMALI_TEST_HELPERS_H
22
23#include <libnomali/nomali.h>
24#include "test_helpers.h"
25
26#define E_NOMALI_BAIL(c) \
27 do { \
28 nomali_error_t error; \
28 if ((error = (c)) != NOMALI_E_OK) { \
29 test_bail(# c " failed: %s (%i)", \
30 nomali_errstr(error), error); \
31 } \
32 } while (0)
33
34#define E_NOMALI_TEST(t, c) \
35 do { \
36 if ((error = (c)) != NOMALI_E_OK) { \
37 test_diag(# c " failed: %s (%i)", \
38 nomali_errstr(error), error); \
39 test_fail(t); \
40 } else { \
41 test_ok(t); \
42 } \
43 } while (0)
44
29 if ((error = (c)) != NOMALI_E_OK) { \
30 test_bail(# c " failed: %s (%i)", \
31 nomali_errstr(error), error); \
32 } \
33 } while (0)
34
35#define E_NOMALI_TEST(t, c) \
36 do { \
37 if ((error = (c)) != NOMALI_E_OK) { \
38 test_diag(# c " failed: %s (%i)", \
39 nomali_errstr(error), error); \
40 test_fail(t); \
41 } else { \
42 test_ok(t); \
43 } \
44 } while (0)
45
46#define NOMALI_TEST_REG(t, handle, reg, test) \
47 do { \
48 uint32_t value; \
49 E_NOMALI_BAIL( \
50 nomali_reg_read(handle, &value, (reg))); \
51 if (!(test)) { \
52 test_fail(t); \
53 } else { \
54 test_ok(t); \
55 } \
56 } while (0)
45
57
58
59
46#endif /* _TESTS_NOMALI_TEST_HELPERS_H */
60#endif /* _TESTS_NOMALI_TEST_HELPERS_H */