[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot] tests/analysis: add missing files
From: Stefan Gerlach <null () kde ! org>
Date: 2018-09-15 11:33:38
Message-ID: E1g18pW-0005Kt-7V () code ! kde ! org
[Download RAW message or body]
Git commit 51c269618f3522afecba0c405dd316f956411fe3 by Stefan Gerlach.
Committed on 15/09/2018 at 11:33.
Pushed by sgerlach into branch 'master'.
add missing files
A +37 -0 tests/analysis/AnalysisTest.cpp [License: GPL (v2+)]
A +54 -0 tests/analysis/AnalysisTest.h [License: GPL (v2+)]
https://commits.kde.org/labplot/51c269618f3522afecba0c405dd316f956411fe3
diff --git a/tests/analysis/AnalysisTest.cpp b/tests/analysis/AnalysisTest.cpp
new file mode 100644
index 00000000..84e099a2
--- /dev/null
+++ b/tests/analysis/AnalysisTest.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ File : AnalysisTest.cpp
+ Project : LabPlot
+ Description : Tests any analysis method
+ --------------------------------------------------------------------
+ Copyright : (C) 2018 Stefan Gerlach (stefan.gerlach@uni.kn)
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ ***************************************************************************/
+
+#include "AnalysisTest.h"
+#include "backend/core/column/Column.h"
+
+void AnalysisTest::initTestCase() {
+ // needed in order to have the signals triggered by SignallingUndoCommand, see \
LabPlot.cpp + //TODO: redesign/remove this
+ qRegisterMetaType<const AbstractAspect*>("const AbstractAspect*");
+ qRegisterMetaType<const AbstractColumn*>("const AbstractColumn*");
+}
+
diff --git a/tests/analysis/AnalysisTest.h b/tests/analysis/AnalysisTest.h
new file mode 100644
index 00000000..ae60c42c
--- /dev/null
+++ b/tests/analysis/AnalysisTest.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ File : AnalysisTest.h
+ Project : LabPlot
+ Description : Tests any analysis method
+ --------------------------------------------------------------------
+ Copyright : (C) 2018 Stefan Gerlach (stefan.gerlach@uni.kn)
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ ***************************************************************************/
+#ifndef ANALYSISTEST_H
+#define ANALYSISTEST_H
+
+#include <QtTest>
+#include <backend/lib/macros.h> // DEBUG()
+
+extern "C" {
+#include <gsl/gsl_math.h>
+}
+
+class AnalysisTest : public QObject {
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+protected:
+ // compare floats with given delta (could be useful for other tests too)
+ // delta - relative error
+ static inline void FuzzyCompare(double actual, double expected, double delta = \
1.e-12) { + if (fabs(expected) < delta)
+ QVERIFY(fabs(actual) < delta);
+ else {
+ DEBUG(std::setprecision(15) << actual - fabs(actual)*delta << " <= " << expected \
<< " <= " << actual + fabs(actual)*delta); + QVERIFY(!gsl_fcmp(actual, expected, \
delta)); + }
+ }
+};
+#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic