Line data Source code
1 : //------------------------------------------------------------------------------ 2 : // LAGraph/src/test/test_Init.c: test LAGraph_Init and LAGraph_Finalize 3 : //------------------------------------------------------------------------------ 4 : 5 : // LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved. 6 : // SPDX-License-Identifier: BSD-2-Clause 7 : // 8 : // For additional details (including references to third party source code and 9 : // other files) see the LICENSE file or contact permission@sei.cmu.edu. See 10 : // Contributors.txt for a full list of contributors. Created, in part, with 11 : // funding and support from the U.S. Government (see Acknowledgments.txt file). 12 : // DM22-0790 13 : 14 : // Contributed by Timothy A. Davis, Texas A&M University 15 : 16 : //------------------------------------------------------------------------------ 17 : 18 : #include "LAGraph_test.h" 19 : 20 : //------------------------------------------------------------------------------ 21 : // global variables 22 : //------------------------------------------------------------------------------ 23 : 24 : char msg [LAGRAPH_MSG_LEN] ; 25 : 26 : //------------------------------------------------------------------------------ 27 : // test_Init: test LAGraph_Init 28 : //------------------------------------------------------------------------------ 29 : 30 1 : void test_Init (void) 31 : { 32 : 33 1 : int status = LAGraph_Init (msg) ; 34 1 : OK (status) ; 35 : int ver [3] ; 36 : 37 : #if LAGRAPH_SUITESPARSE 38 : const char *name, *date ; 39 1 : OK (GxB_Global_Option_get (GxB_LIBRARY_NAME, &name)) ; 40 1 : OK (GxB_Global_Option_get (GxB_LIBRARY_DATE, &date)) ; 41 1 : OK (GxB_Global_Option_get (GxB_LIBRARY_VERSION, ver)) ; 42 1 : printf ("\nlibrary: %s %d.%d.%d (%s)\n", name, ver [0], ver [1], ver [2], 43 : date) ; 44 1 : printf ( "include: %s %d.%d.%d (%s)\n", GxB_IMPLEMENTATION_NAME, 45 : GxB_IMPLEMENTATION_MAJOR, GxB_IMPLEMENTATION_MINOR, 46 : GxB_IMPLEMENTATION_SUB, GxB_IMPLEMENTATION_DATE) ; 47 : // make sure the SuiteSparse:GraphBLAS version and date match 48 1 : TEST_CHECK (ver [0] == GxB_IMPLEMENTATION_MAJOR) ; 49 1 : TEST_CHECK (ver [1] == GxB_IMPLEMENTATION_MINOR) ; 50 1 : TEST_CHECK (ver [2] == GxB_IMPLEMENTATION_SUB) ; 51 1 : OK (strcmp (date, GxB_IMPLEMENTATION_DATE)) ; 52 : 53 : #if ( GxB_IMPLEMENTATION_MAJOR >= 7 ) 54 : char *compiler ; 55 : int compiler_version [3] ; 56 1 : OK (GxB_Global_Option_get (GxB_COMPILER_NAME, &compiler)) ; 57 1 : OK (GxB_Global_Option_get (GxB_COMPILER_VERSION, compiler_version)) ; 58 1 : printf ("GraphBLAS compiled with: %s v%d.%d.%d\n", compiler, 59 : compiler_version [0], compiler_version [1], compiler_version [2]) ; 60 : #endif 61 : 62 : #else 63 : printf ("\nVanilla GraphBLAS: no GxB* extensions\n") ; 64 : #endif 65 : 66 : // check the LAGraph version using both LAGraph.h and LAGraph_Version 67 1 : printf ("LAGraph version %d.%d.%d (%s) from LAGraph.h\n", 68 : LAGRAPH_VERSION_MAJOR, LAGRAPH_VERSION_MINOR, LAGRAPH_VERSION_UPDATE, 69 : LAGRAPH_DATE) ; 70 : 71 : char version_date [LAGRAPH_MSG_LEN] ; 72 1 : status = LAGraph_Version (ver, version_date, msg) ; 73 1 : OK (status) ; 74 : 75 1 : printf ("LAGraph version %d.%d.%d (%s) from LAGraph_Version\n", 76 : ver [0], ver [1], ver [2], version_date) ; 77 : 78 : // make sure the LAGraph version and date match 79 1 : TEST_CHECK (ver [0] == LAGRAPH_VERSION_MAJOR) ; 80 1 : TEST_CHECK (ver [1] == LAGRAPH_VERSION_MINOR) ; 81 1 : TEST_CHECK (ver [2] == LAGRAPH_VERSION_UPDATE) ; 82 1 : OK (strcmp (version_date, LAGRAPH_DATE)) ; 83 : 84 1 : OK (LAGraph_Finalize (msg)) ; 85 1 : } 86 : 87 : //----------------------------------------------------------------------------- 88 : // TEST_LIST: the list of tasks for this entire test 89 : //----------------------------------------------------------------------------- 90 : 91 : TEST_LIST = 92 : { 93 : { "Init", test_Init }, 94 : // no brutal test: see test_Xinit 95 : { NULL, NULL } 96 : } ;