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: 11 11 100.0 %
Date: 2026-02-11 19:37:54 Functions: 2 2 100.0 %
Branches: 10 14 71.4 %

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

Generated by: LCOV version 1.14