From 599329207abc3fc5a0232bdd9e67a839795da2c7 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Sat, 8 Jan 2022 00:14:51 +0100
Subject: [PATCH] Read name of input SHPC from the command line

Read name of input SHPC for program `test_read_eddy` from the command line.
---
 Overlap/Tests/short_tests.json   | 11 ++++-------
 Overlap/Tests/test_read_eddy.f90 |  7 ++++++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Overlap/Tests/short_tests.json b/Overlap/Tests/short_tests.json
index 9c6da643..0d10ece8 100644
--- a/Overlap/Tests/short_tests.json
+++ b/Overlap/Tests/short_tests.json
@@ -20,16 +20,13 @@
     },
     {
         "title": "Read_eddy",
-        "required": [
-            [
-                "$tests_old_dir/Extraction_eddies_region_4/SHPC_anti",
-                "SHPC_old"
-            ]
-        ],
         "commands":
 	[
             ["mkdir", "SHPC"],
-            ["$build_dir/Overlap/Tests/test_read_eddy"]
+            [
+		"$build_dir/Overlap/Tests/test_read_eddy",
+		"$tests_old_dir/Extraction_eddies_region_4/SHPC_anti"
+	    ]
         ]
     },
     {
diff --git a/Overlap/Tests/test_read_eddy.f90 b/Overlap/Tests/test_read_eddy.f90
index abfcfbdd..5c547284 100644
--- a/Overlap/Tests/test_read_eddy.f90
+++ b/Overlap/Tests/test_read_eddy.f90
@@ -1,5 +1,8 @@
 program test_read_eddy
 
+  ! Library:
+  use jumble, only: get_command_arg_dyn
+
   use derived_types, only: eddy, shpc
   use read_eddy_m, only: read_eddy
   use shpc_close_m, only: shpc_close
@@ -12,10 +15,12 @@ program test_read_eddy
   type(eddy) e
   integer k, eddy_i
   TYPE(shpc) hshp
+  character(len = :), allocatable:: shpc_dir
 
   !-------------------------------------------------------------------------
 
-  call shpc_open(hshp, "SHPC_old", pszaccess = "rb")
+  call get_command_arg_dyn(1, shpc_dir, "Required argument: SHPC-directory")
+  call shpc_open(hshp, shpc_dir, pszaccess = "rb")
   call read_eddy(e, k, eddy_i, hshp, ishape = 0)
   CALL shpc_close(hshp)
 
-- 
GitLab