diff --git a/tests/block_bytecode/ramst_normcdf_and_friends.mod b/tests/block_bytecode/ramst_normcdf_and_friends.mod new file mode 100644 index 0000000000000000000000000000000000000000..f69a683d456b81648d336756a2e62760559f4bb6 --- /dev/null +++ b/tests/block_bytecode/ramst_normcdf_and_friends.mod @@ -0,0 +1,67 @@ +// Tests the normcdf() function, in the static M-file, and in a dynamic C file + +var c k t u v w; +varexo x; + +parameters alph gam delt bet aa c_steady_state; +alph=0.5; +gam=0.5; +delt=0.02; +bet=0.05; +aa=0.5; + +model(bytecode, block); +c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); +c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); +t = normcdf(x, 2, 3); +u = normpdf(x, 1, 0.5); +v = erf(x); +w = steady_state(k); +end; + +initval; +x = 1; +k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); +c = aa*k^alph-delt*k; +t = 0; +u = 0; +v = 0; +w = 0; +end; + +steady(solve_algo=5); + +//check; + +shocks; +var x; +periods 1; +values 1.2; +end; + +simul(periods=20, stack_solve_algo=5); + +if(abs(oo_.steady_state(5) - erf(1)) > 1e-10) + error('Test failed in static bytecode for erf') +end + +if (abs(oo_.endo_simul(5, 2) - erf(1.2)) > 1e-10) + error('Test failed in dynamic bytecode for erf') +end + +if(abs(oo_.steady_state(4) - normpdf(1, 1, 0.5)) > 1e-10) + error('Test failed in static bytecode for normpdf') +end + +if (abs(oo_.endo_simul(4, 2) - normpdf(1.2, 1, 0.5)) > 1e-10) + error('Test failed in dynamic bytecode for normpdf') +end + +if (abs(oo_.steady_state(3) - normcdf(1, 2, 3)) > 1e-10) + error('Test failed in static bytecode for normcdf') +end + +if (abs(oo_.endo_simul(3, 2) - normcdf(1.2, 2, 3)) > 1e-10) + error('Test failed in dynamic bytecode for normcdf') +end + diff --git a/tests/block_bytecode/ramst_steady_state.mod b/tests/block_bytecode/ramst_steady_state.mod new file mode 100644 index 0000000000000000000000000000000000000000..ae01d1e2ee4d14991433e3d3c91e034fc52db519 --- /dev/null +++ b/tests/block_bytecode/ramst_steady_state.mod @@ -0,0 +1,47 @@ +// Tests the normcdf() function, in the static M-file, and in a dynamic C file + +var c k t u v w; +varexo x; + +parameters alph gam delt bet aa c_steady_state; +alph=0.5; +gam=0.5; +delt=0.02; +bet=0.05; +aa=0.5; + +model(bytecode, block); +c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); +c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); +t = normcdf(x, 2, 3); +u = normpdf(x, 1, 0.5); +v = erf(x); +w = steady_state(k); +end; + +initval; +x = 1; +k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); +c = aa*k^alph-delt*k; +t = 0; +u = 0; +v = 0; +w = 0; +end; + +steady(solve_algo=5); + +//check; + +shocks; +var x; +periods 1; +values 1.2; +end; + +simul(periods=20, stack_solve_algo=5); + +if(abs(oo_.steady_state(2) - oo_.endo_simul(6,2)) > 1e-10) + error('Test failed in bytecode for steady_state') +end + diff --git a/tests/ramst_normcdf_and_friends.mod b/tests/ramst_normcdf_and_friends.mod new file mode 100644 index 0000000000000000000000000000000000000000..9a106cfa1b87940cf581d41a978f6e5ccbc5e102 --- /dev/null +++ b/tests/ramst_normcdf_and_friends.mod @@ -0,0 +1,67 @@ +// Tests the normcdf() function, in the static M-file, and in a dynamic C file + +var c k t u v w; +varexo x; + +parameters alph gam delt bet aa c_steady_state; +alph=0.5; +gam=0.5; +delt=0.02; +bet=0.05; +aa=0.5; + +model; +c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); +c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); +t = normcdf(x, 2, 3); +u = normpdf(x, 1, 0.5); +v = erf(x); +w = steady_state(k); +end; + +initval; +x = 1; +k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); +c = aa*k^alph-delt*k; +t = 0; +u = 0; +v = 0; +w = 0; +end; + +steady; + +check; + +shocks; +var x; +periods 1; +values 1.2; +end; + +simul(periods=20); + +if(abs(oo_.steady_state(5) - erf(1)) > 1e-10) + error('Test failed in static bytecode for erf') +end + +if (abs(oo_.endo_simul(5, 2) - erf(1.2)) > 1e-10) + error('Test failed in dynamic bytecode for erf') +end + +if(abs(oo_.steady_state(4) - normpdf(1, 1, 0.5)) > 1e-10) + error('Test failed in static bytecode for normpdf') +end + +if (abs(oo_.endo_simul(4, 2) - normpdf(1.2, 1, 0.5)) > 1e-10) + error('Test failed in dynamic bytecode for normpdf') +end + +if (abs(oo_.steady_state(3) - normcdf(1, 2, 3)) > 1e-10) + error('Test failed in static bytecode for normcdf') +end + +if (abs(oo_.endo_simul(3, 2) - normcdf(1.2, 2, 3)) > 1e-10) + error('Test failed in dynamic bytecode for normcdf') +end + diff --git a/tests/ramst_normcdf.mod b/tests/ramst_steady_state.mod similarity index 62% rename from tests/ramst_normcdf.mod rename to tests/ramst_steady_state.mod index 89505144d4f270a1a1a1efb3f0a55946e0744281..2010dd250894c60d8aabdf8b83b9664f853cfdde 100644 --- a/tests/ramst_normcdf.mod +++ b/tests/ramst_steady_state.mod @@ -1,20 +1,22 @@ // Tests the normcdf() function, in the static M-file, and in a dynamic C file -var c k t; +var c k t u v w; varexo x; -parameters alph gam delt bet aa; +parameters alph gam delt bet aa c_steady_state; alph=0.5; gam=0.5; delt=0.02; bet=0.05; aa=0.5; - -model(use_dll); +model; c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); t = normcdf(x, 2, 3); +u = normpdf(x, 1, 0.5); +v = erf(x); +w = steady_state(k); end; initval; @@ -22,11 +24,14 @@ x = 1; k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); c = aa*k^alph-delt*k; t = 0; +u = 0; +v = 0; +w = 0; end; steady; -check; +//check; shocks; var x; @@ -36,10 +41,7 @@ end; simul(periods=20); -if (abs(oo_.steady_state(3) - normcdf(1, 2, 3)) > 1e-10) - error('Test failed in static M-file') +if(abs(oo_.steady_state(2) - oo_.endo_simul(6,2)) > 1e-10) + error('Test failed in bytecode for steady_state') end -if (abs(oo_.endo_simul(3, 2) - normcdf(1.2, 2, 3)) > 1e-10) - error('Test failed in dynamic C file') -end