1 #include "src/processing.hpp"
2 
3 #include <gtest/gtest.h>
4 
5 // Verify if name does not start with a : that it is returned
6 TEST(WellKnownName, NameNotStartColon)
7 {
8     boost::container::flat_map<std::string, std::string> owners;
9     const std::string request = "test";
10     std::string wellKnown;
11 
12     EXPECT_TRUE(getWellKnown(owners, request, wellKnown));
13     EXPECT_EQ(wellKnown, request);
14 }
15 
16 // Verify if name is not found, false is returned
17 TEST(WellKnownName, NameNotFound)
18 {
19     boost::container::flat_map<std::string, std::string> owners;
20     const std::string request = ":test";
21     std::string wellKnown;
22 
23     EXPECT_FALSE(getWellKnown(owners, request, wellKnown));
24     EXPECT_TRUE(wellKnown.empty());
25 }
26 
27 // Verify if name is found, true is returned and name is correct
28 TEST(WellKnownName, NameFound)
29 {
30     boost::container::flat_map<std::string, std::string> owners;
31     const std::string request = ":1.25";
32     std::string wellKnown;
33 
34     owners[request] = "test";
35     EXPECT_TRUE(getWellKnown(owners, request, wellKnown));
36     EXPECT_EQ(wellKnown, "test");
37 }
38