Skip to content

Commit

Permalink
iMultiFab Unit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jan 29, 2025
1 parent 27b9c5e commit 608e0b6
Show file tree
Hide file tree
Showing 2 changed files with 528 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,45 @@ def __exit__(self, exc_type, exc_value, traceback):

with MfabDeviceContextManager() as mfab:
yield mfab


@pytest.fixture(scope="function", params=list(itertools.product([1, 3], [0, 1])))
def imfab(boxarr, distmap, request):
class iMfabContextManager:
def __enter__(self):
num_components = request.param[0]
num_ghost = request.param[1]
self.imfab = amr.iMultiFab(boxarr, distmap, num_components, num_ghost)
self.imfab.set_val(0, 0, num_components)
return self.imfab

def __exit__(self, exc_type, exc_value, traceback):
self.imfab.clear()
del self.imfab

with iMfabContextManager() as imfab:
yield imfab


@pytest.fixture(scope="function", params=list(itertools.product([1, 3], [0, 1])))
def imfab_device(boxarr, distmap, request):
class iMfabDeviceContextManager:
def __enter__(self):
num_components = request.param[0]
num_ghost = request.param[1]
self.imfab = amr.iMultiFab(
boxarr,
distmap,
num_components,
num_ghost,
amr.MFInfo().set_arena(amr.The_Device_Arena()),
)
self.imfab.set_val(0, 0, num_components)
return self.imfab

def __exit__(self, exc_type, exc_value, traceback):
self.imfab.clear()
del self.imfab

with iMfabDeviceContextManager() as imfab:
yield imfab
Loading

0 comments on commit 608e0b6

Please sign in to comment.