From 31ccdae7be0ec5a2231bdd475b8c3065b5874390 Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Fri, 16 May 2025 18:56:51 -0500 Subject: [PATCH] test_diameter: check scalar results (exact diameter) --- experimental/test/test_diameter.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/experimental/test/test_diameter.c b/experimental/test/test_diameter.c index 2a72322e65..92c0b1ca0b 100644 --- a/experimental/test/test_diameter.c +++ b/experimental/test/test_diameter.c @@ -15,7 +15,8 @@ //------------------------------------------------------------------------------ -// FIXME: need to check the results with correct their values +// FIXME: vector results (peripheral, eccentricity, level, and parent) are not +// checked with exact values #include #include @@ -39,6 +40,7 @@ char filename [LEN+1] ; typedef struct { + int diameter ; bool symmetric ; const char *name ; } @@ -46,17 +48,17 @@ matrix_info ; const matrix_info files [ ] = { - { 1, "A.mtx" }, - { 1, "jagmesh7.mtx" }, - { 0, "west0067.mtx" }, // unsymmetric - { 1, "bcsstk13.mtx" }, - { 1, "karate.mtx" }, - { 1, "ldbc-cdlp-undirected-example.mtx" }, - { 1, "ldbc-undirected-example-bool.mtx" }, - { 1, "ldbc-undirected-example-unweighted.mtx" }, - { 1, "ldbc-undirected-example.mtx" }, - { 1, "ldbc-wcc-example.mtx" }, - { 0, "" }, + { 2, 1, "A.mtx" }, + { 60, 1, "jagmesh7.mtx" }, + { 6, 0, "west0067.mtx" }, // unsymmetric + { 11, 1, "bcsstk13.mtx" }, + { 5, 1, "karate.mtx" }, + { 4, 1, "ldbc-cdlp-undirected-example.mtx" }, + { 4, 1, "ldbc-undirected-example-bool.mtx" }, + { 4, 1, "ldbc-undirected-example-unweighted.mtx" }, + { 4, 1, "ldbc-undirected-example.mtx" }, + { 3, 1, "ldbc-wcc-example.mtx" }, + { 0, 0, "" }, } ; #undef OK @@ -109,7 +111,9 @@ void test_diameter (void) OK (LAGraph_ExactDiameter (&diameter, &peripheral, &eccentricity, G, 8, msg)) ; - printf ("\ndiameter: %" PRIu64 "\n", diameter) ; + printf ("\n%s exact diameter: %" PRIu64 "\n", aname, diameter) ; + TEST_CHECK (diameter == files [k].diameter) ; + printf ("\nperipheral:\n") ; OK (LAGraph_Vector_Print (peripheral, pr, stdout, msg)) ; printf ("\neccentricity:\n") ;