From 8a899298e37c61cee7d16845fe5a01fb74ca7446 Mon Sep 17 00:00:00 2001 From: Aki Koskinen Date: Sun, 21 Mar 2010 15:40:43 +0200 Subject: [PATCH] Introduced common unit test .pri file --- tests/stlhelpers4qt.h | 28 ---------------------------- tests/ut_common.pri | 1 + tests/ut_gmocktest/ut_gmocktest.cpp | 2 +- tests/ut_gmocktest/ut_gmocktest.pro | 2 ++ tests/ut_template/ut_template.pro | 2 ++ tests/util/stlhelpers4qt.h | 28 ++++++++++++++++++++++++++++ 6 files changed, 34 insertions(+), 29 deletions(-) delete mode 100644 tests/stlhelpers4qt.h create mode 100644 tests/ut_common.pri create mode 100644 tests/util/stlhelpers4qt.h diff --git a/tests/stlhelpers4qt.h b/tests/stlhelpers4qt.h deleted file mode 100644 index b3c297f..0000000 --- a/tests/stlhelpers4qt.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STLHELPERS4QT_H -#define STLHELPERS4QT_H - -#include -#include -#include - -/** - * Outputs the contents of a QList container to a std::ostream object. - * @param stream the stream to output to - * @param val the container that is put to the stream - * @return the same stream that was passed as the parameter @a stream - */ -std::ostream& operator<<(std::ostream& stream, const QList &val) -{ - bool first = true; - - foreach (const QVariant &v, val) { - if (!first) { - stream << ", "; - } - stream << v.toString().toStdString(); - first = false; - } - return stream; -} - -#endif // STLHELPERS4QT_H diff --git a/tests/ut_common.pri b/tests/ut_common.pri new file mode 100644 index 0000000..d813d82 --- /dev/null +++ b/tests/ut_common.pri @@ -0,0 +1 @@ +INCLUDEPATH += ../util diff --git a/tests/ut_gmocktest/ut_gmocktest.cpp b/tests/ut_gmocktest/ut_gmocktest.cpp index e307bd6..e756c8c 100644 --- a/tests/ut_gmocktest/ut_gmocktest.cpp +++ b/tests/ut_gmocktest/ut_gmocktest.cpp @@ -5,7 +5,7 @@ #include #include -#include "../stlhelpers4qt.h" +#include "stlhelpers4qt.h" using ::testing::AtLeast; diff --git a/tests/ut_gmocktest/ut_gmocktest.pro b/tests/ut_gmocktest/ut_gmocktest.pro index 8ae82cf..8a516e3 100644 --- a/tests/ut_gmocktest/ut_gmocktest.pro +++ b/tests/ut_gmocktest/ut_gmocktest.pro @@ -1,3 +1,5 @@ +include(../ut_common.pri) + TARGET = ut_gmocktest QT += testlib QT -= gui diff --git a/tests/ut_template/ut_template.pro b/tests/ut_template/ut_template.pro index 0e85b81..dd7ce43 100644 --- a/tests/ut_template/ut_template.pro +++ b/tests/ut_template/ut_template.pro @@ -1,3 +1,5 @@ +include(../ut_common.pri) + TARGET = ut_template QT += testlib QT -= gui diff --git a/tests/util/stlhelpers4qt.h b/tests/util/stlhelpers4qt.h new file mode 100644 index 0000000..b3c297f --- /dev/null +++ b/tests/util/stlhelpers4qt.h @@ -0,0 +1,28 @@ +#ifndef STLHELPERS4QT_H +#define STLHELPERS4QT_H + +#include +#include +#include + +/** + * Outputs the contents of a QList container to a std::ostream object. + * @param stream the stream to output to + * @param val the container that is put to the stream + * @return the same stream that was passed as the parameter @a stream + */ +std::ostream& operator<<(std::ostream& stream, const QList &val) +{ + bool first = true; + + foreach (const QVariant &v, val) { + if (!first) { + stream << ", "; + } + stream << v.toString().toStdString(); + first = false; + } + return stream; +} + +#endif // STLHELPERS4QT_H -- 1.7.9.5