From a0cb025c91a1a8258dc5e9fb641330ebde9b133a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 8 Oct 2015 15:30:57 +0200 Subject: Fix satisfies() function --- bpkg/satisfaction | 3 ++- bpkg/satisfaction.cxx | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'bpkg') diff --git a/bpkg/satisfaction b/bpkg/satisfaction index 2200688..f250e4b 100644 --- a/bpkg/satisfaction +++ b/bpkg/satisfaction @@ -23,7 +23,8 @@ namespace bpkg } // Return true if any version that satisfies l also satisfies r, or, in - // other words, l is stricter than or equal to r. + // other words, l is stricter than or equal to r. Or, in yet other words, + // l is a subset of r. // bool satisfies (const dependency_constraint& l, const dependency_constraint& r); diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx index 0631b83..d3ba789 100644 --- a/bpkg/satisfaction.cxx +++ b/bpkg/satisfaction.cxx @@ -53,9 +53,9 @@ namespace bpkg { switch (ro) { - case op::eq: return rv < lv; - case op::lt: return rv <= lv; - case op::le: return rv < lv; + case op::eq: return lv < rv; + case op::lt: return lv <= rv; + case op::le: return lv < rv; case op::gt: case op::ge: return false; } @@ -64,9 +64,9 @@ namespace bpkg { switch (ro) { - case op::eq: return rv <= lv; - case op::lt: return rv < lv; - case op::le: return rv <= lv; + case op::eq: return lv <= rv; + case op::lt: return lv < rv; + case op::le: return lv <= rv; case op::gt: case op::ge: return false; } -- cgit v1.1