Skip to content

Commit

Permalink
Fix SoA Test: No NaN Comparison (#341)
Browse files Browse the repository at this point in the history
Avoid uninitialized/NaN data in comparison.
  • Loading branch information
ax3l authored Jul 19, 2024
1 parent 70744a6 commit ff46438
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_soa.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ def test_soa_from_tile():
if amr.Config.have_gpu
else amr.ParticleTile_2_1_3_1_default()
)
p = amr.Particle_2_1(1.0, 2.0, 3, rdata_0=4.0, rdata_1=5.0, rdata_2=6.0, idata_1=5)
sp = amr.Particle_5_2(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9, 10)
p = amr.Particle_5_2(
1.0,
2.0,
3.0,
rdata_0=4.0,
rdata_1=5.0,
rdata_2=6.0,
rdata_3=7.0,
rdata_4=8.0,
idata_0=9,
idata_1=10,
)
sp = amr.Particle_5_2(1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9, 10)
pt.push_back(p)
pt.push_back(sp)

Expand All @@ -73,7 +84,7 @@ def test_soa_from_tile():
real_arrays = soa.get_real_data()
int_arrays = soa.get_int_data()
print(real_arrays)
assert np.isclose(real_arrays[0][1], 6.0) and np.isclose(real_arrays[1][1], 7.0)
assert np.isclose(real_arrays[0][1], 6.1) and np.isclose(real_arrays[1][1], 7.1)
assert isinstance(int_arrays[0][0], int)
assert int_arrays[0][1] == 10

Expand Down

0 comments on commit ff46438

Please sign in to comment.