]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/monitoring/statistics_test.cc
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / monitoring / statistics_test.cc
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5 //
6
7 #include "port/stack_trace.h"
8 #include "util/testharness.h"
9 #include "util/testutil.h"
10
11 #include "rocksdb/statistics.h"
12
13 namespace rocksdb {
14
15 class StatisticsTest : public testing::Test {};
16
17 // Sanity check to make sure that contents and order of TickersNameMap
18 // match Tickers enum
19 TEST_F(StatisticsTest, SanityTickers) {
20 EXPECT_EQ(static_cast<size_t>(Tickers::TICKER_ENUM_MAX),
21 TickersNameMap.size());
22
23 for (uint32_t t = 0; t < Tickers::TICKER_ENUM_MAX; t++) {
24 auto pair = TickersNameMap[static_cast<size_t>(t)];
25 ASSERT_EQ(pair.first, t) << "Miss match at " << pair.second;
26 }
27 }
28
29 // Sanity check to make sure that contents and order of HistogramsNameMap
30 // match Tickers enum
31 TEST_F(StatisticsTest, SanityHistograms) {
32 EXPECT_EQ(static_cast<size_t>(Histograms::HISTOGRAM_ENUM_MAX),
33 HistogramsNameMap.size());
34
35 for (uint32_t h = 0; h < Histograms::HISTOGRAM_ENUM_MAX; h++) {
36 auto pair = HistogramsNameMap[static_cast<size_t>(h)];
37 ASSERT_EQ(pair.first, h) << "Miss match at " << pair.second;
38 }
39 }
40
41 } // namespace rocksdb
42
43 int main(int argc, char** argv) {
44 rocksdb::port::InstallStackTraceHandler();
45 ::testing::InitGoogleTest(&argc, argv);
46 return RUN_ALL_TESTS();
47 }