bindings: fix segmentation violation in python scripts

And move sample-rng-plot.py code to a main function
This commit is contained in:
Gabriel Ferreira
2022-08-01 23:16:40 -03:00
parent 6ac76bd9a2
commit 4e1d606af5
3 changed files with 50 additions and 29 deletions

View File

@@ -214,6 +214,8 @@ class TestSimulator(unittest.TestCase):
self.assertTrue(self._received_packet is not None)
self.assertEqual(self._received_packet.GetSize(), 19)
# Delete Ptr<>'s on the python side to let C++ clean them
del internet
def testAttributes(self):
"""! Test attributes function
@@ -243,6 +245,9 @@ class TestSimulator(unittest.TestCase):
mobility.GetAttribute("PositionAllocator", ptr2)
self.assertNotEqual(ptr.GetObject(), ns.core.Ptr["Object"](ns.cppyy.nullptr))
# Delete Ptr<>'s on the python side to let C++ clean them
del queue, mobility, ptr, ptr2
def testIdentity(self):
"""! Test identify
@param self this object
@@ -257,6 +262,9 @@ class TestSimulator(unittest.TestCase):
self.assertEqual(c1, c2)
# Delete Ptr<>'s on the python side to let C++ clean them
del csma, channel
def testTypeId(self):
"""! Test type ID
@param self this object