diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2015-04-06 10:20:49 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2015-04-06 10:20:49 -0500 |
commit | af81477b2f5d4ffc76c51c72bd3ac89a4c4cac64 (patch) | |
tree | c39943df60a8ce7b31b08293575427fb2fdf0936 | |
parent | 453a09477ec1eb238d214f61f695a09a0d84949d (diff) | |
download | ayatana-indicator-datetime-af81477b2f5d4ffc76c51c72bd3ac89a4c4cac64.tar.gz ayatana-indicator-datetime-af81477b2f5d4ffc76c51c72bd3ac89a4c4cac64.tar.bz2 ayatana-indicator-datetime-af81477b2f5d4ffc76c51c72bd3ac89a4c4cac64.zip |
in the unit tests, add a PrintTo function for Alarms so that GTest can represent it as a string
-rw-r--r-- | tests/print-to.h | 45 | ||||
-rw-r--r-- | tests/test-eds-valarms.cpp | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/print-to.h b/tests/print-to.h new file mode 100644 index 0000000..78cf574 --- /dev/null +++ b/tests/print-to.h @@ -0,0 +1,45 @@ +/* + * Copyright 2015 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see <http://www.gnu.org/licenses/>. + * + * Authors: + * Charles Kerr <charles.kerr@canonical.com> + */ + +#ifndef INDICATOR_DATETIME_TESTS_PRINT_TO +#define INDICATOR_DATETIME_TESTS_PRINT_TO + +#include <algorithm> + +#include <datetime/appointment.h> + +namespace unity { +namespace indicator { +namespace datetime { + +/*** +**** PrintTo() functions for GTest to represent objects as strings +***/ + +void +PrintTo(const Alarm& alarm, std::ostream* os) +{ + *os << "{text:'" << alarm.text << "', audio_url:'" << alarm.audio_url << "', time:'"<<alarm.time.format("%F %T")<<"'}"; +} + +} // namespace datetime +} // namespace indicator +} // namespace unity + +#endif diff --git a/tests/test-eds-valarms.cpp b/tests/test-eds-valarms.cpp index e9e07d8..b92d190 100644 --- a/tests/test-eds-valarms.cpp +++ b/tests/test-eds-valarms.cpp @@ -27,6 +27,7 @@ #include <gtest/gtest.h> #include "glib-fixture.h" +#include "print-to.h" #include "timezone-mock.h" #include "wakeup-timer-mock.h" |