File: utils_test.cc

package info (click to toggle)
prometheus-cpp 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 780 kB
  • sloc: cpp: 3,596; sh: 37; makefile: 12
file content (33 lines) | stat: -rw-r--r-- 662 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "prometheus/detail/utils.h"

#include <gtest/gtest.h>

namespace prometheus {

namespace {

class UtilsTest : public testing::Test {
 public:
  detail::LabelHasher hasher;
};

TEST_F(UtilsTest, hash_labels_1) {
  Labels labels{{"key1", "value1"}, {"key2", "vaule2"}};
  EXPECT_EQ(hasher(labels), hasher(labels));
}

TEST_F(UtilsTest, hash_labels_2) {
  Labels labels1{{"aa", "bb"}};
  Labels labels2{{"a", "abb"}};
  EXPECT_NE(hasher(labels1), hasher(labels2));
}

TEST_F(UtilsTest, hash_label_3) {
  Labels labels1{{"a", "a"}};
  Labels labels2{{"aa", ""}};
  EXPECT_NE(hasher(labels1), hasher(labels2));
}

}  // namespace

}  // namespace prometheus