LCOV - code coverage report
Current view: top level - buildbot/coverage/build/test/unit/api/c - capi_kind_black.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2026-09-25 09:51:03 Functions: 4 4 100.0 %
Branches: 21 36 58.3 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * This file is part of the cvc5 project.
       3                 :            :  *
       4                 :            :  * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS
       5                 :            :  * in the top-level source directory and their institutional affiliations.
       6                 :            :  * All rights reserved.  See the file COPYING in the top-level source
       7                 :            :  * directory for licensing information.
       8                 :            :  * ****************************************************************************
       9                 :            :  *
      10                 :            :  * Black box testing of the Cvc5Kind enum of the  C API.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include <cvc5/c/cvc5.h>
      14                 :            : 
      15                 :            : #include "gtest/gtest.h"
      16                 :            : #include "test_capi.h"
      17                 :            : 
      18                 :            : namespace cvc5::internal::test {
      19                 :            : 
      20                 :            : class TestCApiKind : public ::testing::Test
      21                 :            : {
      22                 :            : };
      23                 :            : 
      24                 :          4 : TEST_F(TestCApiKind, kind_to_string)
      25                 :            : {
      26 [ -  + ][ +  - ]:          5 :   ASSERT_CVC5_ERROR(cvc5_kind_to_string(static_cast<Cvc5Kind>(-5)),
         [ -  + ][ +  - ]
         [ +  - ][ +  - ]
      27                 :            :                     "invalid term kind");
      28                 :            : 
      29                 :        297 :   for (int32_t k = static_cast<int32_t>(CVC5_KIND_INTERNAL_KIND);
      30         [ +  + ]:        297 :        k < static_cast<int32_t>(CVC5_KIND_LAST_KIND);
      31                 :            :        ++k)
      32                 :            :   {
      33                 :        296 :     std::string kindstr = cvc5_kind_to_string(static_cast<Cvc5Kind>(k));
      34         [ +  + ]:        296 :     if (k == static_cast<int32_t>(CVC5_KIND_INTERNAL_KIND))
      35                 :            :     {
      36 [ -  + ][ +  - ]:          1 :       ASSERT_EQ(kindstr, "CVC5_KIND_INTERNAL_KIND");
      37                 :            :     }
      38         [ +  + ]:        295 :     else if (k == static_cast<int32_t>(CVC5_KIND_UNDEFINED_KIND))
      39                 :            :     {
      40 [ -  + ][ +  - ]:          1 :       ASSERT_EQ(kindstr, "CVC5_KIND_UNDEFINED_KIND");
      41                 :            :     }
      42                 :            :     else
      43                 :            :     {
      44                 :            :       // If this assertion fails, s_kinds in cvc5.cpp is missing kind k.
      45 [ -  + ][ +  - ]:        294 :       ASSERT_NE(kindstr, "CVC5_KIND_UNDEFINED_KIND");
      46 [ -  + ][ +  - ]:        294 :       ASSERT_NE(kindstr, "CVC5_KIND_INTERNAL_KIND");
      47                 :            :     }
      48         [ +  - ]:        296 :   }
      49                 :            : }
      50                 :            : }  // namespace cvc5::internal::test

Generated by: LCOV version 1.14