MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / exercise

Function exercise

edrav2/eprj/boost/libs/python/test/list.cpp:67–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void exercise(list x, object y, object print)
68{
69 x.append(y);
70 x.append(5);
71 x.append(X(3));
72
73 print("after append:");
74 print(x);
75
76 print("number of", y, "instances:", x.count(y));
77
78 print("number of 5s:", x.count(5));
79
80 x.extend("xyz");
81 print("after extend:");
82 print(x);
83 print("index of", y, "is:", x.index(y));
84 print("index of 'l' is:", x.index("l"));
85
86 x.insert(4, 666);
87 print("after inserting 666:");
88 print(x);
89 print("inserting with object as index:");
90 x.insert(x[x.index(5)], "---");
91 print(x);
92
93 print("popping...");
94 x.pop();
95 print(x);
96 x.pop(x[x.index(5)]);
97 print(x);
98 x.pop(x.index(5));
99 print(x);
100
101 print("removing", y);
102 x.remove(y);
103 print(x);
104 print("removing", 666);
105 x.remove(666);
106 print(x);
107
108 print("reversing...");
109 x.reverse();
110 print(x);
111
112 print("sorted:");
113 x.pop(2); // make sorting predictable
114 x.pop(2); // remove [1,2] so the list is sortable in py3k
115 x.sort();
116 print(x);
117
118 print("reverse sorted:");
119#if PY_VERSION_HEX >= 0x03000000
120 x.sort(*tuple(), **dict(make_tuple(make_tuple("reverse", true))));
121#else
122 x.sort(&notcmp);
123#endif
124 print(x);

Callers

nothing calls this directly

Calls 14

XClass · 0.70
printFunction · 0.50
tupleClass · 0.50
dictFunction · 0.50
make_tupleFunction · 0.50
appendMethod · 0.45
countMethod · 0.45
extendMethod · 0.45
indexMethod · 0.45
insertMethod · 0.45
popMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected