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 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 17 TEST(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 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 well_known; 33 34 owners[request] = "test"; 35 EXPECT_TRUE(getWellKnown(owners, request, well_known)); 36 EXPECT_EQ(well_known, "test"); 37 } 38