From b1efbd7d6506d89b01a9e48e31d4216e38610f39 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 20 Mar 2016 13:49:07 +0000 Subject: [PATCH] Added initial common functions unit tests. --- source/tests/xestiaab_common.h | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 source/tests/xestiaab_common.h diff --git a/source/tests/xestiaab_common.h b/source/tests/xestiaab_common.h new file mode 100644 index 0000000..3bc6126 --- /dev/null +++ b/source/tests/xestiaab_common.h @@ -0,0 +1,68 @@ + // xestiaab_common.h - Xestia Address Book Common Functions Unit Tests. +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book 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, version 3 of the license. +// +// Xestia Address Book 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 Xestia Address Book. If not, see + +#include +#include "../common/dirs.h" + +TEST(CommonFunctions, GetUserDir){ + + // Run the unit tests depending on the operating system being used. + +#if defined(__WIN32__) + +#elif defined(__APPLE__) + +#else + + // Setup for comparison purposes. Should be /home//.xestiaab + + wxString UserDirCheck = ""; + UserDirCheck.Append(wxString::FromUTF8(getenv("HOME"))); + UserDirCheck.Append(wxT("/.xestiaab/")); + + wxString UserDir = GetUserDir(); + + ASSERT_EQ(UserDir, UserDirCheck); + +#endif + +} + +TEST(CommonFunctions, GetUserPrefDir){ + + // Run the unit tests depending on the operating system being used. + +#if defined(__WIN32__) + +#elif defined(__APPLE__) + +#else + + // Setup for comparison purposes. Should be /home//.xestiaab/preferences + + wxString UserDirCheck = ""; + UserDirCheck.Append(wxString::FromUTF8(getenv("HOME"))); + UserDirCheck.Append(wxT("/.xestiaab/preferences/")); + + wxString UserDir = GetUserPrefDir(); + + ASSERT_EQ(UserDir, UserDirCheck); + +#endif + +} \ No newline at end of file -- 2.39.2