Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c604a93

Browse files
committed
C++: Add failing tests with 'CAtlList'.
1 parent 0f8df1c commit c604a93

2 files changed

Lines changed: 361 additions & 0 deletions

File tree

cpp/ql/test/library-tests/dataflow/taint-tests/atl.cpp

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,150 @@ void test_CAtlArray() {
249249
sink(a6[0]); // $ ir
250250
}
251251
}
252+
253+
template<typename E, class ETraits = CElementTraits<E>>
254+
struct CAtlList {
255+
using INARGTYPE = typename ETraits::INARGTYPE;
256+
CAtlList(UINT nBlockSize) throw();
257+
~CAtlList() throw();
258+
POSITION AddHead();
259+
POSITION AddHead(INARGTYPE element);
260+
void AddHeadList(const CAtlList<E, ETraits>* plNew);
261+
POSITION AddTail();
262+
POSITION AddTail(INARGTYPE element);
263+
void AddTailList(const CAtlList<E, ETraits>* plNew);
264+
POSITION Find(INARGTYPE element, POSITION posStartAfter) const throw();
265+
POSITION FindIndex(size_t iElement) const throw();
266+
E& GetAt(POSITION pos) throw();
267+
const E& GetAt(POSITION pos) const throw();
268+
size_t GetCount() const throw();
269+
E& GetHead() throw();
270+
const E& GetHead() const throw();
271+
POSITION GetHeadPosition() const throw();
272+
E& GetNext(POSITION& pos) throw();
273+
const E& GetNext(POSITION& pos) const throw();
274+
E& GetPrev(POSITION& pos) throw();
275+
const E& GetPrev(POSITION& pos) const throw();
276+
E& GetTail() throw();
277+
const E& GetTail() const throw();
278+
POSITION GetTailPosition() const throw();
279+
POSITION InsertAfter(POSITION pos, INARGTYPE element);
280+
POSITION InsertBefore(POSITION pos, INARGTYPE element);
281+
bool IsEmpty() const throw();
282+
void MoveToHead(POSITION pos) throw();
283+
void MoveToTail(POSITION pos) throw();
284+
void RemoveAll() throw();
285+
void RemoveAt(POSITION pos) throw();
286+
E RemoveHead();
287+
void RemoveHeadNoReturn() throw();
288+
E RemoveTail();
289+
void RemoveTailNoReturn() throw();
290+
void SetAt(POSITION pos, INARGTYPE element);
291+
void SwapElements(POSITION pos1, POSITION pos2) throw();
292+
};
293+
294+
void test_CAtlList() {
295+
int x = source<int>();
296+
{
297+
CAtlList<int> list(10);
298+
sink(list.GetHead());
299+
list.AddHead(x);
300+
sink(list.GetHead()); // $ MISSING: ir
301+
302+
CAtlList<int> list2(10);
303+
list2.AddHeadList(&list);
304+
sink(list2.GetHead()); // $ MISSING: ir
305+
306+
CAtlList<int> list3(10);
307+
list3.AddTail(x);
308+
sink(list3.GetHead()); // $ MISSING: ir
309+
310+
CAtlList<int> list4(10);
311+
list4.AddTailList(&list3);
312+
sink(list4.GetHead()); // $ MISSING: ir
313+
314+
{
315+
CAtlList<int> list5(10);
316+
auto pos = list5.Find(x, list5.GetHeadPosition());
317+
sink(list5.GetAt(pos)); // $ MISSING: ir
318+
}
319+
320+
{
321+
CAtlList<int> list6(10);
322+
list6.AddHead(x);
323+
auto pos = list6.FindIndex(0);
324+
sink(list6.GetAt(pos)); // $ MISSING: ir
325+
}
326+
327+
{
328+
CAtlList<int> list7(10);
329+
auto pos = list7.GetTailPosition();
330+
list7.InsertAfter(pos, x);
331+
sink(list7.GetHead()); // $ MISSING: ir
332+
}
333+
334+
{
335+
CAtlList<int> list8(10);
336+
auto pos = list8.GetTailPosition();
337+
list8.InsertBefore(pos, x);
338+
sink(list8.GetHead()); // $ MISSING: ir
339+
}
340+
{
341+
CAtlList<int> list9(10);
342+
list9.SetAt(list9.GetHeadPosition(), x);
343+
sink(list9.GetHead()); // $ MISSING: ir
344+
}
345+
}
346+
347+
int* p = indirect_source<int>();
348+
{
349+
CAtlList<int> list(10);
350+
sink(list.GetHead());
351+
list.AddHead(x);
352+
sink(list.GetHead()); // $ MISSING: ir
353+
354+
CAtlList<int> list2(10);
355+
list2.AddHeadList(&list);
356+
sink(list2.GetHead()); // $ MISSING: ir
357+
358+
CAtlList<int> list3(10);
359+
list3.AddTail(x);
360+
sink(list3.GetHead()); // $ MISSING: ir
361+
362+
CAtlList<int> list4(10);
363+
list4.AddTailList(&list3);
364+
sink(list4.GetHead()); // $ MISSING: ir
365+
366+
{
367+
CAtlList<int> list5(10);
368+
auto pos = list5.Find(x, list5.GetHeadPosition());
369+
sink(list5.GetAt(pos)); // $ MISSING: ir
370+
}
371+
372+
{
373+
CAtlList<int> list6(10);
374+
list6.AddHead(x);
375+
auto pos = list6.FindIndex(0);
376+
sink(list6.GetAt(pos)); // $ MISSING: ir
377+
}
378+
379+
{
380+
CAtlList<int> list7(10);
381+
auto pos = list7.GetTailPosition();
382+
list7.InsertAfter(pos, x);
383+
sink(list7.GetHead()); // $ MISSING: ir
384+
}
385+
386+
{
387+
CAtlList<int> list8(10);
388+
auto pos = list8.GetTailPosition();
389+
list8.InsertBefore(pos, x);
390+
sink(list8.GetHead()); // $ MISSING: ir
391+
}
392+
{
393+
CAtlList<int> list9(10);
394+
list9.SetAt(list9.GetHeadPosition(), x);
395+
sink(list9.GetHead()); // $ MISSING: ir
396+
}
397+
}
398+
}

0 commit comments

Comments
 (0)