From 51278b2f90cd7336bca28f43a8f39d72680bf71a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 10 Jul 2020 18:25:23 +0200
Subject: [PATCH] Testsuite / External functions: also test coefficients of 2nd
 order policy function

---
 .../external_function/first_and_2nd_deriv_given.mod  | 12 ++++++++++++
 .../first_and_2nd_deriv_given_dll.mod                | 12 ++++++++++++
 .../first_and_2nd_deriv_given_dll_namespace.mod      | 12 ++++++++++++
 .../first_and_2nd_deriv_given_namespace.mod          | 12 ++++++++++++
 tests/external_function/first_deriv_given.mod        | 12 ++++++++++++
 tests/external_function/first_deriv_given_dll.mod    | 12 ++++++++++++
 tests/external_function/no_deriv_given.mod           | 12 ++++++++++++
 tests/external_function/no_deriv_given_dll.mod       | 12 ++++++++++++
 8 files changed, 96 insertions(+)

diff --git a/tests/external_function/first_and_2nd_deriv_given.mod b/tests/external_function/first_and_2nd_deriv_given.mod
index 5c9623560c..f621104428 100644
--- a/tests/external_function/first_and_2nd_deriv_given.mod
+++ b/tests/external_function/first_and_2nd_deriv_given.mod
@@ -52,6 +52,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-12
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-12
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/first_and_2nd_deriv_given_dll.mod b/tests/external_function/first_and_2nd_deriv_given_dll.mod
index 40ff04e6b3..ac42623c6f 100644
--- a/tests/external_function/first_and_2nd_deriv_given_dll.mod
+++ b/tests/external_function/first_and_2nd_deriv_given_dll.mod
@@ -52,6 +52,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-12
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-12
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod b/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod
index bfeb03f206..ca55aea5a9 100644
--- a/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod
+++ b/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod
@@ -54,6 +54,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-12
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-12
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/first_and_2nd_deriv_given_namespace.mod b/tests/external_function/first_and_2nd_deriv_given_namespace.mod
index dc116d44a7..3729a17d66 100644
--- a/tests/external_function/first_and_2nd_deriv_given_namespace.mod
+++ b/tests/external_function/first_and_2nd_deriv_given_namespace.mod
@@ -54,6 +54,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-12
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-12
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-12
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/first_deriv_given.mod b/tests/external_function/first_deriv_given.mod
index 5e8e7b172c..ef7ba0ab4f 100644
--- a/tests/external_function/first_deriv_given.mod
+++ b/tests/external_function/first_deriv_given.mod
@@ -52,6 +52,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-12
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-4
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-3
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-5
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-9
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/first_deriv_given_dll.mod b/tests/external_function/first_deriv_given_dll.mod
index 47db02d2d9..cfaf4ae519 100644
--- a/tests/external_function/first_deriv_given_dll.mod
+++ b/tests/external_function/first_deriv_given_dll.mod
@@ -52,6 +52,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-12
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-4
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-3
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-5
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-9
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/no_deriv_given.mod b/tests/external_function/no_deriv_given.mod
index 164e152c5a..c75cd10c15 100644
--- a/tests/external_function/no_deriv_given.mod
+++ b/tests/external_function/no_deriv_given.mod
@@ -52,6 +52,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-9
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-4
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-3
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-5
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-9
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
diff --git a/tests/external_function/no_deriv_given_dll.mod b/tests/external_function/no_deriv_given_dll.mod
index 4503857328..2074168472 100644
--- a/tests/external_function/no_deriv_given_dll.mod
+++ b/tests/external_function/no_deriv_given_dll.mod
@@ -52,6 +52,18 @@ end
 if max(max(abs(L.oo_.dr.ghx - oo_.dr.ghx))) > 1e-9
   error('Failure in external function')
 end
+if max(max(abs(L.oo_.dr.ghxu - oo_.dr.ghxu))) > 1e-4
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghxx - oo_.dr.ghxx))) > 1e-3
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghuu - oo_.dr.ghuu))) > 1e-5
+  error('Failure in external function')
+end
+if max(max(abs(L.oo_.dr.ghs2 - oo_.dr.ghs2))) > 1e-9
+  error('Failure in external function')
+end
 if max(max(abs(L.oo_.var - oo_.var))) > 1e-12
   error('Failure in external function')
 end
-- 
GitLab