@@ -17,6 +17,99 @@ TEST(LLVMInstructionListTest, EmptyList_Last)
17
17
ASSERT_EQ (list.last (), nullptr );
18
18
}
19
19
20
+ TEST (LLVMInstructionListTest, EmptyList_ContainsNull)
21
+ {
22
+ LLVMInstructionList list;
23
+ ASSERT_FALSE (list.containsInstruction (nullptr ));
24
+ }
25
+
26
+ TEST (LLVMInstructionListTest, EmptyList_Contains)
27
+ {
28
+ LLVMInstructionList list;
29
+ auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
30
+ ASSERT_FALSE (list.containsInstruction (ins.get ()));
31
+ }
32
+
33
+ TEST (LLVMInstructionListTest, SingleInstructionList_ContainsExistent)
34
+ {
35
+ LLVMInstructionList list;
36
+
37
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
38
+ list.addInstruction (ins1);
39
+
40
+ ASSERT_TRUE (list.containsInstruction (ins1.get ()));
41
+ }
42
+
43
+ TEST (LLVMInstructionListTest, SingleInstructionList_ContainsNonExistent)
44
+ {
45
+ LLVMInstructionList list;
46
+
47
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
48
+ list.addInstruction (ins1);
49
+
50
+ auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
51
+ ASSERT_FALSE (list.containsInstruction (ins.get ()));
52
+ }
53
+
54
+ TEST (LLVMInstructionListTest, SingleInstructionList_ContainsNull)
55
+ {
56
+ LLVMInstructionList list;
57
+
58
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
59
+ list.addInstruction (ins1);
60
+
61
+ ASSERT_FALSE (list.containsInstruction (nullptr ));
62
+ }
63
+
64
+ TEST (LLVMInstructionListTest, MultipleInstructionList_ContainsExistent)
65
+ {
66
+ LLVMInstructionList list;
67
+
68
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
69
+ list.addInstruction (ins1);
70
+
71
+ auto ins2 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
72
+ list.addInstruction (ins2);
73
+
74
+ auto ins3 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
75
+ list.addInstruction (ins3);
76
+
77
+ ASSERT_TRUE (list.containsInstruction (ins2.get ()));
78
+ }
79
+
80
+ TEST (LLVMInstructionListTest, MultipleInstructionList_ContainsNonExistent)
81
+ {
82
+ LLVMInstructionList list;
83
+
84
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
85
+ list.addInstruction (ins1);
86
+
87
+ auto ins2 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
88
+ list.addInstruction (ins2);
89
+
90
+ auto ins3 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
91
+ list.addInstruction (ins3);
92
+
93
+ auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
94
+ ASSERT_FALSE (list.containsInstruction (ins.get ()));
95
+ }
96
+
97
+ TEST (LLVMInstructionListTest, MultipleInstructionList_ContainsNull)
98
+ {
99
+ LLVMInstructionList list;
100
+
101
+ auto ins1 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
102
+ list.addInstruction (ins1);
103
+
104
+ auto ins2 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
105
+ list.addInstruction (ins2);
106
+
107
+ auto ins3 = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr , false );
108
+ list.addInstruction (ins3);
109
+
110
+ ASSERT_FALSE (list.containsInstruction (nullptr ));
111
+ }
112
+
20
113
TEST (LLVMInstructionListTest, AddSingleInstruction_First)
21
114
{
22
115
LLVMInstructionList list;
0 commit comments