-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and in the process restructure the C++ tests
- Loading branch information
1 parent
3b1e520
commit b69e480
Showing
10 changed files
with
240 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
CONFIG += testcase | ||
QT += network | ||
QT += testlib | ||
QT += widgets | ||
QT -= gui | ||
|
||
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now") | ||
isEmpty(QT_BASE_DIR) { | ||
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined") | ||
} | ||
|
||
CAMCOPS_SRC = $$PWD/../../../.. | ||
|
||
MOC_DIR = moc | ||
OBJECTS_DIR = obj | ||
TARGET = bin/test_convert | ||
|
||
SOURCES += \ | ||
testconvert.cpp \ | ||
$$CAMCOPS_SRC/common/dpi.cpp \ | ||
$$CAMCOPS_SRC/common/textconst.cpp \ | ||
$$CAMCOPS_SRC/common/uiconst.cpp \ | ||
$$CAMCOPS_SRC/lib/convert.cpp \ | ||
$$CAMCOPS_SRC/lib/datetime.cpp \ | ||
$$CAMCOPS_SRC/lib/errorfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/stringfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/version.cpp \ | ||
$$CAMCOPS_SRC/maths/ccrandom.cpp \ | ||
$$CAMCOPS_SRC/maths/mathfunc.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.cpp | ||
|
||
HEADERS += \ | ||
$$CAMCOPS_SRC/common/dpi.h \ | ||
$$CAMCOPS_SRC/common/textconst.h \ | ||
$$CAMCOPS_SRC/common/uiconst.h \ | ||
$$CAMCOPS_SRC/lib/convert.h \ | ||
$$CAMCOPS_SRC/lib/datetime.h \ | ||
$$CAMCOPS_SRC/lib/errorfunc.h \ | ||
$$CAMCOPS_SRC/lib/stringfunc.h \ | ||
$$CAMCOPS_SRC/lib/version.h \ | ||
$$CAMCOPS_SRC/maths/ccrandom.h \ | ||
$$CAMCOPS_SRC/maths/mathfunc.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.h \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.h | ||
|
||
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" | ||
INCLUDEPATH += $$CAMCOPS_SRC | ||
|
||
DEFINES += SRCDIR=\\\"$$PWD/\\\" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
CONFIG += testcase | ||
QT += network | ||
QT += testlib | ||
QT += widgets | ||
QT -= gui | ||
|
||
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now") | ||
isEmpty(QT_BASE_DIR) { | ||
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined") | ||
} | ||
|
||
CAMCOPS_SRC = $$PWD/../../../.. | ||
|
||
MOC_DIR = moc | ||
OBJECTS_DIR = obj | ||
TARGET = bin/test_filefunc | ||
|
||
SOURCES += \ | ||
testfilefunc.cpp \ | ||
$$CAMCOPS_SRC/common/dpi.cpp \ | ||
$$CAMCOPS_SRC/common/textconst.cpp \ | ||
$$CAMCOPS_SRC/common/uiconst.cpp \ | ||
$$CAMCOPS_SRC/lib/convert.cpp \ | ||
$$CAMCOPS_SRC/lib/datetime.cpp \ | ||
$$CAMCOPS_SRC/lib/errorfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/filefunc.cpp \ | ||
$$CAMCOPS_SRC/lib/stringfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/version.cpp \ | ||
$$CAMCOPS_SRC/maths/ccrandom.cpp \ | ||
$$CAMCOPS_SRC/maths/mathfunc.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.cpp | ||
|
||
HEADERS += \ | ||
$$CAMCOPS_SRC/common/dpi.h \ | ||
$$CAMCOPS_SRC/common/textconst.h \ | ||
$$CAMCOPS_SRC/common/uiconst.h \ | ||
$$CAMCOPS_SRC/lib/convert.h \ | ||
$$CAMCOPS_SRC/lib/datetime.h \ | ||
$$CAMCOPS_SRC/lib/errorfunc.h \ | ||
$$CAMCOPS_SRC/lib/filefunc.h \ | ||
$$CAMCOPS_SRC/lib/stringfunc.h \ | ||
$$CAMCOPS_SRC/lib/version.h \ | ||
$$CAMCOPS_SRC/maths/ccrandom.h \ | ||
$$CAMCOPS_SRC/maths/mathfunc.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.h \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.h | ||
|
||
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" | ||
INCLUDEPATH += $$CAMCOPS_SRC | ||
|
||
DEFINES += SRCDIR=\\\"$$PWD/\\\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Copyright (C) 2012, University of Cambridge, Department of Psychiatry. | ||
Created by Rudolf Cardinal (rnc1001@cam.ac.uk). | ||
This file is part of CamCOPS. | ||
CamCOPS 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 3 of the License, or | ||
(at your option) any later version. | ||
CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "lib/filefunc.h" | ||
|
||
|
||
class TestFileFunc: public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
private slots: | ||
void testTextFileContentsReturnsContentsOfFile(); | ||
}; | ||
|
||
|
||
using namespace filefunc; | ||
|
||
void TestFileFunc::testTextFileContentsReturnsContentsOfFile() | ||
{ | ||
// https://www.cl.cam.ac.uk/~mgk25/ucs/examples/quickbrown.txt | ||
const char *text = "" | ||
"Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen " | ||
"Wolther spillede på xylofon." | ||
"Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο." | ||
"В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!"; | ||
|
||
auto file = QTemporaryFile(); | ||
file.open(); | ||
file.write(text); | ||
file.close(); | ||
QCOMPARE(textfileContents(file.fileName()), QString(text)); | ||
} | ||
|
||
QTEST_MAIN(TestFileFunc) | ||
|
||
#include "testfilefunc.moc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,4 @@ | ||
CONFIG += testcase | ||
QT += network | ||
QT += testlib | ||
QT += widgets | ||
QT -= gui | ||
TEMPLATE = subdirs | ||
|
||
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now") | ||
isEmpty(QT_BASE_DIR) { | ||
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined") | ||
} | ||
|
||
CAMCOPS_SRC = $$PWD/../../.. | ||
|
||
MOC_DIR = moc | ||
OBJECTS_DIR = obj | ||
TARGET = bin/test_lib | ||
|
||
SOURCES += \ | ||
testconvert.cpp \ | ||
$$CAMCOPS_SRC/common/dpi.cpp \ | ||
$$CAMCOPS_SRC/common/textconst.cpp \ | ||
$$CAMCOPS_SRC/common/uiconst.cpp \ | ||
$$CAMCOPS_SRC/lib/convert.cpp \ | ||
$$CAMCOPS_SRC/lib/datetime.cpp \ | ||
$$CAMCOPS_SRC/lib/errorfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/stringfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/version.cpp \ | ||
$$CAMCOPS_SRC/maths/ccrandom.cpp \ | ||
$$CAMCOPS_SRC/maths/mathfunc.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.cpp | ||
|
||
HEADERS += \ | ||
$$CAMCOPS_SRC/common/dpi.h \ | ||
$$CAMCOPS_SRC/common/textconst.h \ | ||
$$CAMCOPS_SRC/common/uiconst.h \ | ||
$$CAMCOPS_SRC/lib/convert.h \ | ||
$$CAMCOPS_SRC/lib/datetime.h \ | ||
$$CAMCOPS_SRC/lib/errorfunc.h \ | ||
$$CAMCOPS_SRC/lib/stringfunc.h \ | ||
$$CAMCOPS_SRC/lib/version.h \ | ||
$$CAMCOPS_SRC/maths/ccrandom.h \ | ||
$$CAMCOPS_SRC/maths/mathfunc.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.h \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.h | ||
|
||
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" | ||
INCLUDEPATH += $$CAMCOPS_SRC | ||
|
||
DEFINES += SRCDIR=\\\"$$PWD/\\\" | ||
SUBDIRS += convert | ||
SUBDIRS += filefunc |
60 changes: 60 additions & 0 deletions
60
tablet_qt/tests/auto/questionnairelib/namevalueoptions/namevalueoptions.pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
CONFIG += testcase | ||
QT += testlib | ||
QT += network | ||
QT += widgets | ||
QT -= gui | ||
|
||
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now") | ||
isEmpty(QT_BASE_DIR) { | ||
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined") | ||
} | ||
|
||
CAMCOPS_SRC = $$PWD/../../../.. | ||
|
||
MOC_DIR = moc | ||
OBJECTS_DIR = obj | ||
TARGET = bin/test_namevalueoptions | ||
|
||
SOURCES += \ | ||
testnamevalueoptions.cpp \ | ||
$$CAMCOPS_SRC/common/dpi.cpp \ | ||
$$CAMCOPS_SRC/common/textconst.cpp \ | ||
$$CAMCOPS_SRC/common/uiconst.cpp \ | ||
$$CAMCOPS_SRC/lib/convert.cpp \ | ||
$$CAMCOPS_SRC/lib/datetime.cpp \ | ||
$$CAMCOPS_SRC/lib/errorfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/stringfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/version.cpp \ | ||
$$CAMCOPS_SRC/maths/ccrandom.cpp \ | ||
$$CAMCOPS_SRC/maths/mathfunc.cpp \ | ||
$$CAMCOPS_SRC/questionnairelib/namevalueoptions.cpp \ | ||
$$CAMCOPS_SRC/questionnairelib/namevaluepair.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.cpp | ||
|
||
HEADERS += \ | ||
$$CAMCOPS_SRC/common/dpi.h \ | ||
$$CAMCOPS_SRC/common/textconst.h \ | ||
$$CAMCOPS_SRC/common/uiconst.h \ | ||
$$CAMCOPS_SRC/lib/convert.h \ | ||
$$CAMCOPS_SRC/lib/datetime.h \ | ||
$$CAMCOPS_SRC/lib/errorfunc.h \ | ||
$$CAMCOPS_SRC/lib/stringfunc.h \ | ||
$$CAMCOPS_SRC/lib/version.h \ | ||
$$CAMCOPS_SRC/maths/ccrandom.h \ | ||
$$CAMCOPS_SRC/maths/mathfunc.h \ | ||
$$CAMCOPS_SRC/questionnairelib/namevalueoptions.h \ | ||
$$CAMCOPS_SRC/questionnairelib/namevaluepair.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.h \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.h | ||
|
||
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" | ||
INCLUDEPATH += $$CAMCOPS_SRC | ||
|
||
DEFINES += SRCDIR=\\\"$$PWD/\\\" |
File renamed without changes.
61 changes: 2 additions & 59 deletions
61
tablet_qt/tests/auto/questionnairelib/questionnairelib.pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,3 @@ | ||
CONFIG += testcase | ||
QT += testlib | ||
QT += network | ||
QT += widgets | ||
QT -= gui | ||
TEMPLATE = subdirs | ||
|
||
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now") | ||
isEmpty(QT_BASE_DIR) { | ||
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined") | ||
} | ||
|
||
CAMCOPS_SRC = $$PWD/../../.. | ||
|
||
MOC_DIR = moc | ||
OBJECTS_DIR = obj | ||
TARGET = bin/test_questionnairelib | ||
|
||
SOURCES += \ | ||
testnamevalueoptions.cpp \ | ||
$$CAMCOPS_SRC/common/dpi.cpp \ | ||
$$CAMCOPS_SRC/common/textconst.cpp \ | ||
$$CAMCOPS_SRC/common/uiconst.cpp \ | ||
$$CAMCOPS_SRC/lib/convert.cpp \ | ||
$$CAMCOPS_SRC/lib/datetime.cpp \ | ||
$$CAMCOPS_SRC/lib/errorfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/stringfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/version.cpp \ | ||
$$CAMCOPS_SRC/maths/ccrandom.cpp \ | ||
$$CAMCOPS_SRC/maths/mathfunc.cpp \ | ||
$$CAMCOPS_SRC/questionnairelib/namevalueoptions.cpp \ | ||
$$CAMCOPS_SRC/questionnairelib/namevaluepair.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.cpp | ||
|
||
HEADERS += \ | ||
$$CAMCOPS_SRC/common/dpi.h \ | ||
$$CAMCOPS_SRC/common/textconst.h \ | ||
$$CAMCOPS_SRC/common/uiconst.h \ | ||
$$CAMCOPS_SRC/lib/convert.h \ | ||
$$CAMCOPS_SRC/lib/datetime.h \ | ||
$$CAMCOPS_SRC/lib/errorfunc.h \ | ||
$$CAMCOPS_SRC/lib/stringfunc.h \ | ||
$$CAMCOPS_SRC/lib/version.h \ | ||
$$CAMCOPS_SRC/maths/ccrandom.h \ | ||
$$CAMCOPS_SRC/maths/mathfunc.h \ | ||
$$CAMCOPS_SRC/questionnairelib/namevalueoptions.h \ | ||
$$CAMCOPS_SRC/questionnairelib/namevaluepair.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.h \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.h | ||
|
||
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" | ||
INCLUDEPATH += $$CAMCOPS_SRC | ||
|
||
DEFINES += SRCDIR=\\\"$$PWD/\\\" | ||
SUBDIRS += namevalueoptions |