LCOV - code coverage report
Current view: top level - src/test - LG_check_vector.c (source / functions) Hit Total Coverage
Test: LAGraph code coverage report. Commit id: cc56ed4. Current time (UTC): 2024-08-30T17:14:30Z Lines: 9 9 100.0 %
Date: 2024-08-30 17:16:41 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LAGraph/src/test/LG_check_vector: extract contents of a vector, for testing
       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             : // This is slow, for testing only.
      19             : // See src/test/test_vector for the brutal test.
      20             : 
      21             : #include "LG_internal.h"
      22             : #include "LG_test.h"
      23             : 
      24        2219 : int LG_check_vector
      25             : (
      26             :     int64_t *x,         // x (0:n-1) = X (0:n-1), of type int64_t
      27             :     GrB_Vector X,       // vector of size n
      28             :     int64_t n,
      29             :     int64_t missing     // value to assign to x(i) if X(i) is not present
      30             : )
      31             : {
      32             : 
      33      458629 :     for (int64_t i = 0 ; i < n ; i++)
      34             :     {
      35             :         int64_t t ;
      36      456419 :         int info = GrB_Vector_extractElement_INT64 (&t, X, i) ;
      37      456419 :         x [i] = missing ;
      38      456419 :         if (info == GrB_SUCCESS)
      39             :         {
      40      433322 :             x [i] = t ;
      41             :         }
      42       23097 :         else if (info != GrB_NO_VALUE)
      43             :         {
      44           9 :             return (info) ;
      45             :         }
      46             :     }
      47        2210 :     return (GrB_SUCCESS) ;
      48             : }

Generated by: LCOV version 1.14