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 : : 17 : : namespace cvc5::internal::test { 18 : : 19 : : class TestCApiKind : public ::testing::Test 20 : : { 21 : : }; 22 : : 23 : 6 : TEST_F(TestCApiKind, kind_to_string) 24 : : { 25 : 2 : ASSERT_DEATH(cvc5_kind_to_string(static_cast<Cvc5Kind>(-5)), 26 : : "invalid term kind"); 27 : : 28 : 297 : for (int32_t k = static_cast<int32_t>(CVC5_KIND_INTERNAL_KIND); 29 [ + + ]: 297 : k < static_cast<int32_t>(CVC5_KIND_LAST_KIND); 30 : : ++k) 31 : : { 32 : 296 : std::string kindstr = cvc5_kind_to_string(static_cast<Cvc5Kind>(k)); 33 [ + + ]: 296 : if (k == static_cast<int32_t>(CVC5_KIND_INTERNAL_KIND)) 34 : : { 35 [ - + ][ + - ]: 1 : ASSERT_EQ(kindstr, "CVC5_KIND_INTERNAL_KIND"); 36 : : } 37 [ + + ]: 295 : else if (k == static_cast<int32_t>(CVC5_KIND_UNDEFINED_KIND)) 38 : : { 39 [ - + ][ + - ]: 1 : ASSERT_EQ(kindstr, "CVC5_KIND_UNDEFINED_KIND"); 40 : : } 41 : : else 42 : : { 43 : : // If this assertion fails, s_kinds in cvc5.cpp is missing kind k. 44 [ - + ][ + - ]: 294 : ASSERT_NE(kindstr, "CVC5_KIND_UNDEFINED_KIND"); 45 [ - + ][ + - ]: 294 : ASSERT_NE(kindstr, "CVC5_KIND_INTERNAL_KIND"); 46 : : } 47 [ + - ]: 296 : } 48 : : } 49 : : } // namespace cvc5::internal::test