Blame tests/oscap_assert.h

Packit Service 569379
/*
Packit Service 569379
 * Copyright 2018 Red Hat Inc., Durham, North Carolina.
Packit Service 569379
 * All Rights Reserved.
Packit Service 569379
 *
Packit Service 569379
 * This library is free software; you can redistribute it and/or
Packit Service 569379
 * modify it under the terms of the GNU Lesser General Public
Packit Service 569379
 * License as published by the Free Software Foundation; either
Packit Service 569379
 * version 2.1 of the License, or (at your option) any later version.
Packit Service 569379
 *
Packit Service 569379
 * This library is distributed in the hope that it will be useful,
Packit Service 569379
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 569379
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 569379
 * Lesser General Public License for more details.
Packit Service 569379
 *
Packit Service 569379
 * You should have received a copy of the GNU Lesser General Public
Packit Service 569379
 * License along with this library; if not, write to the Free Software
Packit Service 569379
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Packit Service 569379
 *
Packit Service 569379
 * Authors:
Packit Service 569379
 *      Jan Černý <jcerny@redhat.com>
Packit Service 569379
 */
Packit Service 569379
Packit Service 569379
Packit Service 569379
#ifndef OSCAP_ASSERT_H
Packit Service 569379
#define OSCAP_ASSERT_H
Packit Service 569379
Packit Service 569379
/* Assert macro for OpenSCAP tests in C */
Packit Service 569379
/* Unlike standard assert() macro this works even if NDEBUG is defined. */
Packit Service 569379
#define oscap_assert(expr) \
Packit Service 569379
	if (!(expr)) { \
Packit Service 569379
		fprintf(stderr, "Assertion failed: %s, file %s, line %d, function %s.", #expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
Packit Service 569379
		abort(); \
Packit Service 569379
	}
Packit Service 569379
Packit Service 569379
#endif /* OSCAP_ASSERT_H */