source: src/tests/siweatherstationtest.cpp@ 915dc18

Last change on this file since 915dc18 was 915dc18, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago
  • Working c++ library webserviceclient class, which allows to register a station
    • Added tests for the webserviceclient class
    • Improved build system
    • Fixed some errors in Webservice Location.php and WebserviceApi.php
  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[915dc18]1/*
2 Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 MA 02110-1301 USA.
18*/
19
20#include "siweatherstationtest.h"
21#include "moc_siweatherstationtest.cpp"
22
23#include <siweatherstation.h>
24
25#include <QTest>
26
27using namespace SiWeather::Library;
28
29void SiWeatherStationTest::setUuid()
30{
31 QUuid uuid = QUuid::createUuid();
32 SiWeatherStation station;
33 station.setUuid(uuid.toString());
34 QCOMPARE(station.uuid(), uuid);
35}
36
37void SiWeatherStationTest::setName()
38{
39 QString value = "Station Name";
40 SiWeatherStation station;
41 station.setName(value);
42 QCOMPARE(station.name(), value);
43}
44
45void SiWeatherStationTest::setCity(){
46 QString value = "Station Name";
47 SiWeatherStation station;
48 station.setCity(value);
49 QCOMPARE(station.city(), value);
50}
51
52void SiWeatherStationTest::setLongitude(){
53 double coordinate = 12.12345;
54 SiWeatherStation station;
55 station.setLatitude(coordinate);
56 QCOMPARE(station.latitude(), coordinate);
57}
58
59void SiWeatherStationTest::setLatitude(){
60 double coordinate = 12.12345;
61 SiWeatherStation station;
62 station.setLongitude(coordinate);
63 QCOMPARE(station.longitude(), coordinate);
64}
65
66void SiWeatherStationTest::setType(){
67 QString value = "Station Type";
68 SiWeatherStation station;
69 station.setType(value);
70 QCOMPARE(station.type(), value);
71}
72
73void SiWeatherStationTest::setTypeUrl(){
74 QUrl value("http://example.org");
75 SiWeatherStation station;
76 station.setTypeUrl(value.toString());
77 QCOMPARE(station.typeUrl(), value);
78}
79
80void SiWeatherStationTest::setEMail(){
81 QString value = "test@example.org";
82 SiWeatherStation station;
83 station.setEMail(value);
84 QCOMPARE(station.eMail(), value);
85}
86
87void SiWeatherStationTest::constructor()
88{
89 QUuid uuid = QUuid::createUuid();
90 QString name = "Station Name";
91 SiWeatherStation station(uuid.toString(), name);
92 QCOMPARE(station.uuid(), uuid);
93 QCOMPARE(station.name(), name);
94}
95
96QTEST_MAIN(SiWeatherStationTest)
Note: See TracBrowser for help on using the repository browser.