|
From: <net...@us...> - 2003-04-28 20:36:52
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv25086/src/rftaparser
Modified Files:
UnparsedDeclarationMutatorTest.h
UnparsedDeclarationMutatorTest.cpp
Log Message:
-- tests for class body declaration list extensions
Index: UnparsedDeclarationMutatorTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UnparsedDeclarationMutatorTest.h 26 Apr 2003 11:06:25 -0000 1.1
--- UnparsedDeclarationMutatorTest.h 28 Apr 2003 20:36:46 -0000 1.2
***************
*** 42,45 ****
--- 42,49 ----
CPPUNIT_TEST( testStructTypedef );
CPPUNIT_TEST( testTypedefDeclaration );
+ /* class member extensions */
+ CPPUNIT_TEST( testMemberPure );
+ CPPUNIT_TEST( testMemberConstInit );
+ CPPUNIT_TEST( testStructBitfield );
CPPUNIT_TEST_SUITE_END();
***************
*** 79,82 ****
--- 83,89 ----
void testStructTypedef();
void testTypedefDeclaration();
+ void testMemberPure();
+ void testMemberConstInit();
+ void testStructBitfield();
private:
Index: UnparsedDeclarationMutatorTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 11:05:05 -0000 1.4
--- UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 20:36:47 -0000 1.5
***************
*** 218,222 ****
{
Testing::KeyedString source;
! source.addKeyed(SPECIFIER , "class x { public: int x() { } }" ) << " ";
source.addKeyed(DECLARATOR, "y" ) << ";";
--- 218,224 ----
{
Testing::KeyedString source;
! source.setKeyStart(SPECIFIER) << "class x {";
! source.addKeyed("CLASS-BODY" , " public: int x() { } " ) << "}" ;
! source.setKeyEnd(SPECIFIER) << " ";
source.addKeyed(DECLARATOR, "y" ) << ";";
***************
*** 229,233 ****
// check specifier types:
ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty );
! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::classSpecifier );
// check declarator types:
--- 231,244 ----
// check specifier types:
ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty );
! ASTNodePtr specifier = specifierList->getChildAt(0);
! RFTA_ASSERT_NODE_TYPE( specifier, ASTNodeTypes::classSpecifier );
!
! // CHECK CLASS BODY PROPERTY !!
! RFTA_ASSERT_NODE_PROPERTY_HAS( specifier,
! ASTNodeProperties::classBodyProperty,
! ASTNodeTypes::unparsedDeclarationList,
! source.getKeyedIndex("CLASS-BODY",0),
! source.getKeyedLen("CLASS-BODY",0)
! );
// check declarator types:
***************
*** 640,643 ****
--- 651,710 ----
source.addKeyed(SPECIFIER , "typedef" ) << " ";
source.addKeyed(DECLARATOR, "* mystruct" ) << ";";
+
+ 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);
+ }
+
+ void
+ UnparsedDeclarationMutatorTest::testMemberPure()
+ {
+ Testing::KeyedString source;
+ source.addKeyed(SPECIFIER , "virtual" ) << " ";
+ source.addKeyed(SPECIFIER , "const" ) << " ";
+ source.addKeyed(SPECIFIER , "vector<int>" ) << " ";
+ source.addKeyed(DECLARATOR, "& func(class s::t v=0,int i=-1) = 0" ) << ";";
+
+ 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);
+ }
+
+ void
+ UnparsedDeclarationMutatorTest::testMemberConstInit()
+ {
+ Testing::KeyedString source;
+ source.addKeyed(SPECIFIER , "const" ) << " ";
+ source.addKeyed(SPECIFIER , "std::string" ) << " ";
+ source.addKeyed(DECLARATOR, "SPECIFIER = \"hello\"" ) << ",";
+ source.addKeyed(DECLARATOR, "DECL = \"world\"" ) << ";";
+
+ 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);
+ }
+
+ void
+ UnparsedDeclarationMutatorTest::testStructBitfield()
+ {
+ Testing::KeyedString source;
+ source.addKeyed(SPECIFIER , "int" ) << " ";
+ source.addKeyed(DECLARATOR, "bit0: 1 + 2" ) << ",";
+ source.addKeyed(DECLARATOR, "bit1: 25" ) << ";";
SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source );
|