summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-23 15:22:18 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-23 15:22:18 +0200
commitfe6852642d35481e56caa2b40dacf0001f48a79d (patch)
tree06fa893ad4ed14356771608b8c5a8be7a7339c57
parente8592614a9814171339e033c9f3ce38d6d44a887 (diff)
Add some new check methods.
-rw-r--r--test/test.cc14
-rw-r--r--test/test.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/test/test.cc b/test/test.cc
index ed8a93135..e6a97e06a 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -908,3 +908,17 @@ make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code>
BOOST_CHECK(ok);
}
+
+void
+check_int_close (int a, int b, int d)
+{
+ BOOST_CHECK (std::abs(a - b) < d);
+}
+
+
+void
+check_int_close (std::pair<int, int> a, std::pair<int, int> b, int d)
+{
+ check_int_close (a.first, b.first, d);
+ check_int_close (a.second, b.second, d);
+}
diff --git a/test/test.h b/test/test.h
index 863a015af..217b738f4 100644
--- a/test/test.h
+++ b/test/test.h
@@ -76,6 +76,8 @@ void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesys
extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
extern void make_random_file (boost::filesystem::path path, size_t size);
extern void make_and_verify_dcp (std::shared_ptr<Film> film, std::vector<dcp::VerificationNote::Code> ignore = {});
+extern void check_int_close (int a, int b, int d);
+extern void check_int_close (std::pair<int, int>, std::pair<int, int>, int d);
class LogSwitcher