]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/monitoring/iostats_context_test.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / monitoring / iostats_context_test.cc
CommitLineData
7c673cae 1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
11fdf7f2
TL
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).
7c673cae
FG
5
6#include "rocksdb/iostats_context.h"
1e59de90 7
f67539c2 8#include "test_util/testharness.h"
7c673cae 9
f67539c2 10namespace ROCKSDB_NAMESPACE {
7c673cae
FG
11
12TEST(IOStatsContextTest, ToString) {
11fdf7f2
TL
13 get_iostats_context()->Reset();
14 get_iostats_context()->bytes_read = 12345;
7c673cae 15
11fdf7f2 16 std::string zero_included = get_iostats_context()->ToString();
7c673cae
FG
17 ASSERT_NE(std::string::npos, zero_included.find("= 0"));
18 ASSERT_NE(std::string::npos, zero_included.find("= 12345"));
19
11fdf7f2 20 std::string zero_excluded = get_iostats_context()->ToString(true);
7c673cae
FG
21 ASSERT_EQ(std::string::npos, zero_excluded.find("= 0"));
22 ASSERT_NE(std::string::npos, zero_excluded.find("= 12345"));
23}
24
f67539c2 25} // namespace ROCKSDB_NAMESPACE
7c673cae
FG
26
27int main(int argc, char** argv) {
1e59de90 28 ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
7c673cae
FG
29 ::testing::InitGoogleTest(&argc, argv);
30 return RUN_ALL_TESTS();
31}