nomali_test_helpers.h revision 10915:71ace17ccb3d
1/* 2 * Copyright (c) 2014-2015 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 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 * Authors: Andreas Sandberg 18 */ 19 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 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 45 46#endif /* _TESTS_NOMALI_TEST_HELPERS_H */ 47