From acdc28aeb00ef9f93f72c813f0823b66984c31c0 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 1 Jul 2021 21:23:20 +0200
Subject: [PATCH] Add test on `k_test_[12]`

---
 Overlap/Tests/test_overlap.f90 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90
index 9108a494..a98d174a 100644
--- a/Overlap/Tests/test_overlap.f90
+++ b/Overlap/Tests/test_overlap.f90
@@ -22,7 +22,7 @@ program test_overlap
   character(len = :), allocatable:: shpc_dir
   integer d_init
   integer:: k_test_1 = 0, k_test_2 = 1
-  integer unit, i, copy, rank, n_proc
+  integer unit, i, copy, rank, n_proc, n_dates
   integer, allocatable:: ishape_last(:)
   type(snapshot), allocatable:: flow(:) ! (max_delta + 1)
   TYPE(shpc) hshp
@@ -79,6 +79,9 @@ program test_overlap
   step = step_deg * deg_to_rad
   allocate(flow(max_delta + 1))
   call read_column(ishape_last, file = trim(shpc_dir) // "/ishape_last.txt")
+  n_dates = size(ishape_last)
+  call assert(0 <= [k_test_1, k_test_2] .and. [k_test_1, k_test_2] < n_dates, &
+       "test_overlap k_test_1, k_test_2")
   e_overestim = maxval([ishape_last(1) + 1, ediff1d(ishape_last)])
   call shpc_open(hshp, trim(shpc_dir), rank = 0)
   call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
-- 
GitLab