]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/monitoring/iostats_context_test.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / 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).
5
6 #include "rocksdb/iostats_context.h"
7 #include "util/testharness.h"
8
9 namespace rocksdb {
10
11 TEST(IOStatsContextTest, ToString) {
12 get_iostats_context()->Reset();
13 get_iostats_context()->bytes_read = 12345;
14
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"));
18
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"));
22 }
23
24 } // namespace rocksdb
25
26 int main(int argc, char** argv) {
27 ::testing::InitGoogleTest(&argc, argv);
28 return RUN_ALL_TESTS();
29 }