# odetest(solution, eq) is to test solution for eq if it gives 0;
# f:= 2y+1, eq:=y'-f=0,  s:=dsolve(eq), odetest(s, eq);
# f:= 2y+1, eq:=ds(y,x,0.5)-f=0,  s:=dsolve(eq), odetest(s, eq);


#odetest(sol_, eq_):= n(replace(simplify(replace(tods(eq),y,replace(replace(sol,C_1,1),C_2,-1))),x,0));

odetest(sol_, eq_):=odetest(sol, eq,y);
odetest(sol_, eq_,y_):= n(expand(simplify(replace(tods(toyn(eq)),y,sol))));
odetest(a_ and b_, eq_,y_):=odetest(a,eq,y) and odetest(b,eq,y);

odetest(sol_, l_=r_,y_, x0_):= n(replace(expand(simplify(replace(l-r,y,sol))),x,x0));
#odetest(sol_, l_=r_,y_):= n(replace(expand(simplify(replace(l-r,y,sol))),x,1.1));

odetest(sol_, eql_=eqr_):= n(expand(simplify(replace(tods(toyn(eql-eqr)),y,sol))));
odetest(sol_, eql_=eqr_,y_):= n(expand(simplify(replace(tods(toyn((eql-eqr)),y,sol))));

odetest(yy_=sol_, eq1_=eq2_):=n((yy=sol)-(dsolve(eq1=eq2)));
odetest(yy_=sol_, eq1_=eq2_,y_):=n((yy=sol)-(dsolve(eq1=eq2,y)));
odetest(s_,s_):=0;