LCOV - code coverage report
Current view: top level - src/utility - LAGraph_Version.c (source / functions) Hit Total Coverage
Test: LAGraph code coverage report. Commit id: 3b461aa. Current time (UTC): 2024-01-25T16:04:32Z Lines: 9 9 100.0 %
Date: 2024-01-25 16:05:28 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LAGraph_Version: return the LAGraph version number and date
       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             : // The version number and date can also be obtained via compile-time constants
      19             : // from LAGraph.h.  However, it is possible to compile a user application that
      20             : // #includes one version of LAGraph.h and then links with another version of
      21             : // the LAGraph library later on, so the version number and date may differ from
      22             : // the compile-time constants.
      23             : 
      24             : // The LAGraph_Version method allows the library itself to be
      25             : // queried, after it is linked in with the user application.
      26             : 
      27             : // The version_number array is set to LAGRAPH_VERSION_MAJOR,
      28             : // LAGRAPH_VERSION_MINOR, and LAGRAPH_VERSION_UPDATE, in that order.
      29             : // The LAGRAPH_DATE string is copied into the user-provided version_date
      30             : // string, and is null-terminated.
      31             : 
      32             : #include "LG_internal.h"
      33             : 
      34           1 : int LAGraph_Version
      35             : (
      36             :     // output:
      37             :     int version_number [3],     // user-provided array of size 3
      38             :     char version_date [LAGRAPH_MSG_LEN],    // user-provided array
      39             :     char *msg
      40             : )
      41             : {
      42             : 
      43           1 :     LG_CLEAR_MSG ;
      44             : 
      45             :     // check inputs
      46           1 :     LG_ASSERT (version_number != NULL && version_date != NULL,
      47             :         GrB_NULL_POINTER) ;
      48             : 
      49             :     // get version number and date
      50           1 :     version_number [0] = LAGRAPH_VERSION_MAJOR ;
      51           1 :     version_number [1] = LAGRAPH_VERSION_MINOR ;
      52           1 :     version_number [2] = LAGRAPH_VERSION_UPDATE ;
      53           1 :     strncpy (version_date, LAGRAPH_DATE, LAGRAPH_MSG_LEN) ;
      54             : 
      55             :     // make sure the date is null-terminated
      56           1 :     version_date [LAGRAPH_MSG_LEN-1] = '\0' ;
      57             : 
      58           1 :     return (GrB_SUCCESS) ;
      59             : }

Generated by: LCOV version 1.14