LCOV - code coverage report
Current view: top level - autotest/cpp - main_gtest.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 9 15 60.0 %
Date: 2024-11-21 22:18:42 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gtest main
       5             :  * Author:   Even Rouault <even dot rouault at spatialys dot com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 222, Even Rouault <even dot rouault at spatialys dot com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include <locale>
      14             : 
      15             : #include "gdal.h"
      16             : #include "cpl_string.h"
      17             : 
      18             : #include "gtest_include.h"
      19             : 
      20             : // So argc, argv can be used from test fixtures
      21             : int global_argc = 0;
      22             : char **global_argv = nullptr;
      23             : 
      24          19 : GTEST_API_ int main(int argc, char **argv)
      25             : {
      26             :     // Use a potentially non-C locale to make sure we are robust
      27          19 :     setlocale(LC_ALL, "");
      28             : 
      29          19 :     argc = GDALGeneralCmdLineProcessor(argc, &argv, 0);
      30             : 
      31             :     int nRetCode;
      32             :     try
      33             :     {
      34          19 :         testing::InitGoogleTest(&argc, argv);
      35             : 
      36          19 :         global_argc = argc;
      37          19 :         global_argv = argv;
      38             : 
      39          19 :         nRetCode = RUN_ALL_TESTS();
      40             :     }
      41           0 :     catch (const std::exception &e)
      42             :     {
      43           0 :         nRetCode = 1;
      44           0 :         fprintf(stderr, "Caught exception %s\n", e.what());
      45             :     }
      46           0 :     catch (...)
      47             :     {
      48           0 :         nRetCode = 1;
      49           0 :         fprintf(stderr, "Caught exception of unknown type\n");
      50             :     }
      51             : 
      52          19 :     CSLDestroy(argv);
      53             : 
      54          19 :     return nRetCode;
      55             : }

Generated by: LCOV version 1.14