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 LFSC proof conversion 11 : : */ 12 : : 13 : : #include <string> 14 : : 15 : : #include "proof/lfsc/lfsc_node_converter.h" 16 : : #include "test.h" 17 : : 18 : : namespace cvc5::internal { 19 : : using namespace cvc5::internal::proof; 20 : : 21 : : namespace test { 22 : : 23 : : class TestLfscNodeConverterBlack : public TestInternal 24 : : { 25 : : }; 26 : : 27 : 4 : TEST_F(TestLfscNodeConverterBlack, ident_sanitize) 28 : : { 29 : : // LFSC does not allow these characters in identifier bodies: "() \t\n\f;" 30 : : // 31 : : // See also: https://github.com/cvc5/LFSC/blob/master/src/lexer.flex#L24 32 : : // 33 : : // We use hex escapes that are valid in Python: 34 : : // https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals 35 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there are spaces"), 36 [ + - ]: 1 : R"x(cvc.there\x20are\x20spaces)x"); 37 [ - + ][ + - ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName(" "), R"x(cvc.\x20\x20)x"); 38 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there\\are\\slashes"), 39 [ + - ]: 1 : R"x(cvc.there\x5care\x5cslashes)x"); 40 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there\nare\nnewlines"), 41 [ + - ]: 1 : R"x(cvc.there\x0aare\x0anewlines)x"); 42 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there\rare\rCRs"), 43 [ + - ]: 1 : "cvc.there\rare\rCRs"); 44 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there\tare\ttabs"), 45 [ + - ]: 1 : R"x(cvc.there\x09are\x09tabs)x"); 46 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there(are(parens"), 47 [ + - ]: 1 : R"x(cvc.there\x28are\x28parens)x"); 48 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there)are)parens"), 49 [ + - ]: 1 : R"x(cvc.there\x29are\x29parens)x"); 50 [ - + ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName("there;are;semis"), 51 [ + - ]: 1 : R"x(cvc.there\x3bare\x3bsemis)x"); 52 [ - + ][ + - ]: 2 : ASSERT_EQ(LfscNodeConverter::getNameForUserName(""), R"x(cvc.)x"); 53 : : } 54 : : 55 : : } // namespace test 56 : : 57 : : } // namespace cvc5::internal