2 Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "lib/kdm_util.h"
23 #include <dcp/certificate.h>
25 #include <boost/test/unit_test.hpp>
28 BOOST_AUTO_TEST_CASE(check_kdm_and_certificate_validity_periods_good)
30 auto const result = check_kdm_and_certificate_validity_periods(
33 dcp::Certificate(dcp::file_to_string("test/data/cert.pem")),
34 dcp::LocalTime("2023-01-03T10:30:00"),
35 dcp::LocalTime("2050-10-20T14:00:00")
38 BOOST_CHECK(result.overlap == KDMCertificateOverlap::KDM_WITHIN_CERTIFICATE);
42 BOOST_AUTO_TEST_CASE(check_kdm_and_certificate_validity_periods_overlap_start)
44 auto const result = check_kdm_and_certificate_validity_periods(
47 dcp::Certificate(dcp::file_to_string("test/data/cert.pem")),
48 dcp::LocalTime("2011-01-03T10:30:00"),
49 dcp::LocalTime("2050-10-20T14:00:00")
52 BOOST_CHECK(result.overlap == KDMCertificateOverlap::KDM_OVERLAPS_CERTIFICATE);
56 BOOST_AUTO_TEST_CASE(check_kdm_and_certificate_validity_periods_overlap_end)
58 auto const result = check_kdm_and_certificate_validity_periods(
59 "Palace Hotel Ballroom",
61 dcp::Certificate(dcp::file_to_string("test/data/cert.pem")),
62 dcp::LocalTime("2033-01-03T10:30:00"),
63 dcp::LocalTime("2095-10-20T14:00:00")
66 BOOST_CHECK(result.overlap == KDMCertificateOverlap::KDM_OVERLAPS_CERTIFICATE);
70 BOOST_AUTO_TEST_CASE(check_kdm_and_certificate_validity_periods_overlap_start_and_end)
72 auto const result = check_kdm_and_certificate_validity_periods(
73 "Palace Hotel Ballroom",
75 dcp::Certificate(dcp::file_to_string("test/data/cert.pem")),
76 dcp::LocalTime("2011-01-03T10:30:00"),
77 dcp::LocalTime("2095-10-20T14:00:00")
80 BOOST_CHECK(result.overlap == KDMCertificateOverlap::KDM_OVERLAPS_CERTIFICATE);
84 BOOST_AUTO_TEST_CASE(check_kdm_and_certificate_validity_periods_outside)
86 auto const result = check_kdm_and_certificate_validity_periods(
87 "Palace Hotel Ballroom",
89 dcp::Certificate(dcp::file_to_string("test/data/cert.pem")),
90 dcp::LocalTime("2011-01-03T10:30:00"),
91 dcp::LocalTime("2012-10-20T14:00:00")
94 BOOST_CHECK(result.overlap == KDMCertificateOverlap::KDM_OUTSIDE_CERTIFICATE);