Sort was backward
This commit is contained in:
@@ -17,7 +17,7 @@ const std::string hash_disco_sha1(const Stanza &stanza) {
|
|||||||
return category_compare;
|
return category_compare;
|
||||||
const std::string type_a = a->get_tag("type");
|
const std::string type_a = a->get_tag("type");
|
||||||
const std::string type_b = b->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;
|
return type_compare;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ const std::string hash_disco_sha1(const Stanza &stanza) {
|
|||||||
[](const XmlNode *a, const XmlNode *b) {
|
[](const XmlNode *a, const XmlNode *b) {
|
||||||
const std::string var_a = a->get_tag("var");
|
const std::string var_a = a->get_tag("var");
|
||||||
const std::string var_b = b->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;
|
return var_compare;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ TEST_CASE("Hash disco 1") {
|
|||||||
|
|
||||||
auto check_stanza = [](const Stanza &stanza) {
|
auto check_stanza = [](const Stanza &stanza) {
|
||||||
const std::string hash = Xmpp::hash_disco_sha1(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) {
|
xml.add_stanza_callback([check_stanza](const Stanza &stanza) {
|
||||||
check_stanza(stanza);
|
check_stanza(stanza);
|
||||||
@@ -62,7 +62,7 @@ TEST_CASE("Hash disco 2") {
|
|||||||
|
|
||||||
auto check_stanza = [](const Stanza &stanza) {
|
auto check_stanza = [](const Stanza &stanza) {
|
||||||
const std::string hash = Xmpp::hash_disco_sha1(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) {
|
xml.add_stanza_callback([check_stanza](const Stanza &stanza) {
|
||||||
check_stanza(stanza);
|
check_stanza(stanza);
|
||||||
@@ -91,7 +91,7 @@ TEST_CASE("Hash disco 2 different order") {
|
|||||||
|
|
||||||
auto check_stanza = [](const Stanza &stanza) {
|
auto check_stanza = [](const Stanza &stanza) {
|
||||||
const std::string hash = Xmpp::hash_disco_sha1(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) {
|
xml.add_stanza_callback([check_stanza](const Stanza &stanza) {
|
||||||
check_stanza(stanza);
|
check_stanza(stanza);
|
||||||
|
|||||||
Reference in New Issue
Block a user