From 0e412a8d92c4a4e5988892931eba28251bc271e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 29 Mar 2023 17:01:09 +0200
Subject: [PATCH] Testsuite: add a test for deprecated simul command

---
 tests/Makefile.am          |  7 ++++++-
 tests/deprecated/ramst.mod | 41 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 tests/deprecated/ramst.mod

diff --git a/tests/Makefile.am b/tests/Makefile.am
index c7ea141c47..251bd01dff 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -513,7 +513,8 @@ MODFILES = \
 	solve_algo_12_14/purely_forward_reference.mod \
 	solve_algo_12_14/purely_forward_12.mod \
 	solve_algo_12_14/purely_forward_14.mod \
-	deprecated/ramsey_ex.mod
+	deprecated/ramsey_ex.mod \
+	deprecated/ramst.mod
 
 ECB_MODFILES = \
 	var-expectations/1/example1.mod \
@@ -1029,6 +1030,10 @@ solve_algo_12_14/purely_forward_14.o.trs: solve_algo_12_14/purely_forward_refere
 estimation/conditional-likelihood/1/fs2000_estimation_conditional.m.trs: estimation/conditional-likelihood/1/fs2000_estimation_exact.m.trs
 estimation/conditional-likelihood/1/fs2000_estimation_conditional.o.trs: estimation/conditional-likelihood/1/fs2000_estimation_exact.o.trs
 
+deprecated/ramst.m.trs: simul/ramst.m.trs
+deprecated/ramst.o.trs: simul/ramst.o.trs
+
+
 observation_trends_and_prefiltering/MCMC: m/observation_trends_and_prefiltering/MCMC o/observation_trends_and_prefiltering/MCMC
 m/observation_trends_and_prefiltering/MCMC: $(patsubst %.mod, %.m.trs, $(filter observation_trends_and_prefiltering/MCMC/%.mod, $(MODFILES)))
 o/observation_trends_and_prefiltering/MCMC: $(patsubst %.mod, %.o.trs, $(filter observation_trends_and_prefiltering/MCMC/%.mod, $(MODFILES)))
diff --git a/tests/deprecated/ramst.mod b/tests/deprecated/ramst.mod
new file mode 100644
index 0000000000..713f3a86b1
--- /dev/null
+++ b/tests/deprecated/ramst.mod
@@ -0,0 +1,41 @@
+// Tests the deprecated simul command
+
+var c k;
+varexo x;
+
+parameters alph gam delt bet aa;
+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);
+end;
+
+initval;
+x = 1;
+k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
+c = aa*k^alph-delt*k;
+end;
+
+steady;
+
+check;
+
+shocks;
+var x;
+periods 1;
+values 1.2;
+end;
+
+simul(periods=200);
+
+benchmark = load('../simul/ramst/Output/ramst_results.mat');
+
+if max(abs(benchmark.oo_.endo_simul-oo_.endo_simul)) > 1e5
+    error('The results of simul are inconsistent with perfect_foresight_setup+perfect_foresight_solver');
+end
-- 
GitLab