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

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LAGraph/src/test/test_NumThreads.c:  test LAGraph_(Get,Set)NumThreads
       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             : int nthreads_outer = 0, nthreads_inner = 0 ;
      25             : char msg [LAGRAPH_MSG_LEN] ;
      26             : 
      27             : //------------------------------------------------------------------------------
      28             : // test_NumThreads:  test LAGraph_GetNumThreads and LAGraph_SetNumThreads
      29             : //------------------------------------------------------------------------------
      30             : 
      31           1 : void test_NumThreads (void)
      32             : {
      33             : 
      34           1 :     OK (LAGraph_Init (msg)) ;
      35             : 
      36           1 :     nthreads_outer = 0 ;
      37           1 :     nthreads_inner = 0 ;
      38           1 :     OK (LAGraph_GetNumThreads (&nthreads_outer, &nthreads_inner, msg)) ;
      39           1 :     TEST_CHECK (nthreads_outer > 0) ;
      40           1 :     TEST_CHECK (nthreads_inner > 0) ;
      41             : 
      42           1 :     nthreads_outer = 0 ;
      43           1 :     nthreads_inner = 0 ;
      44           1 :     OK (LAGraph_GetNumThreads (&nthreads_outer, &nthreads_inner, NULL)) ;
      45           1 :     TEST_CHECK (nthreads_outer > 0) ;
      46           1 :     TEST_CHECK (nthreads_inner > 0) ;
      47             : 
      48           1 :     OK (LAGraph_SetNumThreads (2, 4, msg)) ;
      49           1 :     nthreads_outer = 0 ;
      50           1 :     nthreads_inner = 0 ;
      51           1 :     OK (LAGraph_GetNumThreads (&nthreads_outer, &nthreads_inner, msg)) ;
      52           1 :     TEST_CHECK (nthreads_outer > 0) ;
      53           1 :     TEST_CHECK (nthreads_inner > 0) ;
      54             : 
      55           1 :     OK (LAGraph_SetNumThreads (2, 4, NULL)) ;
      56           1 :     nthreads_outer = 0 ;
      57           1 :     nthreads_inner = 0 ;
      58           1 :     OK (LAGraph_GetNumThreads (&nthreads_outer, &nthreads_inner, NULL)) ;
      59           1 :     TEST_CHECK (nthreads_outer > 0) ;
      60           1 :     TEST_CHECK (nthreads_inner > 0) ;
      61             : 
      62           1 :     TEST_CHECK (LAGraph_GetNumThreads (NULL, NULL, msg) == GrB_NULL_POINTER) ;
      63           1 :     printf ("\nmsg: %s\n", msg) ;
      64             : 
      65           1 :     OK (LAGraph_Finalize (msg)) ;
      66           1 : }
      67             : 
      68             : //-----------------------------------------------------------------------------
      69             : // TEST_LIST: the list of tasks for this entire test
      70             : //-----------------------------------------------------------------------------
      71             : 
      72             : TEST_LIST =
      73             : {
      74             :     { "NumThreads", test_NumThreads },
      75             :     // no brutal test needed
      76             :     { NULL, NULL }
      77             : } ;

Generated by: LCOV version 1.14