@@ -23,6 +23,13 @@ TEST(LLVMInstructionListTest, EmptyList_ContainsNull)
23
23
ASSERT_FALSE (list.containsInstruction (nullptr ));
24
24
}
25
25
26
+ TEST (LLVMInstructionListTest, EmptyList_ContainsFunc)
27
+ {
28
+ LLVMInstructionList list;
29
+ auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
30
+ ASSERT_FALSE (list.containsInstruction ([](const LLVMInstruction *) { return true ; }));
31
+ }
32
+
26
33
TEST (LLVMInstructionListTest, EmptyList_Contains)
27
34
{
28
35
LLVMInstructionList list;
@@ -61,6 +68,27 @@ TEST(LLVMInstructionListTest, SingleInstructionList_ContainsNull)
61
68
ASSERT_FALSE (list.containsInstruction (nullptr ));
62
69
}
63
70
71
+ TEST (LLVMInstructionListTest, SingleInstructionList_ContainsFuncTrue)
72
+ {
73
+ LLVMInstructionList list;
74
+
75
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
76
+ list.addInstruction (ins1);
77
+
78
+ ASSERT_TRUE (list.containsInstruction ([](const LLVMInstruction *) { return true ; }));
79
+ }
80
+
81
+ TEST (LLVMInstructionListTest, SingleInstructionList_ContainsFuncFalse)
82
+ {
83
+ LLVMInstructionList list;
84
+
85
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
86
+ list.addInstruction (ins1);
87
+
88
+ auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
89
+ ASSERT_FALSE (list.containsInstruction ([](const LLVMInstruction *) { return false ; }));
90
+ }
91
+
64
92
TEST (LLVMInstructionListTest, MultipleInstructionList_ContainsExistent)
65
93
{
66
94
LLVMInstructionList list;
@@ -110,6 +138,38 @@ TEST(LLVMInstructionListTest, MultipleInstructionList_ContainsNull)
110
138
ASSERT_FALSE (list.containsInstruction (nullptr ));
111
139
}
112
140
141
+ TEST (LLVMInstructionListTest, MultipleInstructionList_ContainsExistentFunc)
142
+ {
143
+ LLVMInstructionList list;
144
+
145
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
146
+ list.addInstruction (ins1);
147
+
148
+ auto ins2 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Stop, nullptr , false );
149
+ list.addInstruction (ins2);
150
+
151
+ auto ins3 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
152
+ list.addInstruction (ins3);
153
+
154
+ ASSERT_TRUE (list.containsInstruction ([](const LLVMInstruction *ins) { return ins->type == LLVMInstruction::Type::Stop; }));
155
+ }
156
+
157
+ TEST (LLVMInstructionListTest, MultipleInstructionList_ContainsNonExistentFunc)
158
+ {
159
+ LLVMInstructionList list;
160
+
161
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
162
+ list.addInstruction (ins1);
163
+
164
+ auto ins2 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
165
+ list.addInstruction (ins2);
166
+
167
+ auto ins3 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
168
+ list.addInstruction (ins3);
169
+
170
+ ASSERT_FALSE (list.containsInstruction ([](const LLVMInstruction *ins) { return ins->type == LLVMInstruction::Type::Stop; }));
171
+ }
172
+
113
173
TEST (LLVMInstructionListTest, AddSingleInstruction_First)
114
174
{
115
175
LLVMInstructionList list;
0 commit comments