[git] GPGME - branch, master, updated. gpgme-1.9.0-75-gbd5d470

by Andre Heinecke cvs at cvs.gnupg.org
Mon Sep 4 11:27:01 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  bd5d470cef513b2f459316869b81267cde7a9f13 (commit)
       via  58d7bcead3394fa80c2a05d0d1e0fb4d9a1048b0 (commit)
      from  47f61df0704485b8165c9cf2a27ad57bcd864239 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bd5d470cef513b2f459316869b81267cde7a9f13
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Sep 4 11:25:34 2017 +0200

    qt: Add test for version info
    
    * lang/qt/tests/t-various.cpp (TestVarious::testVersion): New.
    
    --
    If it's not tested it does not work ;-)

diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
index fe121fd..7545628 100644
--- a/lang/qt/tests/t-various.cpp
+++ b/lang/qt/tests/t-various.cpp
@@ -151,6 +151,19 @@ private Q_SLOTS:
         QVERIFY(id_revoked);
     }
 
+    void testVersion()
+    {
+        QVERIFY(EngineInfo::Version("2.1.0") < EngineInfo::Version("2.1.1"));
+        QVERIFY(EngineInfo::Version("2.1.10") < EngineInfo::Version("2.1.11"));
+        QVERIFY(EngineInfo::Version("2.2.0") > EngineInfo::Version("2.1.19"));
+        QVERIFY(EngineInfo::Version("1.0.0") < EngineInfo::Version("2.0.0"));
+        QVERIFY(EngineInfo::Version("0.1.0") < EngineInfo::Version("1.0.0"));
+        QVERIFY(!(EngineInfo::Version("2.0.0") < EngineInfo::Version("2.0.0")));
+        QVERIFY(EngineInfo::Version("3.0.0") > EngineInfo::Version("2.3.20"));
+        QVERIFY(EngineInfo::Version("3.0.1") > EngineInfo::Version("3.0.0"));
+        QVERIFY(EngineInfo::Version("3.1.0") > EngineInfo::Version("3.0.20"));
+    }
+
     void initTestCase()
     {
         QGpgMETest::initTestCase();

commit 58d7bcead3394fa80c2a05d0d1e0fb4d9a1048b0
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Sep 4 11:23:56 2017 +0200

    cpp: Fix version info comparison
    
    * lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<):
    Fix logic.
    * lang/cpp/src/engineinfo.h (EngineInfo::Version::operator>):
    New.
    * NEWS: Mention added API
    
    --
    This fixes a logic error that 2.2.0 < 2.1.19 would return true.

diff --git a/NEWS b/NEWS
index 71d9600..aee3f10 100644
--- a/NEWS
+++ b/NEWS
@@ -12,8 +12,9 @@ Noteworthy changes in version 1.10.0 (unreleased)
  GPGME_DELETE_FORCE          NEW.
  gpgme_op_conf_dir           NEW.
  gpgme_set_ctx_flag          EXTENDED: New flag 'auto-key-retrieve'.
- cpp: DecryptionResult::isDeVs NEW.
- cpp: Signature::isDeVs        NEW.
+ cpp: DecryptionResult::isDeVs         NEW.
+ cpp: Signature::isDeVs                NEW.
+ cpp: EngineInfo::Version::operator>   NEW.
  py: DecryptResult           EXTENDED: New boolean field 'is_de_vs'.
  py: Signature               EXTENDED: New boolean field 'is_de_vs'.
  py: GpgError                EXTENDED: Partial results in 'results'.
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h
index b216de8..cd1b7a7 100644
--- a/lang/cpp/src/engineinfo.h
+++ b/lang/cpp/src/engineinfo.h
@@ -71,13 +71,13 @@ public:
 
         bool operator < (const Version& other)
         {
-            if (major < other.major)
-                return true;
-            if (minor < other.minor)
-                return true;
-            if (patch < other.patch)
-                return true;
-            return false;
+            if (major > other.major ||
+                (major == other.major && minor > other.minor) ||
+                (major == other.major && minor == other.minor && patch > other.patch) ||
+                (major >= other.major && minor >= other.minor && patch >= other.patch)) {
+                return false;
+            }
+            return true;
         }
 
         bool operator < (const char* other)
@@ -85,6 +85,15 @@ public:
             return operator<(Version(other));
         }
 
+        bool operator > (const char* other)
+        {
+            return !operator<(Version(other));
+        }
+
+        bool operator > (const Version & other)
+        {
+            return !operator<(other);
+        }
         bool operator == (const Version& other)
         {
             return major == other.major

-----------------------------------------------------------------------

Summary of changes:
 NEWS                        |  5 +++--
 lang/cpp/src/engineinfo.h   | 23 ++++++++++++++++-------
 lang/qt/tests/t-various.cpp | 13 +++++++++++++
 3 files changed, 32 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list