@@ -167,8 +167,8 @@ namespace mt_kahypar {
167167 TEST (MtKaHyPar, StaticHypergraphConstructionHandlesErrors) {
168168 mt_kahypar_error_t error;
169169 mt_kahypar_context_t * context = mt_kahypar_context_from_preset (DEFAULT );
170- const mt_kahypar_hypernode_id_t num_vertices = 7 ;
171- const mt_kahypar_hyperedge_id_t num_hyperedges = 4 ;
170+ mt_kahypar_hypernode_id_t num_vertices = 7 ;
171+ mt_kahypar_hyperedge_id_t num_hyperedges = 4 ;
172172
173173 std::unique_ptr<size_t []> hyperedge_indices = std::make_unique<size_t []>(5 );
174174 hyperedge_indices[0 ] = 0 ; hyperedge_indices[1 ] = 2 ; hyperedge_indices[2 ] = 6 ;
@@ -210,6 +210,21 @@ namespace mt_kahypar {
210210 attempt_construction (" giant HE" );
211211 hyperedge_indices[4 ] = 12 ;
212212
213+ hyperedges[3 ] = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 1 ;
214+ attempt_construction (" overflow pin" );
215+ hyperedges[3 ] = 1 ;
216+
217+ hyperedge_indices[4 ] = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 13 ;
218+ attempt_construction (" overflow HE index" );
219+ hyperedge_indices[4 ] = 12 ;
220+
221+ num_vertices = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 8 ;
222+ attempt_construction (" overflow num vertices" );
223+ num_vertices = 7 ;
224+
225+ num_hyperedges = static_cast <mt_kahypar_hyperedge_id_t >(std::numeric_limits<HyperedgeID>::max ()) + 5 ;
226+ attempt_construction (" overflow num hyperedges" );
227+
213228 mt_kahypar_free_hypergraph (hypergraph);
214229 }
215230
@@ -245,8 +260,8 @@ namespace mt_kahypar {
245260 TEST (MtKaHyPar, DynamicHypergraphConstructionHandlesErrors) {
246261 mt_kahypar_error_t error;
247262 mt_kahypar_context_t * context = mt_kahypar_context_from_preset (HIGHEST_QUALITY );
248- const mt_kahypar_hypernode_id_t num_vertices = 7 ;
249- const mt_kahypar_hyperedge_id_t num_hyperedges = 4 ;
263+ mt_kahypar_hypernode_id_t num_vertices = 7 ;
264+ mt_kahypar_hyperedge_id_t num_hyperedges = 4 ;
250265
251266 std::unique_ptr<size_t []> hyperedge_indices = std::make_unique<size_t []>(5 );
252267 hyperedge_indices[0 ] = 0 ; hyperedge_indices[1 ] = 2 ; hyperedge_indices[2 ] = 6 ;
@@ -288,6 +303,21 @@ namespace mt_kahypar {
288303 attempt_construction (" giant HE" );
289304 hyperedge_indices[4 ] = 12 ;
290305
306+ hyperedges[3 ] = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 1 ;
307+ attempt_construction (" overflow pin" );
308+ hyperedges[3 ] = 1 ;
309+
310+ hyperedge_indices[4 ] = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 13 ;
311+ attempt_construction (" overflow HE index" );
312+ hyperedge_indices[4 ] = 12 ;
313+
314+ num_vertices = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 8 ;
315+ attempt_construction (" overflow num vertices" );
316+ num_vertices = 7 ;
317+
318+ num_vertices = static_cast <mt_kahypar_hyperedge_id_t >(std::numeric_limits<HyperedgeID>::max ()) + 5 ;
319+ attempt_construction (" overflow num hyperedges" );
320+
291321 mt_kahypar_free_hypergraph (hypergraph);
292322 }
293323
@@ -320,8 +350,8 @@ namespace mt_kahypar {
320350 TEST (MtKaHyPar, StaticGraphConstructionHandlesErrors) {
321351 mt_kahypar_error_t error;
322352 mt_kahypar_context_t * context = mt_kahypar_context_from_preset (DEFAULT );
323- const mt_kahypar_hypernode_id_t num_vertices = 5 ;
324- const mt_kahypar_hyperedge_id_t num_hyperedges = 6 ;
353+ mt_kahypar_hypernode_id_t num_vertices = 5 ;
354+ mt_kahypar_hyperedge_id_t num_hyperedges = 6 ;
325355
326356 std::unique_ptr<mt_kahypar_hypernode_id_t []> edges =
327357 std::make_unique<mt_kahypar_hypernode_id_t []>(12 );
@@ -347,6 +377,13 @@ namespace mt_kahypar {
347377 edges[2 ] = 2 ;
348378 attempt_construction (" self loop" );
349379
380+ edges[2 ] = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 1 ;
381+ attempt_construction (" overflow node ID" );
382+ edges[2 ] = 0 ;
383+
384+ num_vertices = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 6 ;
385+ attempt_construction (" overflow num nodes" );
386+
350387 mt_kahypar_free_hypergraph (graph);
351388 }
352389
@@ -379,8 +416,8 @@ namespace mt_kahypar {
379416 TEST (MtKaHyPar, DynamicGraphConstructionHandlesErrors) {
380417 mt_kahypar_error_t error;
381418 mt_kahypar_context_t * context = mt_kahypar_context_from_preset (HIGHEST_QUALITY );
382- const mt_kahypar_hypernode_id_t num_vertices = 5 ;
383- const mt_kahypar_hyperedge_id_t num_hyperedges = 6 ;
419+ mt_kahypar_hypernode_id_t num_vertices = 5 ;
420+ mt_kahypar_hyperedge_id_t num_hyperedges = 6 ;
384421
385422 std::unique_ptr<mt_kahypar_hypernode_id_t []> edges =
386423 std::make_unique<mt_kahypar_hypernode_id_t []>(12 );
@@ -406,6 +443,13 @@ namespace mt_kahypar {
406443 edges[2 ] = 2 ;
407444 attempt_construction (" self loop" );
408445
446+ edges[2 ] = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 1 ;
447+ attempt_construction (" overflow node ID" );
448+ edges[2 ] = 0 ;
449+
450+ num_vertices = static_cast <mt_kahypar_hypernode_id_t >(std::numeric_limits<HypernodeID>::max ()) + 6 ;
451+ attempt_construction (" overflow num nodes" );
452+
409453 mt_kahypar_free_hypergraph (graph);
410454 }
411455
0 commit comments