diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-19 00:37:31 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-22 14:34:25 +0100 |
| commit | 44cd984db9877b2a1aac3321744f7d0415f2f2e9 (patch) | |
| tree | 684fe336e2bfff84920a2c752155b5617d0d3b36 /test/cinema_list_test.cc | |
| parent | 16b3f6c6245acf9689349dbd2af7d4411f861767 (diff) | |
Sort cinemas and DKDM recipients correctly using the collator (#2950).
Diffstat (limited to 'test/cinema_list_test.cc')
| -rw-r--r-- | test/cinema_list_test.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/test/cinema_list_test.cc b/test/cinema_list_test.cc index 58af7839a..15e832eba 100644 --- a/test/cinema_list_test.cc +++ b/test/cinema_list_test.cc @@ -227,16 +227,16 @@ BOOST_AUTO_TEST_CASE(cinemas_list_copy_from_xml_test) BOOST_REQUIRE_EQUAL(cinemas.size(), 3U); auto cinema_iter = cinemas.begin(); + BOOST_CHECK_EQUAL(cinema_iter->second.name, "classy joint"); + BOOST_CHECK_EQUAL(cinema_iter->second.notes, "Can't stand this place"); + ++cinema_iter; + BOOST_CHECK_EQUAL(cinema_iter->second.name, "Great"); BOOST_CHECK_EQUAL(cinema_iter->second.emails.size(), 1U); BOOST_CHECK_EQUAL(cinema_iter->second.emails[0], "julie@tinyscreen.com"); BOOST_CHECK(cinema_iter->second.utc_offset == dcp::UTCOffset(1, 0)); ++cinema_iter; - BOOST_CHECK_EQUAL(cinema_iter->second.name, "classy joint"); - BOOST_CHECK_EQUAL(cinema_iter->second.notes, "Can't stand this place"); - ++cinema_iter; - BOOST_CHECK_EQUAL(cinema_iter->second.name, "stinking dump"); BOOST_CHECK_EQUAL(cinema_iter->second.emails.size(), 2U); BOOST_CHECK_EQUAL(cinema_iter->second.emails[0], "bob@odourscreen.com"); @@ -255,3 +255,22 @@ BOOST_AUTO_TEST_CASE(cinemas_list_copy_from_xml_test) BOOST_CHECK_EQUAL(screen_iter->second.recipient()->subject_dn_qualifier(), "CVsuuv9eYsQZSl8U4fDpvOmzZhI="); } + +BOOST_AUTO_TEST_CASE(cinemas_list_sort_test) +{ + auto const db = setup("cinemas_list_sort_test"); + + CinemaList cinemas(db); + cinemas.add_cinema({"Ŝpecial", { "foo@bar.com" }, "", dcp::UTCOffset()}); + cinemas.add_cinema({"Ţest", { "foo@bar.com" }, "", dcp::UTCOffset()}); + cinemas.add_cinema({"Name", { "foo@bar.com" }, "", dcp::UTCOffset()}); + cinemas.add_cinema({"ÄBC", { "foo@bar.com" }, "", dcp::UTCOffset()}); + + auto sorted = cinemas.cinemas(); + BOOST_REQUIRE_EQUAL(sorted.size(), 4U); + BOOST_CHECK_EQUAL(sorted[0].second.name, "ÄBC"); + BOOST_CHECK_EQUAL(sorted[1].second.name, "Name"); + BOOST_CHECK_EQUAL(sorted[2].second.name, "Ŝpecial"); + BOOST_CHECK_EQUAL(sorted[3].second.name, "Ţest"); +} + |
