From b4f3eb4a1c7554c006227f7751c090a74cf1d2a9 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Mon, 2 Nov 2020 14:01:12 +0100 Subject: [PATCH 1/2] Add unit test for ifndef See https://git.dynare.org/Dynare/dynare/-/issues/1747 --- tests/Makefile.am | 1 + tests/macro_processor/test_ifndef.mod | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/macro_processor/test_ifndef.mod diff --git a/tests/Makefile.am b/tests/Makefile.am index af26cfab1..2882ad6c9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -81,6 +81,7 @@ MODFILES = \ example2long.mod \ example2long_use_dll.mod \ t_sgu_ex1.mod \ + macro_processor/test_ifndef.mod \ irfs/example1_unit_std.mod \ optimal_policy/OSR/osr_example.mod \ optimal_policy/OSR/osr_example_objective_correctness.mod \ diff --git a/tests/macro_processor/test_ifndef.mod b/tests/macro_processor/test_ifndef.mod new file mode 100644 index 000000000..2a846473e --- /dev/null +++ b/tests/macro_processor/test_ifndef.mod @@ -0,0 +1,17 @@ +// test ifndef to prevent regressions like #1747 +@#define marco=1 +@#ifndef marco + def=0; +@#else + def=1; +@#endif + +if ~def + error('ifndef not reached') +end + +var x; + +model; +x; +end; \ No newline at end of file From d38a4428cce471f5c67b4807543528420dd98792 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Mon, 2 Nov 2020 14:02:24 +0100 Subject: [PATCH 2/2] Move macro_processor/example1_macro.mod to subfolder --- tests/Makefile.am | 2 +- tests/{ => macro_processor}/example1_macro.mod | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/{ => macro_processor}/example1_macro.mod (100%) diff --git a/tests/Makefile.am b/tests/Makefile.am index 2882ad6c9..ff4b8a4ee 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -75,13 +75,13 @@ MODFILES = \ example1_with_tags.mod \ example1_irf_shocks.mod \ example1_abs_sign.mod \ - example1_macro.mod \ example1_mlv.mod \ example1long.mod \ example2long.mod \ example2long_use_dll.mod \ t_sgu_ex1.mod \ macro_processor/test_ifndef.mod \ + macro_processor/example1_macro.mod \ irfs/example1_unit_std.mod \ optimal_policy/OSR/osr_example.mod \ optimal_policy/OSR/osr_example_objective_correctness.mod \ diff --git a/tests/example1_macro.mod b/tests/macro_processor/example1_macro.mod similarity index 100% rename from tests/example1_macro.mod rename to tests/macro_processor/example1_macro.mod