|
|
4c75f9e |
/****************************************************************************
|
|
|
4c75f9e |
**
|
|
|
4c75f9e |
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
|
4c75f9e |
** Contact: http://www.qt-project.org/legal
|
|
|
4c75f9e |
**
|
|
|
4c75f9e |
** This file is part of Qt Creator.
|
|
|
4c75f9e |
**
|
|
|
4c75f9e |
** Commercial License Usage
|
|
|
4c75f9e |
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
4c75f9e |
** accordance with the commercial license agreement provided with the
|
|
|
4c75f9e |
** Software or, alternatively, in accordance with the terms contained in
|
|
|
4c75f9e |
** a written agreement between you and Digia. For licensing terms and
|
|
|
4c75f9e |
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
4c75f9e |
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
4c75f9e |
**
|
|
|
4c75f9e |
** GNU Lesser General Public License Usage
|
|
|
4c75f9e |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
4c75f9e |
** General Public License version 2.1 as published by the Free Software
|
|
|
4c75f9e |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
4c75f9e |
** packaging of this file. Please review the following information to
|
|
|
4c75f9e |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
4c75f9e |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
4c75f9e |
**
|
|
|
4c75f9e |
** In addition, as a special exception, Digia gives you certain additional
|
|
|
4c75f9e |
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
4c75f9e |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
4c75f9e |
**
|
|
|
4c75f9e |
****************************************************************************/
|
|
|
4c75f9e |
|
|
|
4c75f9e |
#ifndef QTC_ASSERT_H
|
|
|
4c75f9e |
#define QTC_ASSERT_H
|
|
|
4c75f9e |
|
|
|
4c75f9e |
#include "utils_global.h"
|
|
|
4c75f9e |
|
|
|
4c75f9e |
namespace Utils { QTCREATOR_UTILS_EXPORT void writeAssertLocation(const char *msg); }
|
|
|
4c75f9e |
|
|
|
4c75f9e |
#define QTC_ASSERT_STRINGIFY_HELPER(x) #x
|
|
|
4c75f9e |
#define QTC_ASSERT_STRINGIFY(x) QTC_ASSERT_STRINGIFY_HELPER(x)
|
|
|
4c75f9e |
#define QTC_ASSERT_STRING(cond) ::Utils::writeAssertLocation(\
|
|
|
4c75f9e |
"\"" cond"\" in file " __FILE__ ", line " QTC_ASSERT_STRINGIFY(__LINE__))
|
|
|
4c75f9e |
|
|
|
4c75f9e |
// The 'do {...} while (0)' idiom is not used for the main block here to be
|
|
|
4c75f9e |
// able to use 'break' and 'continue' as 'actions'.
|
|
|
4c75f9e |
|
|
|
4c75f9e |
#define QTC_ASSERT(cond, action) if (cond) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)
|
|
|
4c75f9e |
#define QTC_CHECK(cond) if (cond) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0)
|
|
|
4c75f9e |
|
|
|
4c75f9e |
#endif // QTC_ASSERT_H
|
|
|
4c75f9e |
|