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 Kind enum of the C++ API. 11 : : */ 12 : : 13 : : #include <cvc5/cvc5.h> 14 : : 15 : : #include <algorithm> 16 : : 17 : : #include "base/output.h" 18 : : #include "gtest/gtest.h" 19 : : 20 : : namespace cvc5::internal { 21 : : 22 : : namespace test { 23 : : 24 : : class TestApiKind : public ::testing::Test 25 : : { 26 : : }; 27 : : 28 : 4 : TEST_F(TestApiKind, kindToString) 29 : : { 30 : 297 : for (int32_t k = static_cast<int32_t>(Kind::INTERNAL_KIND); 31 [ + + ]: 297 : k < static_cast<int32_t>(Kind::LAST_KIND); 32 : : ++k) 33 : : { 34 : 296 : auto kindstr = std::to_string(static_cast<Kind>(k)); 35 [ + + ]: 296 : if (k == static_cast<int32_t>(Kind::INTERNAL_KIND)) 36 : : { 37 [ - + ][ + - ]: 1 : ASSERT_EQ(kindstr, "INTERNAL_KIND"); 38 : : } 39 [ + + ]: 295 : else if (k == static_cast<int32_t>(Kind::UNDEFINED_KIND)) 40 : : { 41 [ - + ][ + - ]: 1 : ASSERT_EQ(kindstr, "UNDEFINED_KIND"); 42 : : } 43 : : else 44 : : { 45 : : // If this assertion fails, s_kinds in cvc5.cpp is missing kind k. 46 [ - + ][ + - ]: 294 : ASSERT_NE(kindstr, "UNDEFINED_KIND"); 47 [ - + ][ + - ]: 294 : ASSERT_NE(kindstr, "INTERNAL_KIND"); 48 : : } 49 [ + - ]: 296 : } 50 : : } 51 : : 52 : : } // namespace test 53 : : } // namespace cvc5::internal