Skip to content

Commit 608e0b6

Browse files
committed
iMultiFab Unit Tests
1 parent 27b9c5e commit 608e0b6

File tree

2 files changed

+528
-0
lines changed

2 files changed

+528
-0
lines changed

tests/conftest.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,45 @@ def __exit__(self, exc_type, exc_value, traceback):
138138

139139
with MfabDeviceContextManager() as mfab:
140140
yield mfab
141+
142+
143+
@pytest.fixture(scope="function", params=list(itertools.product([1, 3], [0, 1])))
144+
def imfab(boxarr, distmap, request):
145+
class iMfabContextManager:
146+
def __enter__(self):
147+
num_components = request.param[0]
148+
num_ghost = request.param[1]
149+
self.imfab = amr.iMultiFab(boxarr, distmap, num_components, num_ghost)
150+
self.imfab.set_val(0, 0, num_components)
151+
return self.imfab
152+
153+
def __exit__(self, exc_type, exc_value, traceback):
154+
self.imfab.clear()
155+
del self.imfab
156+
157+
with iMfabContextManager() as imfab:
158+
yield imfab
159+
160+
161+
@pytest.fixture(scope="function", params=list(itertools.product([1, 3], [0, 1])))
162+
def imfab_device(boxarr, distmap, request):
163+
class iMfabDeviceContextManager:
164+
def __enter__(self):
165+
num_components = request.param[0]
166+
num_ghost = request.param[1]
167+
self.imfab = amr.iMultiFab(
168+
boxarr,
169+
distmap,
170+
num_components,
171+
num_ghost,
172+
amr.MFInfo().set_arena(amr.The_Device_Arena()),
173+
)
174+
self.imfab.set_val(0, 0, num_components)
175+
return self.imfab
176+
177+
def __exit__(self, exc_type, exc_value, traceback):
178+
self.imfab.clear()
179+
del self.imfab
180+
181+
with iMfabDeviceContextManager() as imfab:
182+
yield imfab

0 commit comments

Comments
 (0)