aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-10-08 16:29:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-10-08 16:29:24 +0200
commit714a13a117d53d98769d224193a2115aff9ae7ea (patch)
treef3cd66ba5083a13ac24e5541c9fbd8b31a8c840c
parenta0cb025c91a1a8258dc5e9fb641330ebde9b133a (diff)
Fix satisfy() some more
-rw-r--r--bpkg/satisfaction.cxx25
-rwxr-xr-xbpkg/test.sh12
2 files changed, 28 insertions, 9 deletions
diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx
index d3ba789..af531f4 100644
--- a/bpkg/satisfaction.cxx
+++ b/bpkg/satisfaction.cxx
@@ -47,15 +47,22 @@ namespace bpkg
{
case op::eq: // ==
{
- return ro == op::eq && lv == rv;
+ switch (ro)
+ {
+ case op::eq: return lv == rv;
+ case op::lt: return lv < rv;
+ case op::le: return lv <= rv;
+ case op::gt: return lv > rv;
+ case op::ge: return lv >= rv;
+ }
}
case op::lt: // <
{
switch (ro)
{
- case op::eq: return lv < rv;
case op::lt: return lv <= rv;
case op::le: return lv < rv;
+ case op::eq:
case op::gt:
case op::ge: return false;
}
@@ -64,9 +71,9 @@ namespace bpkg
{
switch (ro)
{
- case op::eq: return lv <= rv;
case op::lt: return lv < rv;
case op::le: return lv <= rv;
+ case op::eq:
case op::gt:
case op::ge: return false;
}
@@ -75,22 +82,22 @@ namespace bpkg
{
switch (ro)
{
- case op::eq: return lv > rv;
- case op::lt:
- case op::le: return false;
case op::gt: return lv >= rv;
case op::ge: return lv > rv;
+ case op::eq:
+ case op::lt:
+ case op::le: return false;
}
}
case op::ge: // >=
{
switch (ro)
{
- case op::eq: return lv >= rv;
- case op::lt:
- case op::le: return false;
case op::gt: return lv > rv;
case op::ge: return lv >= rv;
+ case op::eq:
+ case op::lt:
+ case op::le: return false;
}
}
}
diff --git a/bpkg/test.sh b/bpkg/test.sh
index e882535..7fa5fd9 100755
--- a/bpkg/test.sh
+++ b/bpkg/test.sh
@@ -826,6 +826,18 @@ build libbaz 1.0.0
build libfox 1.0.0
EOF
+test build -p libbaz libfoo libbar <<EOF
+build libfoo 1.0.0
+build libbar 1.0.0
+build libbaz 1.0.0
+EOF
+
+test build -p libbaz libbar libfoo <<EOF
+build libfoo 1.0.0
+build libbar 1.0.0
+build libbaz 1.0.0
+EOF
+
# 4 (libbaz depends on libfoo and libbar; libbar depends on libfoo >= 1.1.0)
#
test rep-create ../tests/repository/1/satisfy/t4a