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 : #include "LG_internal.h" 20 : 21 : //------------------------------------------------------------------------------ 22 : // global variables 23 : //------------------------------------------------------------------------------ 24 : 25 : char msg [LAGRAPH_MSG_LEN] ; 26 : 27 : //------------------------------------------------------------------------------ 28 : // test_Init: test LAGraph_Init 29 : //------------------------------------------------------------------------------ 30 : 31 1 : void test_Init (void) 32 : { 33 : 34 1 : int status = LAGraph_Init (msg) ; 35 1 : OK (status) ; 36 : int32_t ver [3] ; 37 : char library [256], date [256] ; 38 : 39 1 : OK (GrB_get (GrB_GLOBAL, library, GrB_NAME)) ; 40 1 : OK (GrB_get (GrB_GLOBAL, &(ver [0]), GrB_LIBRARY_VER_MAJOR)) ; 41 1 : OK (GrB_get (GrB_GLOBAL, &(ver [1]), GrB_LIBRARY_VER_MINOR)) ; 42 1 : OK (GrB_get (GrB_GLOBAL, &(ver [2]), GrB_LIBRARY_VER_PATCH)) ; 43 1 : date [0] = '\0' ; 44 1 : OK (LG_GET_LIBRARY_DATE (date)) ; 45 : 46 1 : printf ("\nlibrary: %s %d.%d.%d (%s)\n", library, ver [0], ver [1], ver [2], 47 : date) ; 48 : 49 : #if LAGRAPH_SUITESPARSE 50 1 : printf ( "include: %s %d.%d.%d (%s)\n", GxB_IMPLEMENTATION_NAME, 51 : GxB_IMPLEMENTATION_MAJOR, GxB_IMPLEMENTATION_MINOR, 52 : GxB_IMPLEMENTATION_SUB, GxB_IMPLEMENTATION_DATE) ; 53 : // make sure the SuiteSparse:GraphBLAS version and date match 54 1 : TEST_CHECK (ver [0] == GxB_IMPLEMENTATION_MAJOR) ; 55 1 : TEST_CHECK (ver [1] == GxB_IMPLEMENTATION_MINOR) ; 56 1 : TEST_CHECK (ver [2] == GxB_IMPLEMENTATION_SUB) ; 57 1 : OK (strcmp (date, GxB_IMPLEMENTATION_DATE)) ; 58 : char compiler [1024] ; 59 : int compiler_version [3] ; 60 1 : OK (GrB_Global_get_String (GrB_GLOBAL, compiler, GxB_COMPILER_NAME)) ; 61 1 : OK (GrB_Global_get_VOID (GrB_GLOBAL, (void *) compiler_version, 62 : GxB_COMPILER_VERSION)) ; 63 1 : printf ("GraphBLAS compiled with: %s v%d.%d.%d\n", compiler, 64 : compiler_version [0], compiler_version [1], compiler_version [2]) ; 65 : #endif 66 : 67 : // check the LAGraph version using both LAGraph.h and LAGraph_Version 68 1 : printf ("LAGraph version %d.%d.%d (%s) from LAGraph.h\n", 69 : LAGRAPH_VERSION_MAJOR, LAGRAPH_VERSION_MINOR, LAGRAPH_VERSION_UPDATE, 70 : LAGRAPH_DATE) ; 71 : 72 : char version_date [LAGRAPH_MSG_LEN] ; 73 1 : status = LAGraph_Version (ver, version_date, msg) ; 74 1 : OK (status) ; 75 : 76 1 : printf ("LAGraph version %d.%d.%d (%s) from LAGraph_Version\n", 77 : ver [0], ver [1], ver [2], version_date) ; 78 : 79 : // make sure the LAGraph version and date match 80 1 : TEST_CHECK (ver [0] == LAGRAPH_VERSION_MAJOR) ; 81 1 : TEST_CHECK (ver [1] == LAGRAPH_VERSION_MINOR) ; 82 1 : TEST_CHECK (ver [2] == LAGRAPH_VERSION_UPDATE) ; 83 1 : OK (strcmp (version_date, LAGRAPH_DATE)) ; 84 : 85 1 : OK (LAGraph_Finalize (msg)) ; 86 1 : } 87 : 88 : //----------------------------------------------------------------------------- 89 : // TEST_LIST: the list of tasks for this entire test 90 : //----------------------------------------------------------------------------- 91 : 92 : TEST_LIST = 93 : { 94 : { "Init", test_Init }, 95 : // no brutal test: see test_Xinit 96 : { NULL, NULL } 97 : } ;