LCOV - code coverage report
Current view: top level - sys/tests - test3.c (source / functions) Hit Total Coverage
Test: SLEPc Lines: 13 13 100.0 %
Date: 2024-11-21 00:40:22 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       3             :    SLEPc - Scalable Library for Eigenvalue Problem Computations
       4             :    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
       5             : 
       6             :    This file is part of SLEPc.
       7             :    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
       8             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       9             : */
      10             : 
      11             : static char help[] = "Tests SlepcHasExternalPackage().\n\n";
      12             : 
      13             : #include <slepcsys.h>
      14             : 
      15           2 : int main(int argc,char **argv)
      16             : {
      17           2 :   char           pkg[128] = "arpack";
      18           2 :   PetscBool      has,flg;
      19             : 
      20           2 :   PetscFunctionBeginUser;
      21           2 :   PetscCall(SlepcInitialize(&argc,&argv,NULL,help));
      22           2 :   PetscCall(PetscOptionsGetString(NULL,NULL,"-pkg",pkg,sizeof(pkg),NULL));
      23           2 :   PetscCall(SlepcHasExternalPackage(pkg,&has));
      24           2 :   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "SLEPc has %s? %s\n",pkg,PetscBools[has]));
      25           2 :   PetscCall(PetscStrcmp(pkg,"arpack",&flg));
      26             : #if defined(SLEPC_HAVE_ARPACK)
      27           2 :   PetscCheck(!flg || has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says ARPACK is not configured but SLEPC_HAVE_ARPACK is defined");
      28             : #else
      29             :   PetscCheck(!flg || !has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says ARPACK is configured but SLEPC_HAVE_ARPACK is undefined");
      30             : #endif
      31           2 :   PetscCall(PetscStrcmp(pkg,"primme",&flg));
      32             : #if defined(SLEPC_HAVE_PRIMME)
      33           2 :   PetscCheck(!flg || has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says PRIMME is not configured but SLEPC_HAVE_PRIMME is defined");
      34             : #else
      35             :   PetscCheck(!flg || !has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says PRIMME is configured but SLEPC_HAVE_PRIMME is undefined");
      36             : #endif
      37           2 :   PetscCall(SlepcFinalize());
      38             :   return 0;
      39             : }
      40             : 
      41             : /*TEST
      42             : 
      43             :    test:
      44             :       suffix: arpack
      45             :       args: -pkg arpack
      46             :       requires: arpack
      47             :    test:
      48             :       suffix: no-arpack
      49             :       args: -pkg arpack
      50             :       requires: !arpack
      51             :    test:
      52             :       suffix: primme
      53             :       args: -pkg primme
      54             :       requires: primme
      55             :    test:
      56             :       suffix: no-primme
      57             :       args: -pkg primme
      58             :       requires: !primme
      59             : 
      60             : TEST*/

Generated by: LCOV version 1.14