From 40c64c8b8588be146df72cdf12ecf3904321c108 Mon Sep 17 00:00:00 2001
From: Carsten Burstedde <burstedde@ins.uni-bonn.de>
Date: Thu, 30 Jan 2025 19:35:51 +0100
Subject: [PATCH] test_coordinates: hash coordinate tuple

---
 test/test_coordinates2.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/test/test_coordinates2.c b/test/test_coordinates2.c
index 275ed6efb..ef90661b9 100644
--- a/test/test_coordinates2.c
+++ b/test/test_coordinates2.c
@@ -81,6 +81,26 @@ test_node_coordinates (const p4est_quadrant_t *r,
           1);
 }
 
+static void
+test_hash (sc_hash_t *hash,
+           p4est_topidx_t tt, const p4est_qcoord_t coords[])
+{
+  int                 retval;
+  void              **found;
+  p4est_qcoord_t      hc[P4EST_DIM + 1];
+
+  hc[0] = (p4est_qcoord_t) tt;
+  hc[1] = coords[0];
+  hc[2] = coords[1];
+#ifdef P4_TO_P8
+  hc[3] = coords[2];
+#endif
+  retval = sc_hash_insert_unique (hash, hc, &found);
+  if (retval) {
+    /* new object: count it */
+  }
+}
+
 static void
 test_connectivity (sc_MPI_Comm mpicomm, p4est_connectivity_t *conn)
 {
@@ -128,6 +148,7 @@ test_connectivity (sc_MPI_Comm mpicomm, p4est_connectivity_t *conn)
     SC_CHECK_ABORT (nt == tt, "Mysterious volume tree");
     SC_CHECK_ABORT (!p4est_coordinates_compare (coords, coords_out),
                     "Mysterious volume coordinates");
+    test_hash (chash, nt, coords_out);
 
     for (face = 0; face < P4EST_FACES; ++face) {
       /* verify face midpoints */