]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/monitoring/iostats_context_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).
6 #include "rocksdb/iostats_context.h"
7 #include "util/testharness.h"
11 TEST(IOStatsContextTest
, ToString
) {
12 get_iostats_context()->Reset();
13 get_iostats_context()->bytes_read
= 12345;
15 std::string zero_included
= get_iostats_context()->ToString();
16 ASSERT_NE(std::string::npos
, zero_included
.find("= 0"));
17 ASSERT_NE(std::string::npos
, zero_included
.find("= 12345"));
19 std::string zero_excluded
= get_iostats_context()->ToString(true);
20 ASSERT_EQ(std::string::npos
, zero_excluded
.find("= 0"));
21 ASSERT_NE(std::string::npos
, zero_excluded
.find("= 12345"));
24 } // namespace rocksdb
26 int main(int argc
, char** argv
) {
27 ::testing::InitGoogleTest(&argc
, argv
);
28 return RUN_ALL_TESTS();