Skip to content

Commit

Permalink
Fix member access with meson build
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophny committed Jan 7, 2025
1 parent 134f514 commit 9ad5387
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions examples/issue235_allocatable_classes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ test: wrapper
$(PYTHON) run.py

wrapper: f90wrapper mytype.o myclass.o myclass_factory.o
f2py-f90wrap --build-dir . -c -m _itest --opt="-O0 -g" \
$(PYTHON) -m f90wrap --f2py-f90wrap --build-dir . -c -m _itest --opt="-O0 -g" \
f90wrap_mytype.f90 f90wrap_myclass.f90 f90wrap_myclass_factory.f90 \
mytype.o myclass.o myclass_factory.o
mytype.o myclass.o myclass_factory.o --lower

f90wrapper: mytype.f90 myclass.f90 myclass_factory.f90
f90wrap -m itest -P mytype.f90 myclass.f90 myclass_factory.f90 -v
$(PYTHON) -m f90wrap -m itest mytype.f90 myclass.f90 myclass_factory.f90 -v

%.o : %.f90
$(FC) $(FCFLAGS) -c -g -O0 $< -o $@
Expand Down
20 changes: 10 additions & 10 deletions examples/issue235_allocatable_classes/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ class TestMyType(unittest.TestCase):

def test_create_destroy_type_object(self):
"""Object creation and destruction should happen only once."""
mytype.set_create_count(0)
mytype.set_destroy_count(0)
mytype.create_count = 0
mytype.destroy_count = 0

obj = mytype.mytype_create(REF)

self.assertEqual(mytype.get_create_count(), 1)
self.assertEqual(mytype.create_count, 1)

self.assertTrue(abs(obj.val - REF) < TOL)

del obj

self.assertEqual(mytype.get_create_count(), 1)
self.assertGreaterEqual(mytype.get_destroy_count(), 1)
self.assertEqual(mytype.create_count, 1)
self.assertGreaterEqual(mytype.destroy_count, 1)

def test_type_member_access(self):
"""Direct access of member variables."""
Expand All @@ -40,19 +40,19 @@ class TestMyClass(unittest.TestCase):

def test_create_destroy_class_object(self):
"""Object creation and destruction should happen only once."""
myclass.set_create_count(0)
myclass.set_destroy_count(0)
myclass.create_count = 0
myclass.destroy_count = 0

obj = myclass_factory.myclass_create(REF)

self.assertEqual(myclass.get_create_count(), 1)
self.assertEqual(myclass.create_count, 1)

self.assertTrue(abs(obj.get_val() - REF) < TOL)

del obj

self.assertEqual(myclass.get_create_count(), 1)
self.assertGreaterEqual(myclass.get_destroy_count(), 1)
self.assertEqual(myclass.create_count, 1)
self.assertGreaterEqual(myclass.destroy_count, 1)

def test_class_getter_setter(self):
"""Getters and setters defined in Fortran should work."""
Expand Down

0 comments on commit 9ad5387

Please sign in to comment.