diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f31cdc..637d797 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13) -project(spectator) +project(spectator-cpp) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/spectator/id.h b/spectator/id.h index 611d2a1..1f351af 100644 --- a/spectator/id.h +++ b/spectator/id.h @@ -17,8 +17,7 @@ class Tags { public: Tags() = default; - Tags( - std::initializer_list> vs) { + Tags(std::initializer_list> vs) { for (auto& pair : vs) { add(pair.first, pair.second); } diff --git a/spectator/id_test.cc b/spectator/id_test.cc index ed2aa1c..35a53ec 100644 --- a/spectator/id_test.cc +++ b/spectator/id_test.cc @@ -8,9 +8,15 @@ using spectator::Tags; TEST(Id, Create) { Id id{"foo", Tags{}}; EXPECT_EQ(id.Name(), "foo"); + EXPECT_EQ(id.GetTags().size(), 0); Id id_tags{"name", Tags{{"k", "v"}, {"k1", "v1"}}}; + EXPECT_EQ(id_tags.Name(), "name"); EXPECT_EQ(id_tags.GetTags().size(), 2); + + std::shared_ptr id_of{Id::of("name", Tags{{"k", "v"}, {"k1", "v1"}})}; + EXPECT_EQ(id_of->Name(), "name"); + EXPECT_EQ(id_of->GetTags().size(), 2); } TEST(Id, Tags) {