Skip to content

Commit c028b10

Browse files
committed
Add tests for Cumulative[User|System]TimeIsValid
1 parent efa8050 commit c028b10

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lldb/unittests/Host/HostTest.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "lldb/Host/Host.h"
10+
#include "lldb/Utility/ProcessInfo.h"
1011
#include "gtest/gtest.h"
1112

1213
using namespace lldb_private;
@@ -25,3 +26,23 @@ TEST(Host, GetEnvironment) {
2526
ASSERT_EQ("Host::GetEnvironment",
2627
Host::GetEnvironment().lookup("LLDB_TEST_ENVIRONMENT_VAR"));
2728
}
29+
30+
TEST(Host, ProcessInstanceInfoCumulativeUserTimeIsValid) {
31+
ProcessInstanceInfo info;
32+
info.SetCumulativeUserTime(ProcessInstanceInfo::timespec{0, 0});
33+
EXPECT_FALSE(info.CumulativeUserTimeIsValid());
34+
info.SetCumulativeUserTime(ProcessInstanceInfo::timespec{0, 1});
35+
EXPECT_TRUE(info.CumulativeUserTimeIsValid());
36+
info.SetCumulativeUserTime(ProcessInstanceInfo::timespec{1, 0});
37+
EXPECT_TRUE(info.CumulativeUserTimeIsValid());
38+
}
39+
40+
TEST(Host, ProcessInstanceInfoCumulativeSystemTimeIsValid) {
41+
ProcessInstanceInfo info;
42+
info.SetCumulativeSystemTime(ProcessInstanceInfo::timespec{0, 0});
43+
EXPECT_FALSE(info.CumulativeSystemTimeIsValid());
44+
info.SetCumulativeSystemTime(ProcessInstanceInfo::timespec{0, 1});
45+
EXPECT_TRUE(info.CumulativeSystemTimeIsValid());
46+
info.SetCumulativeSystemTime(ProcessInstanceInfo::timespec{1, 0});
47+
EXPECT_TRUE(info.CumulativeSystemTimeIsValid());
48+
}

0 commit comments

Comments
 (0)