diff --git a/Util/model_parser/test/main.cpp b/Util/model_parser/test/main.cpp index 2f442f18a0..92d3d98ec6 100644 --- a/Util/model_parser/test/main.cpp +++ b/Util/model_parser/test/main.cpp @@ -23,6 +23,9 @@ int main(int argc, char *argv[]) { std::string model = "sub_chandra.M_WD-1.10.M_He-0.050.hse.CO.N14.N.10.00km"; read_model_file(model); + // test locate and ensure that the index we get is such that + // profile.r(idx) < r < profile.r(idx+1) + Real r{3.89e7}; std::cout << "testing locate" << std::endl; @@ -34,8 +37,20 @@ int main(int argc, char *argv[]) { std::cout << "testing interpolate" << std::endl; // density is monotonically decreasing + // test to make sure that we see that + auto dens = interpolate(r, model::idens); AMREX_ALWAYS_ASSERT(dens <= model::profile(0).state(idx, model::idens) && dens >= model::profile(0).state(idx+1, model::idens)); + // test the bounds. Our model spans r = [5.e5, 4.0955e9] + + std::cout << "testing boundaries of the model" << std::endl; + + auto idx_lo_bnd = locate(-1.0, 0); + AMREX_ALWAYS_ASSERT(idx_lo_bnd == 0); + + auto idx_hi_bnd = locate(4.1e9, 0); + AMREX_ALWAYS_ASSERT(idx_hi_bnd == model::npts-2); + }