Skip to content

Commit e3f677b

Browse files
committed
Improve test readability
1 parent 62d94ae commit e3f677b

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

lldb/unittests/DAP/VariablesTest.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ using namespace lldb_dap;
1515

1616
class VariablesTest : public ::testing::Test {
1717
protected:
18+
enum : bool { Permanent = true, Temporary = false };
1819
Variables vars;
1920
};
2021

2122
TEST_F(VariablesTest, GetNewVariableReference_UniqueAndRanges) {
22-
const int64_t temp1 = vars.GetNewVariableReference(false);
23-
const int64_t temp2 = vars.GetNewVariableReference(false);
24-
const int64_t perm1 = vars.GetNewVariableReference(true);
25-
const int64_t perm2 = vars.GetNewVariableReference(true);
23+
const int64_t temp1 = vars.GetNewVariableReference(Temporary);
24+
const int64_t temp2 = vars.GetNewVariableReference(Temporary);
25+
const int64_t perm1 = vars.GetNewVariableReference(Permanent);
26+
const int64_t perm2 = vars.GetNewVariableReference(Permanent);
2627

2728
EXPECT_NE(temp1, temp2);
2829
EXPECT_NE(perm1, perm2);
@@ -32,36 +33,36 @@ TEST_F(VariablesTest, GetNewVariableReference_UniqueAndRanges) {
3233

3334
TEST_F(VariablesTest, InsertAndGetVariable_Temporary) {
3435
lldb::SBValue dummy;
35-
const int64_t ref = vars.InsertVariable(dummy, false);
36+
const int64_t ref = vars.InsertVariable(dummy, Temporary);
3637
lldb::SBValue out = vars.GetVariable(ref);
3738

38-
EXPECT_TRUE(out.IsValid() == dummy.IsValid());
39+
EXPECT_EQ(out.IsValid(), dummy.IsValid());
3940
}
4041

4142
TEST_F(VariablesTest, InsertAndGetVariable_Permanent) {
4243
lldb::SBValue dummy;
43-
const int64_t ref = vars.InsertVariable(dummy, true);
44+
const int64_t ref = vars.InsertVariable(dummy, Permanent);
4445
lldb::SBValue out = vars.GetVariable(ref);
4546

46-
EXPECT_TRUE(out.IsValid() == dummy.IsValid());
47+
EXPECT_EQ(out.IsValid(), dummy.IsValid());
4748
}
4849

4950
TEST_F(VariablesTest, IsPermanentVariableReference) {
50-
const int64_t perm = vars.GetNewVariableReference(true);
51-
const int64_t temp = vars.GetNewVariableReference(false);
51+
const int64_t perm = vars.GetNewVariableReference(Permanent);
52+
const int64_t temp = vars.GetNewVariableReference(Temporary);
5253

5354
EXPECT_TRUE(Variables::IsPermanentVariableReference(perm));
5455
EXPECT_FALSE(Variables::IsPermanentVariableReference(temp));
5556
}
5657

5758
TEST_F(VariablesTest, Clear_RemovesTemporaryKeepsPermanent) {
5859
lldb::SBValue dummy;
59-
const int64_t temp = vars.InsertVariable(dummy, false);
60-
const int64_t perm = vars.InsertVariable(dummy, true);
60+
const int64_t temp = vars.InsertVariable(dummy, Temporary);
61+
const int64_t perm = vars.InsertVariable(dummy, Permanent);
6162
vars.Clear();
6263

6364
EXPECT_FALSE(vars.GetVariable(temp).IsValid());
64-
EXPECT_TRUE(vars.GetVariable(perm).IsValid() == dummy.IsValid());
65+
EXPECT_EQ(vars.GetVariable(perm).IsValid(), dummy.IsValid());
6566
}
6667

6768
TEST_F(VariablesTest, GetTopLevelScope_ReturnsCorrectScope) {
@@ -80,5 +81,5 @@ TEST_F(VariablesTest, FindVariable_LocalsByName) {
8081
vars.locals.Append(dummy);
8182
lldb::SBValue found = vars.FindVariable(VARREF_LOCALS, "");
8283

83-
EXPECT_TRUE(found.IsValid() == dummy.IsValid());
84+
EXPECT_EQ(found.IsValid(), dummy.IsValid());
8485
}

0 commit comments

Comments
 (0)