]>
git.proxmox.com Git - ceph.git/blob - 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).
7 #include "port/stack_trace.h"
8 #include "util/testharness.h"
9 #include "util/testutil.h"
11 #include "rocksdb/statistics.h"
15 class StatisticsTest
: public testing::Test
{};
17 // Sanity check to make sure that contents and order of TickersNameMap
19 TEST_F(StatisticsTest
, SanityTickers
) {
20 EXPECT_EQ(static_cast<size_t>(Tickers::TICKER_ENUM_MAX
),
21 TickersNameMap
.size());
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
;
29 // Sanity check to make sure that contents and order of HistogramsNameMap
31 TEST_F(StatisticsTest
, SanityHistograms
) {
32 EXPECT_EQ(static_cast<size_t>(Histograms::HISTOGRAM_ENUM_MAX
),
33 HistogramsNameMap
.size());
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
;
41 } // namespace rocksdb
43 int main(int argc
, char** argv
) {
44 rocksdb::port::InstallStackTraceHandler();
45 ::testing::InitGoogleTest(&argc
, argv
);
46 return RUN_ALL_TESTS();