File indexing completed on 2025-01-12 04:18:15
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2015 Jarosław Staniek <staniek@kde.org> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #include "KReportTestUtils.h" 0019 0020 namespace QTest 0021 { 0022 KREPORTTESTUTILS_EXPORT bool qCompare(qreal val1, qreal val2, qreal epsilon, const char *actual, 0023 const char *expected, const char *file, int line) 0024 { 0025 return (qAbs( val1 - val2 ) < epsilon) 0026 ? compare_helper(true, "COMPARE()", toString(val1), toString(val2), actual, 0027 expected, file, line) 0028 : compare_helper(false, "Compared qreals are not the same", toString(val1), 0029 toString(val2), actual, expected, file, line); 0030 } 0031 0032 KREPORTTESTUTILS_EXPORT bool qCompare(const QString &val1, const char* val2, const char *actual, 0033 const char *expected, const char *file, int line) 0034 { 0035 return QTest::qCompare(val1, QLatin1String(val2), actual, expected, file, line); 0036 } 0037 0038 }