[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - * src/pathx.c (eval_rel): for numbers, '<' and '<=' were reversed



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=a0dfdfae18bacc5c9127c4d49b534c1a3a8d9efd
Commit:        a0dfdfae18bacc5c9127c4d49b534c1a3a8d9efd
Parent:        d1a0221cfc29a7631e5b343c0dd0f2b99b07672c
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Tue Mar 3 16:08:15 2009 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Tue Mar 3 16:08:15 2009 -0800

* src/pathx.c (eval_rel): for numbers, '<' and '<=' were reversed

---
 src/pathx.c       |    4 ++--
 tests/xpath.tests |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pathx.c b/src/pathx.c
index 26afc5f..83a8613 100644
--- a/src/pathx.c
+++ b/src/pathx.c
@@ -591,9 +591,9 @@ static void eval_rel(struct state *state, bool greater, bool equal) {
     }
     if (l->tag == T_NUMBER) {
         if (equal)
-            res = (l->number < r->number);
-        else
             res = (l->number <= r->number);
+        else
+            res = (l->number < r->number);
     } else if (l->tag == T_STRING) {
         int cmp = strcmp(l->string, r->string);
         if (equal)
diff --git a/tests/xpath.tests b/tests/xpath.tests
index 74d435e..02f13a2 100644
--- a/tests/xpath.tests
+++ b/tests/xpath.tests
@@ -152,7 +152,7 @@ test last-ssh-service /files/etc/services/service-name[port = '22'][last()]
 test count-one-alias /files/etc/hosts/*[count(alias) = 1]
      /files/etc/hosts/2
 
-test number-gt /files/etc/hosts/*[count(alias) > 2]
+test number-gt /files/etc/hosts/*[count(alias) > 1]
      /files/etc/hosts/1
 
 test pred-or /files/etc/hosts/*[canonical = 'localhost' or alias = 'localhost']



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]