From 25dfcba60d38f320bbdee51fea802c6cf26fc221 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 24 Sep 2026 22:07:38 -0500 Subject: [PATCH] Sort was backward --- src/xmpp/hash_disco.cpp | 4 ++-- tests/hash_disco.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xmpp/hash_disco.cpp b/src/xmpp/hash_disco.cpp index 1cf9d98..2a88cbc 100644 --- a/src/xmpp/hash_disco.cpp +++ b/src/xmpp/hash_disco.cpp @@ -17,7 +17,7 @@ const std::string hash_disco_sha1(const Stanza &stanza) { return category_compare; const std::string type_a = a->get_tag("type"); const std::string type_b = b->get_tag("type"); - const int type_compare = type_a > type_b; + const int type_compare = type_a < type_b; return type_compare; }); @@ -33,7 +33,7 @@ const std::string hash_disco_sha1(const Stanza &stanza) { [](const XmlNode *a, const XmlNode *b) { const std::string var_a = a->get_tag("var"); const std::string var_b = b->get_tag("var"); - const int var_compare = var_a > var_b; + const int var_compare = var_a < var_b; return var_compare; }); diff --git a/tests/hash_disco.cpp b/tests/hash_disco.cpp index a69e76e..c6a2ccf 100644 --- a/tests/hash_disco.cpp +++ b/tests/hash_disco.cpp @@ -32,7 +32,7 @@ TEST_CASE("Hash disco 1") { auto check_stanza = [](const Stanza &stanza) { const std::string hash = Xmpp::hash_disco_sha1(stanza); - CHECK(hash == "tdfKhW7S+KYskVHBtEvgPUiK0mA="); + CHECK(hash == "GRREviyyjLzK2wK4QLX5NNF9FmQ="); }; xml.add_stanza_callback([check_stanza](const Stanza &stanza) { check_stanza(stanza); @@ -62,7 +62,7 @@ TEST_CASE("Hash disco 2") { auto check_stanza = [](const Stanza &stanza) { const std::string hash = Xmpp::hash_disco_sha1(stanza); - CHECK(hash == "/14s9S+QIGmb2qxhLvEpt/w64gw="); + CHECK(hash == "ga7DGXbUk3tyt5T/WMlqa5qM0zM="); }; xml.add_stanza_callback([check_stanza](const Stanza &stanza) { check_stanza(stanza); @@ -91,7 +91,7 @@ TEST_CASE("Hash disco 2 different order") { auto check_stanza = [](const Stanza &stanza) { const std::string hash = Xmpp::hash_disco_sha1(stanza); - CHECK(hash == "/14s9S+QIGmb2qxhLvEpt/w64gw="); + CHECK(hash == "ga7DGXbUk3tyt5T/WMlqa5qM0zM="); }; xml.add_stanza_callback([check_stanza](const Stanza &stanza) { check_stanza(stanza);