Line data Source code
1 : //------------------------------------------------------------------------------ 2 : // LAGraph/src/test/test_Init_errors.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_errors: test LAGraph_Init 28 : //------------------------------------------------------------------------------ 29 : 30 1 : void test_Init_errors (void) 31 : { 32 : 33 1 : int status = LAGraph_Init (msg) ; 34 1 : OK (status) ; 35 : int ver [3] ; 36 : 37 : // LAGraph_Init cannot be called twice 38 1 : status = LAGraph_Init (msg) ; 39 1 : printf ("\nstatus: %d msg: %s\n", status, msg) ; 40 1 : TEST_CHECK (status != GrB_SUCCESS) ; 41 : 42 1 : OK (LAGraph_Finalize (msg)) ; 43 : 44 : // calling LAGraph_Finalize twice leads to undefined behavior; 45 : // for SuiteSparse, it returns GrB_SUCCESS 46 1 : status = LAGraph_Finalize (msg) ; 47 1 : printf ("status %d\n", status) ; 48 : #if LAGRAPH_SUITESPARSE 49 1 : TEST_CHECK (status == GrB_SUCCESS) ; 50 : #endif 51 1 : } 52 : 53 : //----------------------------------------------------------------------------- 54 : // TEST_LIST: the list of tasks for this entire test 55 : //----------------------------------------------------------------------------- 56 : 57 : TEST_LIST = 58 : { 59 : { "Init_errors", test_Init_errors }, 60 : // no brutal test: see test_Xinit 61 : { NULL, NULL } 62 : } ;