Skip to content

Commit

Permalink
More tests for DECont.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitenti committed Apr 22, 2024
1 parent 639a6f7 commit fc9cbf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
12 changes: 6 additions & 6 deletions numcosmo/nc_de_cont.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ _nc_de_cont_set_property (GObject *object, guint prop_id, const GValue *value, G
case PROP_K:
self->k = g_value_get_double (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
default: /* LCOV_EXCL_LINE */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); /* LCOV_EXCL_LINE */
break; /* LCOV_EXCL_LINE */
}
}

Expand Down Expand Up @@ -160,9 +160,9 @@ _nc_de_cont_get_property (GObject *object, guint prop_id, GValue *value, GParamS
case PROP_K:
g_value_set_double (value, self->k);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
default: /* LCOV_EXCL_LINE */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); /* LCOV_EXCL_LINE */
break; /* LCOV_EXCL_LINE */
}
}

Expand Down
20 changes: 20 additions & 0 deletions tests/test_py_de_cont.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,23 @@ def test_de_cont_nonadiab():
assert_allclose(
state_prop.get_phi_Pphi(), state_nonadiab.get_phi_Pphi(), rtol=1.0e-4
)


def test_de_cont_eval():
"""Test evaluation of NcDECont."""
de_cont = Nc.DECont.new(Omegaw=0.3, OmegaL=0.7, cs2=1.0e-5, w=1.0e-5)

ti = 1.0e0
tf = 1.0e10
de_cont.set_reltol(1.0e-12)
de_cont.set_ti(ti)
de_cont.set_tf(tf)
de_cont.set_k(1.0)

N = 100
t_a = np.geomspace(ti, tf, N)

for t in t_a:
assert np.isfinite(de_cont.eval_xi(None, t))
assert np.isfinite(de_cont.eval_F1(None, t))
assert np.isfinite(de_cont.eval_F2(None, t))

0 comments on commit fc9cbf9

Please sign in to comment.