Skip to content

Commit

Permalink
Improved qbs files for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rominf committed Jun 30, 2016
1 parent 4719917 commit 9c29fc0
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 36 deletions.
8 changes: 0 additions & 8 deletions tests/CoordinateSearch.qbs

This file was deleted.

11 changes: 11 additions & 0 deletions tests/OsmAndCoreTests.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import qbs

Project {
name: "Tests"
references: [
"unit/TestAddressSearch.qbs",
"unit/TestCoordinateSearch.qbs"
]
qbsSearchPaths: "qbs"
AutotestRunner { }
}
26 changes: 0 additions & 26 deletions tests/unit/CMakeLists.txt

This file was deleted.

36 changes: 36 additions & 0 deletions tests/unit/TestAddressSearch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <OsmAndCore/LatLon.h>
#include <OsmAndCore/Search/CoordinateSearch.h>

#include <QtTest/QtTest>
#include <QCoreApplication>

using namespace OsmAnd;
Q_DECLARE_METATYPE(LatLon)

class TestAddressSearch : public QObject
{
Q_OBJECT

private slots:
void search_data();
void search();
};

void TestAddressSearch::search_data()
{
QTest::addColumn<QString>("query");
QTest::addColumn<LatLon>("result");

QTest::newRow("latlon int") << "12 56" << LatLon(12, 56);
}

void TestAddressSearch::search()
{
QFETCH(QString, query);
QFETCH(LatLon, result);
LatLon actual = CoordinateSearch::search(query);
QCOMPARE(result, actual);
}

QTEST_MAIN(TestAddressSearch)
#include "TestAddressSearch.moc"
7 changes: 7 additions & 0 deletions tests/unit/TestAddressSearch.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import qbs
import "UnitTest.qbs" as UnitTest

UnitTest {
name: "TestAddressSearch"
files: ["TestAddressSearch.cpp"]
}
8 changes: 8 additions & 0 deletions tests/unit/TestCoordinateSearch.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import qbs
import "UnitTest.qbs" as UnitTest

UnitTest {
name: "TestCoordinateSearch"
files: ["TestCoordinateSearch.cpp"]
}

2 changes: 0 additions & 2 deletions tests/unit/unit.qbs → tests/unit/UnitTest.qbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import qbs

CppApplication {
name: "TestCoordinateSearch"
type: ["application", "autotest"]
files: ["TestCoordinateSearch.cpp"]

Depends { name: "cpp" }
Depends { name: "Qt.core" }
Expand Down

0 comments on commit 9c29fc0

Please sign in to comment.