aboutsummaryrefslogtreecommitdiff
path: root/tests/test-eds-ics-tzids.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-eds-ics-tzids.cpp')
-rw-r--r--tests/test-eds-ics-tzids.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/tests/test-eds-ics-tzids.cpp b/tests/test-eds-ics-tzids.cpp
index 11d44b7..4999e66 100644
--- a/tests/test-eds-ics-tzids.cpp
+++ b/tests/test-eds-ics-tzids.cpp
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2024 Robert Tari
*
* 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
@@ -20,7 +20,7 @@
*/
#include <algorithm>
-
+#include <array>
#include <datetime/alarm-queue-simple.h>
#include <datetime/clock-mock.h>
#include <datetime/engine-eds.h>
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
@@ -80,19 +79,34 @@ TEST_F(VAlarmFixture, MultipleAppointments)
}
// what we expect to get...
- std::array<Appointment,1> expected_appts;
- auto appt = &expected_appts[0];
- appt->uid = "8ggc30kh89qql8vjumgtug7l14@google.com";
- appt->color = "#becedd";
- appt->summary = "Hello";
- appt->begin = DateTime{gtz,2015,7,1,20,0,0};
- appt->end = DateTime{gtz,2015,7,1,22,0,0};
+ std::array<Appointment,1> expected_appts1;
+ auto appt1 = &expected_appts1[0];
+ appt1->uid = "8ggc30kh89qql8vjumgtug7l14@google.com";
+ appt1->color = "#becedd";
+ appt1->summary = "Hello";
+ appt1->begin = DateTime{gtz,2015,7,1,20,0,0};
+ appt1->end = DateTime{gtz,2015,7,1,22,0,0};
+
+ std::array<Appointment,1> expected_appts2;
+ auto appt2 = &expected_appts2[0];
+ appt2->uid = "8ggc30kh89qql8vjumgtug7l14@google.com";
+ appt2->color = "#62a0ea";
+ appt2->summary = "Hello";
+ appt2->begin = DateTime{gtz,2015,7,1,20,0,0};
+ appt2->end = DateTime{gtz,2015,7,1,22,0,0};
// compare it to what we actually loaded...
const auto appts = planner->appointments().get();
- EXPECT_EQ(expected_appts.size(), appts.size());
- for (size_t i=0, n=std::min(appts.size(),expected_appts.size()); i<n; i++)
- EXPECT_EQ(expected_appts[i], appts[i]);
+ EXPECT_EQ(expected_appts1.size(), appts.size());
+ EXPECT_EQ(expected_appts2.size(), appts.size());
+
+ for (size_t i=0, n=std::min(appts.size(),expected_appts1.size()); i<n; i++)
+ {
+ EXPECT_PRED3([](auto pAppointmentIn, auto pAppointmentExpected1, auto pAppointmentExpected2)
+ {
+ return pAppointmentIn == pAppointmentExpected1 || pAppointmentIn == pAppointmentExpected2;
+ }, appts[i], expected_appts1[i], expected_appts2[i]);
+ }
// cleanup
g_time_zone_unref(gtz);