summaryrefslogtreecommitdiff
path: root/src/verify.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-05-27 11:44:21 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-27 11:44:21 +0200
commit3e866abeee4de737a04719ff8ab6c6bf46bb4d74 (patch)
tree4d2b55f42cd6192588e8f0f17952b9c56392ea00 /src/verify.cc
parent63840023707d73ef80b4e86c52b9c9279eb2e9ac (diff)
Sort notes when checking verifications.
So that the lists in the tests don't have to be in the right order.
Diffstat (limited to 'src/verify.cc')
-rw-r--r--src/verify.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 7948767a..623794cc 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -1618,6 +1618,29 @@ dcp::operator== (dcp::VerificationNote const& a, dcp::VerificationNote const& b)
}
+bool
+dcp::operator< (dcp::VerificationNote const& a, dcp::VerificationNote const& b)
+{
+ if (a.type() != b.type()) {
+ return a.type() < b.type();
+ }
+
+ if (a.code() != b.code()) {
+ return a.code() < b.code();
+ }
+
+ if (a.note() != b.note()) {
+ return a.note().get_value_or("") < b.note().get_value_or("");
+ }
+
+ if (a.file() != b.file()) {
+ return a.file().get_value_or("") < b.file().get_value_or("");
+ }
+
+ return a.line().get_value_or(0) < b.line().get_value_or(0);
+}
+
+
std::ostream&
dcp::operator<< (std::ostream& s, dcp::VerificationNote const& note)
{