Skip to content

Commit a864629

Browse files
authored
Merge pull request #54 from jupp0r/feature/add-histogram-family-test
Add histogram family unit test
2 parents 1481a17 + 0b591a8 commit a864629

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/registry_test.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ TEST_F(RegistryTest, collect_single_metric_family) {
3131
ASSERT_EQ(collected[0].metric(1).label_size(), 1);
3232
EXPECT_EQ(collected[0].metric(1).label(0).name(), "name");
3333
}
34+
35+
TEST_F(RegistryTest, build_histogram_family) {
36+
Registry registry{};
37+
auto& histogram_family =
38+
BuildHistogram().Name("hist").Help("Test Histogram").Register(registry);
39+
auto& histogram = histogram_family.Add({{"name", "test_histogram_1"}},
40+
Histogram::BucketBoundaries{0, 1, 2});
41+
histogram.Observe(1.1);
42+
auto collected = registry.Collect();
43+
ASSERT_EQ(collected.size(), 1);
44+
}

0 commit comments

Comments
 (0)