From af81477b2f5d4ffc76c51c72bd3ac89a4c4cac64 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 6 Apr 2015 10:20:49 -0500 Subject: in the unit tests, add a PrintTo function for Alarms so that GTest can represent it as a string --- tests/print-to.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ tests/test-eds-valarms.cpp | 1 + 2 files changed, 46 insertions(+) create mode 100644 tests/print-to.h (limited to 'tests') 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 . + * + * Authors: + * Charles Kerr + */ + +#ifndef INDICATOR_DATETIME_TESTS_PRINT_TO +#define INDICATOR_DATETIME_TESTS_PRINT_TO + +#include + +#include + +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:'"< #include "glib-fixture.h" +#include "print-to.h" #include "timezone-mock.h" #include "wakeup-timer-mock.h" -- cgit v1.2.3