Skip to content

Commit 4051ba7

Browse files
committed
Add test for std::unique_ptr<int[]>
1 parent 4f194cc commit 4051ba7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/test_CppHeaderParser.py

+45
Original file line numberDiff line numberDiff line change
@@ -4222,5 +4222,50 @@ def test_fn(self):
42224222
self.assertEqual(fn["linkage"], "")
42234223

42244224

4225+
# Github PR 85
4226+
class ContainerOfArray_TestCase(unittest.TestCase):
4227+
def setUp(self):
4228+
self.cppHeader = CppHeaderParser.CppHeader(
4229+
"""
4230+
class ContainerOfArray {
4231+
public:
4232+
std::unique_ptr<int[]> variable;
4233+
std::unique_ptr<int[]> function(std::unique_ptr<int[]> param1);
4234+
};
4235+
""",
4236+
"string",
4237+
)
4238+
4239+
def test_rtntype(self):
4240+
self.assertEqual(
4241+
self.cppHeader.classes["ContainerOfArray"]["methods"]["public"][0]["rtnType"],
4242+
"std::unique_ptr<int [ ] >",
4243+
)
4244+
4245+
def test_parameters(self):
4246+
self.assertEqual(
4247+
filter_pameters(
4248+
self.cppHeader.classes["ContainerOfArray"]["methods"]["public"][0][
4249+
"parameters"
4250+
]
4251+
),
4252+
[{"name": "param1", "desc": None, "type": "std::unique_ptr<int [ ] >"}],
4253+
)
4254+
4255+
def test_member(self):
4256+
self.assertEqual(
4257+
self.cppHeader.classes["ContainerOfArray"]["properties"]["public"][0][
4258+
"name"
4259+
],
4260+
"variable",
4261+
)
4262+
self.assertEqual(
4263+
self.cppHeader.classes["ContainerOfArray"]["properties"]["public"][0][
4264+
"type"
4265+
],
4266+
"std::unique_ptr<int [ ] >",
4267+
)
4268+
4269+
42254270
if __name__ == "__main__":
42264271
unittest.main()

0 commit comments

Comments
 (0)