#include "c_Test.h" #include "c_Digraph.h" #include "c_GabowSCC.h" TEST_CASE(test_gabow_scc_clustering) { c_Digraph_t g; c_err_t err = c_Digraph_Init(&g, 5, NULL); ASSERT_INT_EQ(C_SUCCESS, err); /* Graph layout matching standard component test tracks: * Component 1: 0 -> 1 -> 2 -> 0 * Bridge edge: 2 -> 3 * Component 2: 3 -> 4 -> 3 */ c_Digraph_AddEdge(&g, 0, 1); c_Digraph_AddEdge(&g, 1, 2); c_Digraph_AddEdge(&g, 2, 0); c_Digraph_AddEdge(&g, 2, 3); c_Digraph_AddEdge(&g, 3, 4); c_Digraph_AddEdge(&g, 4, 3); c_GabowSCC_t scc; err = c_GabowSCC_Init(&scc, &g, NULL); ASSERT_INT_EQ(C_SUCCESS, err); /* Verify count profile */ ASSERT_LL_EQ(2, c_GabowSCC_GetCount(&scc)); /* Verify internal associations layout */ ASSERT_TRUE(c_GabowSCC_StronglyConnected(&scc, 0, 1)); ASSERT_TRUE(c_GabowSCC_StronglyConnected(&scc, 1, 2)); ASSERT_TRUE(c_GabowSCC_StronglyConnected(&scc, 3, 4)); ASSERT_FALSE(c_GabowSCC_StronglyConnected(&scc, 0, 3)); /* Check boundary protections fallback indices */ ASSERT_LL_EQ(C_SIZE_MAX, c_GabowSCC_GetId(&scc, 99)); c_GabowSCC_Destroy(&scc); c_Digraph_Destroy(&g); } int main(void) { /* Bootstrapping test environment wrapper */ TEST_START(Test); /* Run specified edge cases */ RUN_TEST(test_gabow_scc_clustering); /* Generate total logging matrix summaries sheet */ TEST_REPORT(); /* Unwind tracking status frames code signals */ RETURN_TEST_STATUS; }