Commit f888f167 authored by John Parent's avatar John Parent
Browse files

Flush out stl_container test

parent 88f4a8d6
Pipeline #222670 failed with stages
in 17 minutes and 22 seconds
......@@ -8,13 +8,6 @@ class simple
{
public:
simple() {}
// simple(std::map<int,std::vector<int>> &i_map) :i_map_(i_map) {}
// void append(int i, int val) {this->i_map_.at(i).push_back(val);}
// void add_pair(int i, std::vector<int> v) {this->i_map_[i]=v;}
// private:
// std::map<int,std::vector<int>> i_map_;
};
template <typename T>
......
......@@ -8,14 +8,50 @@ from stl_container import (
VectorDouble,
Int2String,
Int2Double,
simple,
VectoVec,
simpleT_int,
)
class TestStlBinders(unittest.TestCase):
pass
def test_vectorInt(self):
vi = VectorInt()
vi.append(1)
vi.append(2)
sum_ = 0
for x in vi:
sum_ += x
self.assertEqual(sum_, 3)
method_list = [
"pop",
"remove",
"insert",
"extend",
"count",
"clear",
"append",
]
for method in method_list:
self.assertIn(method, dir(VectorInt))
def test_VectorDouble(self):
vd = VectorDouble()
vd.push_back(1)
vd.push_back(2)
self.assertEqual(vd.size(), 2)
self.assertEqual(vd.at(1), 2)
vd.assign(10, 1)
for x in range(10):
self.assertEqual(vd[x], 1)
def test_Int2String(self):
i2s = Int2String()
def test_Int2Double(self):
i2d = Int2Double()
i2d[1] = 2.2
def test_VectoVec(self):
v2v = VectoVec()
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment