From: Aki Koskinen Date: Sat, 27 Mar 2010 16:34:51 +0000 (+0200) Subject: Added KKJ coordinate class X-Git-Url: http://vcs.maemo.org/git/?p=ptas;a=commitdiff_plain;h=e8b2ee80f71a1cb65ccdd846aff047a108dfd699 Added KKJ coordinate class --- diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..97a5344 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,2 @@ +Makefile +libptascommon.so* diff --git a/src/kkj.cpp b/src/kkj.cpp new file mode 100644 index 0000000..d60da50 --- /dev/null +++ b/src/kkj.cpp @@ -0,0 +1,21 @@ +#include "kkj.h" + +KKJ::KKJ(unsigned int northing, unsigned int easting) : + mNorthing(northing), + mEasting(easting) +{ +} + +KKJ::~KKJ() +{ +} + +unsigned int KKJ::northing() const +{ + return mNorthing; +} + +unsigned int KKJ::easting() const +{ + return mEasting; +} diff --git a/src/kkj.h b/src/kkj.h new file mode 100644 index 0000000..3afb9b2 --- /dev/null +++ b/src/kkj.h @@ -0,0 +1,39 @@ +#ifndef KKJ_H +#define KKJ_H + +/** + * A class representing the Finnish KKJ coordinate. + */ +class KKJ +{ +public: + /** + * Constructs a new KKJ coordinate with the given values. + * @param northing the northing coordinate. + * @param easting the easting coordinate. + */ + KKJ(unsigned int northing, unsigned int easting); + + /** + * Destructor. + */ + virtual ~KKJ(); + + /** + * Returns the northing of the coordinate. + * @return the northing. + */ + unsigned int northing() const; + + /** + * Returns the easting of the coordinate. + * @return the easting. + */ + unsigned int easting() const; + +private: + unsigned int mNorthing; + unsigned int mEasting; +}; + +#endif // KKJ_H diff --git a/src/src.pro b/src/src.pro new file mode 100644 index 0000000..ec3edc3 --- /dev/null +++ b/src/src.pro @@ -0,0 +1,9 @@ +TEMPLATE = lib +TARGET = ptascommon + +INSTALL_HEADERS += \ + kkj.h +HEADERS += \ + $$INSTALL_HEADERS +SOURCES += \ + kkj.cpp diff --git a/tests/tests.pro b/tests/tests.pro index 48dd78e..2e22c4a 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs -SUBDIRS = ut_coord_trans +SUBDIRS = \ + ut_kkj check.target = check check.CONFIG = recursive diff --git a/tests/ut_kkj/.gitignore b/tests/ut_kkj/.gitignore new file mode 100644 index 0000000..a044d76 --- /dev/null +++ b/tests/ut_kkj/.gitignore @@ -0,0 +1,2 @@ +Makefile +ut_kkj diff --git a/tests/ut_kkj/ut_kkj.cpp b/tests/ut_kkj/ut_kkj.cpp new file mode 100644 index 0000000..36cac34 --- /dev/null +++ b/tests/ut_kkj/ut_kkj.cpp @@ -0,0 +1,19 @@ +#include "kkj.h" + +#include +#include + +TEST(KKJ, ConstructorValuesReceivedViaGetters) +{ + unsigned int northing = 6682815; + unsigned int easting = 2556686; + KKJ kkj(northing , easting); + ASSERT_EQ(northing, kkj.northing()); + ASSERT_EQ(easting, kkj.easting()); +} + +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleMock(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tests/ut_kkj/ut_kkj.pro b/tests/ut_kkj/ut_kkj.pro new file mode 100644 index 0000000..2f6c4c4 --- /dev/null +++ b/tests/ut_kkj/ut_kkj.pro @@ -0,0 +1,17 @@ +include(../ut_common.pri) + +TARGET = ut_kkj +QT += testlib +QT -= gui +CONFIG += console +CONFIG -= app_bundle +TEMPLATE = app +OBJECTS_DIR = .obj +MOC_DIR = .moc +SOURCES += ut_kkj.cpp \ + $$SRCDIR/kkj.cpp +HEADERS += \ + $$SRCDIR/kkj.h + +include(../gmock.pri) +include(../check.pri)