From: <net...@us...> - 2003-09-06 21:36:03
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv31393 Modified Files: UnparsedDeclarationMutatorTest.h UnparsedDeclarationMutatorTest.cpp Log Message: -- added test for constructor mutation -- modifications of declaration elements fixed Index: UnparsedDeclarationMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** UnparsedDeclarationMutatorTest.h 16 May 2003 09:59:57 -0000 1.9 --- UnparsedDeclarationMutatorTest.h 6 Sep 2003 21:35:59 -0000 1.10 *************** *** 102,105 **** --- 102,106 ---- void testOperatorMember(); void testEmptyParameterList(); + void testConstructor(); private: Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** UnparsedDeclarationMutatorTest.cpp 16 May 2003 09:59:57 -0000 1.14 --- UnparsedDeclarationMutatorTest.cpp 6 Sep 2003 21:35:59 -0000 1.15 *************** *** 212,217 **** Testing::KeyedString source; source.addKeyed(SPECIFIER,"const") << " "; ! source.setKeyStart(SPECIFIER) << "class x {"; ! source.addKeyed("CLASS-BODY" , " public: int x() { } }" ); source.setKeyEnd(SPECIFIER) << " "; source.addKeyed(DECLARATOR, "y" ) << ";"; --- 212,218 ---- Testing::KeyedString source; source.addKeyed(SPECIFIER,"const") << " "; ! source.setKeyStart(SPECIFIER) << "class "; ! source.addKeyed("CLASS-NAME","x") << " {"; ! source.addKeyed("CLASS-BODY" , " public: int x() { } " ) << "}"; source.setKeyEnd(SPECIFIER) << " "; source.addKeyed(DECLARATOR, "y" ) << ";"; *************** *** 228,232 **** RFTA_ASSERT_NODE_TYPE( specifier, ASTNodeTypes::classSpecifier, "class-specifier" ); ! // CHECK CLASS BODY PROPERTY !! RFTA_ASSERT_NODE_PROPERTY_HAS( specifier, ASTNodeProperties::classBodyProperty, --- 229,241 ---- RFTA_ASSERT_NODE_TYPE( specifier, ASTNodeTypes::classSpecifier, "class-specifier" ); ! // CHECK CLASS NAME PROPERTY: ! RFTA_ASSERT_NODE_PROPERTY_HAS( specifier, ! ASTNodeProperties::classNameProperty, ! ASTNodeTypes::localScopeIdentifier, ! source.getKeyedIndex("CLASS-NAME",0), ! source.getKeyedLen("CLASS-NAME",0) ! ); ! ! // CHECK CLASS BODY PROPERTY: RFTA_ASSERT_NODE_PROPERTY_HAS( specifier, ASTNodeProperties::classBodyProperty, *************** *** 244,248 **** { Testing::KeyedString source; ! source.addKeyed(SPECIFIER , "class x: public std::c1, protected user::c3 { public: int x() { } }" ) << ";"; SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); --- 253,262 ---- { Testing::KeyedString source; ! source.setKeyStart(SPECIFIER) << "class "; ! ! source.addKeyed("CLASS-NAME", "x") << " : "; ! source.addKeyed("CLASS-INHERITANCE","public std::c1, protected user::c3") << " {"; ! source.addKeyed("CLASS-BODY","public: int x() { } " ) << "}"; ! source.setKeyEnd(SPECIFIER) << ";"; SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); *************** *** 254,258 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::classSpecifier, "class-specifier" ); } --- 268,300 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! ASTNodePtr specifier = specifierList->getChildAt(0); ! RFTA_ASSERT_NODE_TYPE( specifier, ASTNodeTypes::classSpecifier, "class-specifier" ); ! ! // CHECK CLASS NAME PROPERTY: ! RFTA_ASSERT_NODE_PROPERTY_HAS( specifier, ! ASTNodeProperties::classNameProperty, ! ASTNodeTypes::localScopeIdentifier, ! source.getKeyedIndex("CLASS-NAME",0), ! source.getKeyedLen("CLASS-NAME",0) ! ); ! ! // CHECK CLASS INHERITANCE PROPERTY: ! /* ! RFTA_ASSERT_NODE_PROPERTY_HAS( specifier, ! ASTNodeProperties::classInheritanceProperty, ! ASTNodeTypes::classInheritanceList, ! source.getKeyedIndex("CLASS-INHERITANCE",0), ! source.getKeyedLen("CLASS-INHERITANCE",0) ! ); ! // subnodes are inheritance elements: "public x", "y", "protected z" etc. ! */ ! ! // CHECK CLASS BODY PROPERTY: ! RFTA_ASSERT_NODE_PROPERTY_HAS( specifier, ! ASTNodeProperties::classBodyProperty, ! ASTNodeTypes::unparsedDeclarationList, ! source.getKeyedIndex("CLASS-BODY",0), ! source.getKeyedLen("CLASS-BODY",0) ! ); } *************** *** 872,875 **** --- 914,935 ---- source.getKeyedLen("PURESPECIFIER",0) ); + } + + void + UnparsedDeclarationMutatorTest::testConstructor() + { + Testing::KeyedString source; + source.addKeyed("DECLARATOR","T()" ) << ";" ; + + source << ";"; + + SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); + ASTNodePtr node = sourceAST->getChildAt(0); + + // check AST: + RFTA_ASSERT_DECLARATION( source, sourceAST ); + + // check declarator types: + RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } |