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