diff --git a/src/fdb5/database/Key.cc b/src/fdb5/database/Key.cc index fcf2ed7d6..93828217a 100644 --- a/src/fdb5/database/Key.cc +++ b/src/fdb5/database/Key.cc @@ -32,7 +32,9 @@ Key::Key(const std::shared_ptr reg) : Key::Key(const std::string &s, const Rule *rule) : keys_(), - registry_(rule ? rule->registry() : nullptr), canonical_(false) { + registry_(rule ? rule->registry() : nullptr), + canonical_(false) { + eckit::Tokenizer parse(":", true); eckit::StringList values; parse(s, values); @@ -43,7 +45,8 @@ Key::Key(const std::string &s, const Rule *rule) : Key::Key(const eckit::StringDict &keys, const std::shared_ptr reg) : keys_(keys), - registry_(reg), canonical_(false) { + registry_(reg), + canonical_(false) { eckit::StringDict::const_iterator it = keys.begin(); eckit::StringDict::const_iterator end = keys.end(); @@ -53,13 +56,15 @@ Key::Key(const eckit::StringDict &keys, const std::shared_ptr reg } Key::Key(eckit::Stream& s, const std::shared_ptr reg) : - registry_(reg), canonical_(reg==nullptr) { + registry_(reg), + canonical_(reg == nullptr) { decode(s); } Key::Key(std::initializer_list> l, const std::shared_ptr reg) : keys_(l), - registry_(reg), canonical_(false) { + registry_(reg), + canonical_(reg == nullptr) { for (const auto& kv : keys_) { names_.emplace_back(kv.first); diff --git a/tests/fdb/database/test_indexaxis.cc b/tests/fdb/database/test_indexaxis.cc index a8e27767d..de056df6d 100644 --- a/tests/fdb/database/test_indexaxis.cc +++ b/tests/fdb/database/test_indexaxis.cc @@ -18,8 +18,8 @@ fdb5::Key EXAMPLE_K1{{ fdb5::Key EXAMPLE_K2{{ {"class", "rd"}, - {"expver", "0001"}, - {"time", "1200"} + {"expver", "0001"}, + {"time", "1200"} }}; fdb5::Key EXAMPLE_K3{{ @@ -50,9 +50,9 @@ CASE("Insertion and comparison") { EXPECT(ia1 != ia2); ia2.insert(EXAMPLE_K1); - EXPECT(!(ia1 == ia2)); EXPECT(ia1 != ia2); + ia1.sort(); ia2.sort(); EXPECT(ia1 == ia2);