-
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.
- Loading branch information
1 parent
c97dbce
commit 2fe1e75
Showing
6 changed files
with
163 additions
and
0 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
29 changes: 29 additions & 0 deletions
29
docs/source/autodoc/tablet_qt/tests/auto/lib/stringfunc/stringfunc.pro.rst
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,29 @@ | ||
.. docs/source/autodoc/tablet_qt/tests/auto/lib/stringfunc/stringfunc.pro.rst | ||
.. THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
.. 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/>. | ||
tablet_qt/tests/auto/lib/stringfunc/stringfunc.pro | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. literalinclude:: ../../../../../../../../tablet_qt/tests/auto/lib/stringfunc/stringfunc.pro | ||
:language: none |
29 changes: 29 additions & 0 deletions
29
docs/source/autodoc/tablet_qt/tests/auto/lib/stringfunc/teststringfunc.cpp.rst
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,29 @@ | ||
.. docs/source/autodoc/tablet_qt/tests/auto/lib/stringfunc/teststringfunc.cpp.rst | ||
.. THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
.. 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/>. | ||
tablet_qt/tests/auto/lib/stringfunc/teststringfunc.cpp | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. literalinclude:: ../../../../../../../../tablet_qt/tests/auto/lib/stringfunc/teststringfunc.cpp | ||
:language: C++ |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ SUBDIRS += convert | |
SUBDIRS += filefunc | ||
SUBDIRS += margins | ||
SUBDIRS += soundfunc | ||
SUBDIRS += stringfunc |
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_stringfunc | ||
|
||
SOURCES += \ | ||
teststringfunc.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/\\\" |
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,46 @@ | ||
/* | ||
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/stringfunc.h" | ||
|
||
|
||
class TestStringfunc: public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
private slots: | ||
void testEscapeStringReturnsQuotedEscapedString(); | ||
}; | ||
|
||
|
||
using namespace stringfunc; | ||
|
||
void TestStringfunc::testEscapeStringReturnsQuotedEscapedString() | ||
{ | ||
const QString value = QString(QByteArray("\x07\x20\x41\x42\x43")); | ||
|
||
QCOMPARE(escapeString(value), QString("\"\\g ABC\"")); | ||
} | ||
|
||
QTEST_MAIN(TestStringfunc) | ||
|
||
#include "teststringfunc.moc" |