You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(15) |
Feb
(26) |
Mar
(97) |
Apr
(224) |
May
(226) |
Jun
|
Jul
(3) |
Aug
(22) |
Sep
(48) |
Oct
|
Nov
|
Dec
(38) |
2004 |
Jan
(28) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(37) |
Jul
|
Aug
(73) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <net...@us...> - 2003-04-28 20:53:25
|
Update of /cvsroot/cpptool/rfta/src/astdumper In directory sc8-pr-cvs1:/tmp/cvs-serv1964/src/astdumper Modified Files: ASTDumper.cpp Log Message: -- ast dumper for File-Level-Parsing Index: ASTDumper.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASTDumper.cpp 1 Apr 2003 08:29:05 -0000 1.5 --- ASTDumper.cpp 28 Apr 2003 20:53:20 -0000 1.6 *************** *** 16,20 **** #include <rfta/parser/ParserError.h> #include <rfta/parser/SourceASTNode.h> ! #include <rfta/parser/StatementsParser.h> --- 16,20 ---- #include <rfta/parser/ParserError.h> #include <rfta/parser/SourceASTNode.h> ! #include <rfta/parser/DeclarationListParser.h> *************** *** 180,186 **** SourceASTNodePtr sourceAST = SourceASTNode::create( blankedSource, source ); ParseContext context( sourceAST ); ! StatementsParser parser( context, ! sourceAST->getBlankedSourceStart(), ! sourceAST->getBlankedSourceEnd() ); try --- 180,186 ---- SourceASTNodePtr sourceAST = SourceASTNode::create( blankedSource, source ); ParseContext context( sourceAST ); ! DeclarationListParser parser( context, ! sourceAST->getBlankedSourceStart(), ! sourceAST->getBlankedSourceEnd() ); try |
From: <net...@us...> - 2003-04-28 20:41:41
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv27340/src/rftaparser Modified Files: ASTNodes.cpp Log Message: -- extensions for class body Index: ASTNodes.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ASTNodes.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ASTNodes.cpp 26 Apr 2003 10:47:00 -0000 1.19 --- ASTNodes.cpp 28 Apr 2003 20:41:35 -0000 1.20 *************** *** 113,116 **** --- 113,118 ---- /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::declarationSpecifiersProperty( "declaration-specifiers-property" ); + /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::enumBodyProperty ( "enumeration-body-property" ); + /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::classBodyProperty( "class-body-property" ); } // namespace Refactoring |
From: <net...@us...> - 2003-04-28 20:41:40
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv27340/include/rfta/parser Modified Files: ASTNodes.h Log Message: -- extensions for class body Index: ASTNodes.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ASTNodes.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ASTNodes.h 26 Apr 2003 10:46:59 -0000 1.17 --- ASTNodes.h 28 Apr 2003 20:41:35 -0000 1.18 *************** *** 225,228 **** --- 225,230 ---- static const ASTNodeProperty declarationSpecifiersProperty; + static const ASTNodeProperty enumBodyProperty; + static const ASTNodeProperty classBodyProperty; }; |
From: <net...@us...> - 2003-04-28 20:41:19
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv27192/src/rftaparser Modified Files: DeclarationListParser.cpp Log Message: -- extensions for class body parsing Index: DeclarationListParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationListParser.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeclarationListParser.cpp 14 Apr 2003 19:46:11 -0000 1.3 --- DeclarationListParser.cpp 28 Apr 2003 20:41:15 -0000 1.4 *************** *** 11,14 **** --- 11,16 ---- #include <rfta/parser/ParseContext.h> #include <stdexcept> + #include <rfta/parser/ParserTools.h> + #include <set> *************** *** 39,48 **** Tracker tracker( "DeclarationListParser::tryParse", *this ); do { skipSpaces(); if (!hasNext()) break; DeclarationParser parser(context_, current_ , end_ ); ! if (!parser.tryParse()) break; current_ = parser.getCurrent(); --- 41,73 ---- Tracker tracker( "DeclarationListParser::tryParse", *this ); + std::set< std::string > keywords; + + keywords.insert( "public" ); + keywords.insert( "private" ); + keywords.insert( "protected" ); + keywords.insert( "signal" ); + do { skipSpaces(); if (!hasNext()) break; + Xtl::CStringEnumerator en(Xtl::CStringView( current_, end_ ).enumerate() ); + std::string ident; + + ident = ParserTools::tryReadKeyword(en,keywords); + if (!ident.empty()) + { + ParserTools::skipUntil(en,':'); + // @todo: store information on visibility + current_ = en.getCurrentPos(); + skipSpaces(); + } + DeclarationParser parser(context_, current_ , end_ ); ! if (!parser.tryParse()) ! { ! current_ = parser.getCurrent(); ! break; // no more declaration, stop parsing here ! } current_ = parser.getCurrent(); *************** *** 50,54 **** } while ( current_ < end_ ); ! return true; } --- 75,79 ---- } while ( current_ < end_ ); ! return current_ == end_; } |
From: <net...@us...> - 2003-04-28 20:40:22
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv26752/src/rftaparser Modified Files: DeclarationParser.cpp Log Message: -- bug fixes found while class body parsing tests Index: DeclarationParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParser.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DeclarationParser.cpp 26 Apr 2003 10:50:17 -0000 1.4 --- DeclarationParser.cpp 28 Apr 2003 20:40:13 -0000 1.5 *************** *** 44,56 **** int start_difference = current_ - start_; ASTNodePtr declarationNode = createASTNode( ASTNodeTypes::unparsedDeclaration, getParentNode(), ! getCurrentIndex(), ! getCurrentLength() ); context_.addNode( declarationNode ); - - const char * rollback = current_; - readUntilNextOf(";={"); // check for the most simple case: --- 44,59 ---- int start_difference = current_ - start_; + int startIndex = getCurrentIndex(); + const char * rollback = current_; + readUntilNextOf(";={"); + if (current_ == end_) + return false; + ASTNodePtr declarationNode = createASTNode( ASTNodeTypes::unparsedDeclaration, getParentNode(), ! startIndex, ! 0 ); context_.addNode( declarationNode ); // check for the most simple case: |
From: <net...@us...> - 2003-04-28 20:39:18
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv26301/src/rftaparser Modified Files: Parser.cpp Log Message: -- bug fixes found while class body parsing tests Index: Parser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/Parser.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Parser.cpp 26 Apr 2003 21:11:30 -0000 1.8 --- Parser.cpp 28 Apr 2003 20:39:14 -0000 1.9 *************** *** 225,233 **** int idx = 0; if (s.empty()) return true; while ( hasNext() && idx<s.length() && *current_ == s[idx] ) { ++idx; ++current_; } ! return idx==s.length(); } --- 225,240 ---- int idx = 0; if (s.empty()) return true; + const char * rollback = current_; + while ( hasNext() && idx<s.length() && *current_ == s[idx] ) { ++idx; ++current_; } ! if (idx!=s.length()) ! { ! current_=rollback; ! return false; ! } else ! return true; } |
From: <net...@us...> - 2003-04-28 20:38:32
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv25925/src/rftaparser Modified Files: UnparsedDeclarationListMutatorTest.h UnparsedDeclarationListMutatorTest.cpp Log Message: -- additional test for class body declaration list parsing Index: UnparsedDeclarationListMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationListMutatorTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnparsedDeclarationListMutatorTest.h 15 Apr 2003 19:04:20 -0000 1.1 --- UnparsedDeclarationListMutatorTest.h 28 Apr 2003 20:38:27 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- CPPUNIT_TEST_SUITE( UnparsedDeclarationListMutatorTest ); CPPUNIT_TEST( testMutate ); + CPPUNIT_TEST( testClassParse ); CPPUNIT_TEST_SUITE_END(); *************** *** 33,36 **** --- 34,38 ---- void testMutate(); + void testClassParse(); private: Index: UnparsedDeclarationListMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationListMutatorTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnparsedDeclarationListMutatorTest.cpp 15 Apr 2003 19:04:20 -0000 1.1 --- UnparsedDeclarationListMutatorTest.cpp 28 Apr 2003 20:38:28 -0000 1.2 *************** *** 7,11 **** --- 7,14 ---- #include "stdafx.h" #include "UnparsedDeclarationListMutator.h" + #include "UnparsedDeclarationMutator.h" #include "NamespaceParser.h" + #include "KeyedString.h" + #include <rfta/parser/DeclarationParser.h> #include "UnparsedDeclarationListMutatorTest.h" #include <rfta/parser/ASTNode.h> *************** *** 78,81 **** --- 81,164 ---- 29); RFTA_ASSERT_EQUAL( 2, namespaceNode->getProperty(ASTNodeProperties::namespaceBodyProperty)->getChildCount() ); + + } + + void + UnparsedDeclarationListMutatorTest::testClassParse() + { + /* precreate a AST with a unparsed declaration list: */ + + Testing::KeyedString source; + source << "class y {"; + source.setKeyStart("CLASS-BODY") << " "; + source.addKeyed("MEMBER", "int x;") << " "; + source << "public: "; + source.addKeyed("MEMBER", "virtual int func(int) = 0;") << " "; + source << "private: "; + source.addKeyed("MEMBER", "int fc2() { return 0; }") << " "; + source << "protected: signal:"; + source.setKeyEnd("CLASS-BODY"); + source << "};"; + + SourceASTNodePtr sourceNode = SourceASTNode::create( source, source ); + + // parse declaration: + ParseContext context(sourceNode); + DeclarationParser parser(context, sourceNode->getBlankedSourceStart(), sourceNode->getBlankedSourceEnd()); + parser.tryParse(); + + // mutate declaration: + ASTNodePtr classNode = sourceNode->getChildAt(0); + + // do variable declaration parsing + UnparsedDeclarationMutator mutator( context, + classNode, + sourceNode ); + + CppUnit::Message message( "mutator failed", + "Source:\n" + source.asString() ); + CppUnit::Asserter::failIf( !mutator.tryMutate(), message, CPPUNIT_SOURCELINE() ); + + + // check precondition for test: + RFTA_ASSERT_NODE_PROPERTY_HAS( classNode, + ASTNodeProperties::declarationSpecifiersProperty, + ASTNodeTypes::declarationSpecifierList, + 0, + source.length()-1 ); + + ASTNodePtr specifierList = classNode->getProperty(ASTNodeProperties::declarationSpecifiersProperty); + ASTNodePtr classSpecifier = specifierList->getChildAt(0); + + RFTA_ASSERT_NODE_PROPERTY_HAS( classSpecifier, + ASTNodeProperties::classBodyProperty, + ASTNodeTypes::unparsedDeclarationList, + source.getKeyedIndex("CLASS-BODY",0), + source.getKeyedLen("CLASS-BODY",0) ); + + ASTNodePtr classBody = classSpecifier->getProperty( ASTNodeProperties::classBodyProperty ); + + // execute mutator test: + UnparsedDeclarationListMutator listmutator; + listmutator.mutate( classBody, sourceNode ); + + // check parsing results: + // check post condition: + RFTA_ASSERT_NODE_TYPE( classBody, ASTNodeTypes::declarationList ); + RFTA_ASSERT_EQUAL( 3, classBody->getChildCount() ); + + RFTA_ASSERT_NODE_HAS( classBody->getChildAt(0), + ASTNodeTypes::unparsedDeclaration, + source.getKeyedIndex("MEMBER",0), + source.getKeyedLen("MEMBER",0) ); + RFTA_ASSERT_NODE_HAS( classBody->getChildAt(1), + ASTNodeTypes::unparsedDeclaration, + source.getKeyedIndex("MEMBER",1), + source.getKeyedLen("MEMBER",1) ); + RFTA_ASSERT_NODE_HAS( classBody->getChildAt(2), + ASTNodeTypes::functionImplementation, + source.getKeyedIndex("MEMBER",2), + source.getKeyedLen("MEMBER",2) ); + } |
From: <net...@us...> - 2003-04-28 20:38:00
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv25656/src/rftaparser Modified Files: UnparsedDeclarationMutator.cpp Log Message: -- bug fixes found while class body parsing tests Index: UnparsedDeclarationMutator.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutator.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UnparsedDeclarationMutator.cpp 28 Apr 2003 02:45:42 -0000 1.2 --- UnparsedDeclarationMutator.cpp 28 Apr 2003 20:37:54 -0000 1.3 *************** *** 239,243 **** { // yes it's - so parse the class specifier ! if (specifierIdent == "class" || specifierIdent == "struct") { --- 239,243 ---- { // yes it's - so parse the class specifier ! if (specifierIdent == "class" || specifierIdent == "struct" || specifierIdent == "union") { *************** *** 289,295 **** { // the 'typename_' might be a userdefined type or a declarator ! // here we try to find out: ! const char * rollback = current_; ! if (typename_ == "operator") return false; --- 289,293 ---- { // the 'typename_' might be a userdefined type or a declarator ! // here we try to find out: if (typename_ == "operator") return false; *************** *** 301,310 **** { if (!tryNextIs(':')) ! throwFailure("Declaration parser expects '::' in this context."); typename_.append("::"); ! readNestedName(typename_); skipSpaces(); } // now check for template declaration: if (tryNextIs('<')) // the use of a template type --- 299,314 ---- { if (!tryNextIs(':')) ! { ! --current_; ! return false; // it's not "::" - might be the bitfield operator (e.g. "int myvar:0") ! } typename_.append("::"); ! readNestedName(typename_); skipSpaces(); } + // do some look ahead for the decision (store rollback position + const char * rollback = current_; + // now check for template declaration: if (tryNextIs('<')) // the use of a template type *************** *** 364,368 **** { if (!tryNextIs(':')) ! throwFailure( "Expected a double colon => '::'." ); fullName.append("::"); --- 368,375 ---- { if (!tryNextIs(':')) ! { ! --current_; ! return; // // it's not a "::" - might be the bitfield operator (e.g. "int myvar::sub :0") ! } fullName.append("::"); *************** *** 378,393 **** UnparsedDeclarationMutator::readClassOrEnumSpecifier(ASTNodePtr& specifier, std::string keyword, std::string name) { ! if (keyword == "class" || keyword == "struct" ) { // read over possible inheritance information ! readUntilNextOf("{"); current_++; } else { specifier->mutateType( ASTNodeTypes::enumSpecifier ); expect('{'); - } findNextBalanced('{','}'); } --- 385,419 ---- UnparsedDeclarationMutator::readClassOrEnumSpecifier(ASTNodePtr& specifier, std::string keyword, std::string name) { ! ASTNodePtr body; ! int startIndex; ! ! if (keyword == "class" || keyword == "struct" || keyword == "union") { // read over possible inheritance information ! readUntilNextOf("{"); current_++; + + body = createASTNode( + ASTNodeTypes::unparsedDeclarationList, + specifier, + startIndex = getCurrentIndex(), + getCurrentLength() + ); + specifier->setPropertyNode( ASTNodeProperties::classBodyProperty , body ); } else { specifier->mutateType( ASTNodeTypes::enumSpecifier ); expect('{'); + body = createASTNode( + ASTNodeTypes::unparsedDeclarationList, + specifier, + startIndex = getCurrentIndex(), + getCurrentLength() + ); + specifier->setPropertyNode( ASTNodeProperties::enumBodyProperty , body ); + } findNextBalanced('{','}'); + body->setLength(getCurrentLength() - startIndex - 1 ); // do not count the last '}' } *************** *** 535,538 **** --- 561,572 ---- nestedName.append("::"); readNestedName(identifier); + } + + // check for bitfield expression + if (tryNextIs(':')) + { + if (!skipOverAssignmentInitializer()) + throwFailure("Constant expression is not well formed."); + // @todo: store bit field expression } continue; |
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 ); |
From: <net...@us...> - 2003-04-28 11:13:20
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv13161/src/rftaparser Modified Files: rftaparser.dsp Log Message: -- tests for parser tools Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** rftaparser.dsp 28 Apr 2003 08:53:20 -0000 1.43 --- rftaparser.dsp 28 Apr 2003 11:13:16 -0000 1.44 *************** *** 1266,1269 **** --- 1266,1277 ---- # Begin Source File + SOURCE=.\ParserToolsTest.cpp + # End Source File + # Begin Source File + + SOURCE=.\ParserToolsTest.h + # End Source File + # Begin Source File + SOURCE=.\SourceRangeTest.cpp |
From: <net...@us...> - 2003-04-28 11:08:43
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv11396/src/rftaparser Added Files: ParserToolsTest.h ParserToolsTest.cpp Log Message: -- tests for parser tools --- NEW FILE: ParserToolsTest.h --- // ////////////////////////////////////////////////////////////////////////// // Header file ParserToolsTest.h for class ParserToolsTest // (c)Copyright 2003, Andre Baresel // Created: 2003/04/28 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_PARSERTOOLSTEST_H #define RFTA_PARSERTOOLSTEST_H #include "UnitTesting.h" #include <rfta/parser/ParserTools.h> namespace Refactoring { /// Unit tests for ParserToolsTest class ParserToolsTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( ParserToolsTest ); CPPUNIT_TEST( testTryReadIdentifier ); CPPUNIT_TEST( testTryReadKeyword ); CPPUNIT_TEST_SUITE_END(); public: /*! Constructs a ParseContextTest object. */ ParserToolsTest(); /// Destructor. virtual ~ParserToolsTest(); void setUp(); void tearDown(); void testTryReadIdentifier(); void testTryReadKeyword(); private: /// Prevents the use of the copy constructor. ParserToolsTest( const ParserToolsTest &other ); /// Prevents the use of the copy operator. void operator =( const ParserToolsTest &other ); private: }; // Inlines methods for ParserToolsTest: // ------------------------------------- } // namespace Refactoring #endif // RFTA_PARSERTOOLSTEST_H --- NEW FILE: ParserToolsTest.cpp --- // ////////////////////////////////////////////////////////////////////////// // Implementation file ParserToolsTest.cpp for class ParserToolsTest // (c)Copyright 2003, Andre Baresel. // Created: 2003/04/28 // ////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ParserToolsTest.h" namespace Refactoring { RFTAPARSER_TEST_SUITE_REGISTRATION( ParserToolsTest ); ParserToolsTest::ParserToolsTest() { } ParserToolsTest::~ParserToolsTest() { } void ParserToolsTest::setUp() { } void ParserToolsTest::tearDown() { } void ParserToolsTest::testTryReadIdentifier() { const char * textbeg = "this * is a test"; const char * textend = textbeg + strlen(textbeg); Xtl::CStringView cv ( textbeg, textend ); Xtl::CStringView ident; Xtl::CStringEnumerator en = cv.enumerate(); CPPUNIT_ASSERT( ParserTools::tryReadIdentifier( en, ident ) ); CPPUNIT_ASSERT( ident.str() == "this" ); en = Xtl::CStringEnumerator( Xtl::CStringView( en.getCurrentPos()+1, textend ).enumerate() ); CPPUNIT_ASSERT( !ParserTools::tryReadIdentifier( en , ident ) ); en = Xtl::CStringEnumerator( Xtl::CStringView( en.getCurrentPos()+2, textend ).enumerate() ); CPPUNIT_ASSERT( ParserTools::tryReadIdentifier( en, ident ) ); CPPUNIT_ASSERT( ident.str() == "is" ); en = Xtl::CStringEnumerator( Xtl::CStringView( en.getCurrentPos()+1, textend ).enumerate() ); CPPUNIT_ASSERT( ParserTools::tryReadIdentifier( en, ident ) ); CPPUNIT_ASSERT( ident.str() == "a" ); } void ParserToolsTest::testTryReadKeyword() { const char * textbeg = "this * is a test"; const char * textend = textbeg + strlen(textbeg); Xtl::CStringView cv ( textbeg, textend ); std::set< std::string > keywords; keywords.insert("do"); keywords.insert("you"); keywords.insert("want"); keywords.insert("this"); // check keyword "this" Xtl::CStringEnumerator en = cv.enumerate(); std::string ident = ParserTools::tryReadKeyword( en, keywords ); CPPUNIT_ASSERT( ident == "this" ); // check non an identifier en = Xtl::CStringEnumerator( Xtl::CStringView( en.getCurrentPos(), textend ).enumerate() ); ident = ParserTools::tryReadKeyword( en, keywords ); CPPUNIT_ASSERT( ident.empty() ); // check not registered en = Xtl::CStringEnumerator( Xtl::CStringView( en.getCurrentPos()+3, textend ).enumerate() ); ident = ParserTools::tryReadKeyword( en, keywords ); CPPUNIT_ASSERT( ident.empty() ); } } // namespace Refactoring |
From: <net...@us...> - 2003-04-28 11:05:23
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv10023/src/rftaparser Modified Files: KeyedString.h Log Message: -- code cleanup Index: KeyedString.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/KeyedString.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** KeyedString.h 28 Apr 2003 02:45:01 -0000 1.1 --- KeyedString.h 28 Apr 2003 11:05:20 -0000 1.2 *************** *** 23,28 **** --- 23,32 ---- std::vector<int> getKeyedIndex(std::string key) const; std::vector<int> getKeyedLen(std::string key) const; + int getKeyedIndex(std::string key,int index) const; + int getKeyedLen(std::string key,int index) const; std::string getWord(std::string key, int index) const; int length() const; + KeyedString& setKeyStart(std::string key); + KeyedString& setKeyEnd(std::string key); protected: std::string sequence_; *************** *** 66,74 **** } inline std::string KeyedString::getWord(std::string key, int index) const { std::map<std::string,std::vector<std::string> >::const_iterator it; it = word_.find(key); ! if (it == word_.end()) return std::string(); return ((*it).second)[index]; } --- 70,100 ---- } + inline int KeyedString::getKeyedIndex(std::string key, int index) const + { + std::map<std::string,std::vector<int> >::const_iterator it; + it = wordIndex_.find(key); + if (it == wordIndex_.end()) throw std::logic_error("No string registered for this key."); + if ((*it).second.size()<index) throw std::logic_error("Index out of range."); + return (*it).second[index]; + } + + inline int KeyedString::getKeyedLen(std::string key, int index) const + { + std::map<std::string,std::vector<int> >::const_iterator it; + it = wordLen_.find(key); + if (it == wordLen_.end()) throw std::logic_error("No string registered for this key."); + if ((*it).second.size()<index) throw std::logic_error("Index out of range."); + return (*it).second[index]; + } + inline std::string KeyedString::getWord(std::string key, int index) const { std::map<std::string,std::vector<std::string> >::const_iterator it; it = word_.find(key); ! if (it == word_.end()) ! throw std::logic_error("No string registered for this key."); ! if ((*it).second.size() < index) ! throw std::logic_error("Index out of range."); ! return ((*it).second)[index]; } *************** *** 86,89 **** --- 112,135 ---- { return sequence_.length(); + } + + inline KeyedString& KeyedString::setKeyStart(std::string key) + { + wordIndex_[key].push_back(sequence_.length()); + wordLen_[key].push_back(0); + word_[key].push_back(""); + return *this; + } + + inline KeyedString& KeyedString::setKeyEnd(std::string key) + { + std::vector<int>& v1_ref = wordIndex_[key]; + std::vector<int>& v2_ref = wordLen_[key]; + if ( v1_ref.empty() || v2_ref.empty() || v2_ref.size() != v1_ref.size() ) + throw std::logic_error("Key was not initialized correctly."); + + int idx = v1_ref.size()-1; + v2_ref[idx] = sequence_.length() - v1_ref[idx]; + return *this; } |
From: <net...@us...> - 2003-04-28 11:05:12
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv9906/src/rftaparser Modified Files: UnparsedDeclarationMutatorTest.cpp Log Message: -- code cleanup Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 02:52:50 -0000 1.3 --- UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 11:05:05 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- const std::string SPECIFIER = "SPECIFIER"; const std::string DECLARATOR = "DECLARATOR"; + const std::string SPECIFIERLIST = "SPECIFIERLIST"; namespace Testing *************** *** 77,88 **** if (specifierCount>0) checkASTNodePropertyHas( node, ASTNodeProperties::declarationSpecifiersProperty, ASTNodeTypes::declarationSpecifierList, ! specifierStart[0], ! specifierLen[specifierCount-1]+specifierStart[specifierCount-1]-specifierStart[0], sourceLine, "SpecifierList=> ASTNodeProperties::declarationSpecifiersProperty" ); ASTNodePtr specifierList = node->getProperty(ASTNodeProperties::declarationSpecifiersProperty); --- 78,103 ---- if (specifierCount>0) + { + int spec_list_index; + int spec_list_len; + try { + spec_list_index = source.getKeyedIndex(SPECIFIERLIST,0); + spec_list_len = source.getKeyedLen(SPECIFIERLIST,0); + } + catch (std::logic_error e) + { + spec_list_index = specifierStart[0]; + spec_list_len = specifierStart[specifierStart.size()-1] + specifierLen[specifierLen.size()-1] - specifierStart[0]; + } + checkASTNodePropertyHas( node, ASTNodeProperties::declarationSpecifiersProperty, ASTNodeTypes::declarationSpecifierList, ! spec_list_index, ! spec_list_len, sourceLine, "SpecifierList=> ASTNodeProperties::declarationSpecifiersProperty" ); + } ASTNodePtr specifierList = node->getProperty(ASTNodeProperties::declarationSpecifiersProperty); *************** *** 151,169 **** } - template<typename T> std::vector<T>& operator<< (std::vector<T>& list, T val) - { - list.push_back(val); - return list; - } - - template std::vector<int>& operator<<(std::vector<int>&, int); - void UnparsedDeclarationMutatorTest::testSimpleDeclaration() { Testing::KeyedString source; source.addKeyed(SPECIFIER , "const" ) << " "; source.addKeyed(SPECIFIER , "short" ) << " "; ! source.addKeyed(SPECIFIER , "int" ) << " "; source.addKeyed(DECLARATOR, "std::x" ) << ";"; --- 166,177 ---- } void UnparsedDeclarationMutatorTest::testSimpleDeclaration() { Testing::KeyedString source; + source.setKeyStart(SPECIFIERLIST); source.addKeyed(SPECIFIER , "const" ) << " "; source.addKeyed(SPECIFIER , "short" ) << " "; ! source.addKeyed(SPECIFIER , "int" ).setKeyEnd(SPECIFIERLIST) << " "; source.addKeyed(DECLARATOR, "std::x" ) << ";"; |
From: <net...@us...> - 2003-04-28 11:04:00
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv9381/src/rfta Modified Files: ParserTools.cpp Log Message: -- added identifier reader Index: ParserTools.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/ParserTools.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParserTools.cpp 22 Dec 2002 16:03:52 -0000 1.3 --- ParserTools.cpp 28 Apr 2003 11:03:57 -0000 1.4 *************** *** 55,58 **** --- 55,104 ---- } + bool RFTAPARSER_API + tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ) + { + if ( !enumerator.hasNext() ) + return false; + + Xtl::CStringEnumerator identifierStart = enumerator; + identifier = enumerator.getString(); + if ( isValidIdentifierFirstLetter( *enumerator ) ) + { + enumerator++; + while ( enumerator.hasNext() && isIdentifierLetter( *enumerator ) ) + enumerator++; + } + + identifier.setEnd(enumerator.getCurrentPos()); + + return identifier.getLength() != 0; + } + + std::string RFTAPARSER_API + tryReadKeyword( Xtl::CStringEnumerator &enumerator, + std::set< std::string > keywords ) + { + Xtl::CStringEnumerator rollback ( enumerator ); + + std::set< std::string >::iterator result; + Xtl::CStringView identifier; + if (!tryReadIdentifier(enumerator,identifier)) + { + enumerator = rollback; + return std::string(); + } + + std::string idstr = identifier.str(); + + std::set< std::string >::iterator it; + it = keywords.find(idstr); + if (it == keywords.end()) + { + enumerator = rollback; + return std::string(); + } + return idstr; + } + } // namespace ParserTools |
From: <net...@us...> - 2003-04-28 11:04:00
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv9381/include/rfta/parser Modified Files: ParserTools.h Log Message: -- added identifier reader Index: ParserTools.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ParserTools.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParserTools.h 26 Apr 2003 21:11:30 -0000 1.4 --- ParserTools.h 28 Apr 2003 11:03:56 -0000 1.5 *************** *** 6,9 **** --- 6,10 ---- #include <stdexcept> #include <string> + #include <set> *************** *** 163,166 **** --- 164,170 ---- }; + bool RFTAPARSER_API tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ); + + std::string RFTAPARSER_API tryReadKeyword( Xtl::CStringEnumerator &enumerator, std::set< std::string > keywords ); } // namespace ParserTools |
From: <bl...@us...> - 2003-04-28 08:53:24
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv19831/src/rftaparser Modified Files: rftaparser.dsp Log Message: * added enumerator for class which expose a public getAt(int index ) method. UNTESTED. Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** rftaparser.dsp 28 Apr 2003 02:49:51 -0000 1.42 --- rftaparser.dsp 28 Apr 2003 08:53:20 -0000 1.43 *************** *** 146,149 **** --- 146,153 ---- # Begin Source File + SOURCE=..\..\include\xtl\GetAtEnumerator.h + # End Source File + # Begin Source File + SOURCE=..\..\include\xtl\Int2Type.h # End Source File *************** *** 159,166 **** SOURCE=..\..\include\xtl\StlEnumerator.h - # End Source File - # Begin Source File - - SOURCE=..\..\include\xtl\StlMapEnumerator.h # End Source File # Begin Source File --- 163,166 ---- |
From: <bl...@us...> - 2003-04-28 08:53:23
|
Update of /cvsroot/cpptool/rfta/include/xtl In directory sc8-pr-cvs1:/tmp/cvs-serv19831/include/xtl Added Files: GetAtEnumerator.h Log Message: * added enumerator for class which expose a public getAt(int index ) method. UNTESTED. --- NEW FILE: GetAtEnumerator.h --- #ifndef XTL_GETATENUMERATOR_H_INCLUDED #define XTL_GETATENUMERATOR_H_INCLUDED #include <xtl/Enumerator.h> #include <xtl/EnumAdaptor.h> #include <xtl/Int2Type.h> #include <xtl/Type.h> #include <boost/type_traits.hpp> namespace Xtl { template<typename ObjectType ,typename EnumeratedType ,typename ReturnType=EnumeratedType ,typename Adaptor=IdendityEnumAdpator<EnumeratedType> > class GetAtEnumeratorImpl : public EnumeratorImpl<EnumeratedType> { public: typedef GetAtEnumeratorImpl<ObjectType,EnumeratedType,Adaptor> ThisType; typedef ReturnType (ObjectType::*GetAtMethod)(int index) const enum { isIdentityAdaptor = ::boost::is_convertible<IdendityEnumAdpator<EnumeratedType> ,Adaptor>::value }; StlEnumeratorImpl( const ObjectType &object, GetAtMethod getAtMethod, int currentIndex, int elementCount ) : object_( object ) , getAtMethod_( getAtMethod ) , current_( currentIndex ) , count_( elementCount ) { } StlEnumeratorImpl( const ObjectType &object, GetAtMethod getAtMethod, int currentIndex, int elementCount, Adaptor adaptor ) : object_( object ) , getAtMethod_( getAtMethod ) , current_( currentIndex ) , count_( elementCount ) , adaptor_( adaptor ) { } public: // overridden from EnumeratorImpl EnumeratedType getNext() { if ( currentIndex >= count_ ) throw EnumeratorError(); return doGetNext( Int2Type<isIdentityAdaptor>() ); } bool hasNext() const { return current_ < count_; } Ptr clone() const { return Ptr( new ThisType( object_, getAtMethod_, currentIndex, elementCount, adaptor_ ) ); } private: inline EnumeratedType doGetNext( Int2Type<true> ) { return (object_->*getAtMethod)( current_++ ); } inline EnumeratedType doGetNext( Int2Type<false> ) { return adaptor_( (object_->*getAtMethod)( current_++ ) ); } private: const ObjectType &object_; GetAtMethod getAtMethod_; int current_; int count_; Adaptor adaptor_; }; template<typename ObjectType ,typename EnumeratedType> Enumerator<EnumeratedType> enumGetAt( const ObjectType &object, EnumeratedType (ObjectType::getAtMethod)(int index) const, int startIndex, int elementCount ) { return Enumerator<EnumeratedType>( new GetAtEnumeratorImpl<ObjectType, EnumeratedType>( object, getAtMethod, startIndex, count ) ); } template<typename ObjectType ,typename ReturnType ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> enumGetAtAdapt( const ObjectType &object, ReturnType (ObjectType::getAtMethod)(int index) const, int startIndex, int elementCount, Adaptor adaptor ) { typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; return Enumerator<EnumeratedType>( new GetAtEnumeratorImpl<ObjectType, EnumeratedType, ReturnType, Adaptor>( object, getAtMethod, startIndex, count, adaptor ) ); } template<typename ObjectType ,typename EnumeratedType ,typename ReturnType> Enumerator<EnumeratedType> enumGetAt( const ObjectType &object, ReturnType (ObjectType::getAtMethod)(int index) const, int startIndex, int elementCount, Type<EnumeratedType> ) { return enumGetAtAdapt( object, getAtMethod, startIndex, elementCount, ConstructEnumAdaptor<EnumeratedType>() ); } } // namespace Xtl #endif // XTL_GETATENUMERATOR_H_INCLUDED |
From: <bl...@us...> - 2003-04-28 08:45:47
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv16435/src/rftaparser Modified Files: EnumeratorTest.cpp EnumeratorTest.h Log Message: * renamed enumStl to enumStlRange for iterator range access (ambiguous overloard if VC6 work-around is not enabled) * fixed enumMapKeys & enumMapValues * added test for enumMapKeys & enumMapValues Index: EnumeratorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/EnumeratorTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EnumeratorTest.cpp 27 Apr 2003 21:59:49 -0000 1.1 --- EnumeratorTest.cpp 28 Apr 2003 08:45:09 -0000 1.2 *************** *** 91,100 **** EnumeratorTest::testStlRangeEnumerator() { ! IntEnum e1a = Xtl::enumStl( deque1_.begin(), deque1_.begin()+2 ); ! IntEnum e1b = Xtl::enumStl( deque1_.begin()+1, deque1_.begin()+3 ); checkRangesContent( e1a, e1b ); ! IntEnum e2a = Xtl::enumStl( vector1_.begin(), vector1_.begin()+2 ); ! IntEnum e2b = Xtl::enumStl( vector1_.begin()+1, vector1_.begin()+3 ); checkRangesContent( e2a, e2b ); --- 91,100 ---- EnumeratorTest::testStlRangeEnumerator() { ! IntEnum e1a = Xtl::enumStlRange( deque1_.begin(), deque1_.begin()+2 ); ! IntEnum e1b = Xtl::enumStlRange( deque1_.begin()+1, deque1_.begin()+3 ); checkRangesContent( e1a, e1b ); ! IntEnum e2a = Xtl::enumStlRange( vector1_.begin(), vector1_.begin()+2 ); ! IntEnum e2b = Xtl::enumStlRange( vector1_.begin()+1, vector1_.begin()+3 ); checkRangesContent( e2a, e2b ); *************** *** 104,121 **** itStart++; ! IntEnum e3a = Xtl::enumStl( set1_.begin(), itEnd ); ! IntEnum e3b = Xtl::enumStl( itStart, set1_.end() ); checkRangesContent( e3a, e3b ); ! CharEnum e4a = Xtl::enumStl( deque1_.begin(), deque1_.begin()+2, Xtl::Type<char>() ); ! CharEnum e4b = Xtl::enumStl( deque1_.begin()+1, deque1_.begin()+3, Xtl::Type<char>() ); checkRangesContent( e4a, e4b ); ! CharEnum e5a = Xtl::enumStl( vector1_.begin(), vector1_.begin()+2, Xtl::Type<char>() ); ! CharEnum e5b = Xtl::enumStl( vector1_.begin()+1, vector1_.begin()+3, Xtl::Type<char>() ); checkRangesContent( e5a, e5b ); ! CharEnum e6a = Xtl::enumStl( set1_.begin(), itEnd, Xtl::Type<char>() ); ! CharEnum e6b = Xtl::enumStl( itStart, set1_.end(), Xtl::Type<char>() ); checkRangesContent( e6a, e6b ); } --- 104,121 ---- itStart++; ! IntEnum e3a = Xtl::enumStlRange( set1_.begin(), itEnd ); ! IntEnum e3b = Xtl::enumStlRange( itStart, set1_.end() ); checkRangesContent( e3a, e3b ); ! CharEnum e4a = Xtl::enumStlRange( deque1_.begin(), deque1_.begin()+2, Xtl::Type<char>() ); ! CharEnum e4b = Xtl::enumStlRange( deque1_.begin()+1, deque1_.begin()+3, Xtl::Type<char>() ); checkRangesContent( e4a, e4b ); ! CharEnum e5a = Xtl::enumStlRange( vector1_.begin(), vector1_.begin()+2, Xtl::Type<char>() ); ! CharEnum e5b = Xtl::enumStlRange( vector1_.begin()+1, vector1_.begin()+3, Xtl::Type<char>() ); checkRangesContent( e5a, e5b ); ! CharEnum e6a = Xtl::enumStlRange( set1_.begin(), itEnd, Xtl::Type<char>() ); ! CharEnum e6b = Xtl::enumStlRange( itStart, set1_.end(), Xtl::Type<char>() ); checkRangesContent( e6a, e6b ); } *************** *** 135,138 **** --- 135,198 ---- RFTA_ASSERT_EQUAL( 34, c.size() ); checkHasNoMoreElements( e ); + } + + + void + EnumeratorTest::testStlMapKeysEnumerator() + { + StringIntMap map; + map.insert( StringIntMap::value_type( "abc", 123 ) ); + map.insert( StringIntMap::value_type( "def", 234 ) ); + map.insert( StringIntMap::value_type( "ghi", 345 ) ); + + StringEnum e = Xtl::enumStlMapKeys( map ); + RFTA_ASSERT_EQUAL( "abc", e.getNext() ); + RFTA_ASSERT_EQUAL( "def", e.getNext() ); + RFTA_ASSERT_EQUAL( "ghi", e.getNext() ); + checkHasNoMoreElements( e ); + + StringIntMap::iterator itEnd = map.end(); + --itEnd; + StringEnum e2 = Xtl::enumStlMapKeysRange( map.begin(), itEnd, Xtl::Type<std::string>() ); + RFTA_ASSERT_EQUAL( "abc", e2.getNext() ); + RFTA_ASSERT_EQUAL( "def", e2.getNext() ); + checkHasNoMoreElements( e2 ); + + StringIntMap::iterator itStart = map.begin(); + ++itStart; + StringIntMapFirstEnum e3 = Xtl::enumStlMapKeysRange( itStart, map.end() ); + RFTA_ASSERT_EQUAL( "def", e3.getNext() ); + RFTA_ASSERT_EQUAL( "ghi", e3.getNext() ); + checkHasNoMoreElements( e3 ); + } + + + void + EnumeratorTest::testStlMapValuesEnumerator() + { + StringIntMap map; + map.insert( StringIntMap::value_type( "abc", 123 ) ); + map.insert( StringIntMap::value_type( "def", 234 ) ); + map.insert( StringIntMap::value_type( "ghi", 345 ) ); + + IntEnum e = Xtl::enumStlMapValues( map ); + RFTA_ASSERT_EQUAL( 123, e.getNext() ); + RFTA_ASSERT_EQUAL( 234, e.getNext() ); + RFTA_ASSERT_EQUAL( 345, e.getNext() ); + checkHasNoMoreElements( e ); + + StringIntMap::iterator itEnd = map.end(); + --itEnd; + IntEnum e2 = Xtl::enumStlMapValuesRange( map.begin(), itEnd, Xtl::Type<int>() ); + RFTA_ASSERT_EQUAL( 123, e2.getNext() ); + RFTA_ASSERT_EQUAL( 234, e2.getNext() ); + checkHasNoMoreElements( e2 ); + + StringIntMap::iterator itStart = map.begin(); + ++itStart; + StringIntMapSecondEnum e3 = Xtl::enumStlMapValuesRange( itStart, map.end() ); + RFTA_ASSERT_EQUAL( 234, e3.getNext() ); + RFTA_ASSERT_EQUAL( 345, e3.getNext() ); + checkHasNoMoreElements( e3 ); } Index: EnumeratorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/EnumeratorTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EnumeratorTest.h 27 Apr 2003 21:59:49 -0000 1.1 --- EnumeratorTest.h 28 Apr 2003 08:45:11 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- #include <xtl/StlEnumerator.h> #include <deque> + #include <map> #include <set> #include <vector> *************** *** 27,30 **** --- 28,33 ---- CPPUNIT_TEST( testStlRangeEnumerator ); CPPUNIT_TEST( testStlEnumConstructAdapator ); + CPPUNIT_TEST( testStlMapKeysEnumerator ); + CPPUNIT_TEST( testStlMapValuesEnumerator ); CPPUNIT_TEST_SUITE_END(); *************** *** 47,50 **** --- 50,56 ---- void testStlEnumConstructAdapator(); + void testStlMapKeysEnumerator(); + void testStlMapValuesEnumerator(); + private: typedef Xtl::Enumerator<int> IntEnum; *************** *** 89,92 **** --- 95,102 ---- typedef Xtl::Enumerator<IntDeque> IntDequeEnum; + typedef std::map<std::string,int> StringIntMap; + typedef Xtl::Enumerator<std::string> StringEnum; + typedef Xtl::Enumerator<StringIntMap::value_type::first_type> StringIntMapFirstEnum; + typedef Xtl::Enumerator<StringIntMap::value_type::second_type> StringIntMapSecondEnum; }; |
From: <bl...@us...> - 2003-04-28 08:45:44
|
Update of /cvsroot/cpptool/rfta/include/xtl In directory sc8-pr-cvs1:/tmp/cvs-serv16435/include/xtl Modified Files: StlEnumerator.h Log Message: * renamed enumStl to enumStlRange for iterator range access (ambiguous overloard if VC6 work-around is not enabled) * fixed enumMapKeys & enumMapValues * added test for enumMapKeys & enumMapValues Index: StlEnumerator.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/xtl/StlEnumerator.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StlEnumerator.h 27 Apr 2003 21:59:49 -0000 1.1 --- StlEnumerator.h 28 Apr 2003 08:45:08 -0000 1.2 *************** *** 7,11 **** #include <xtl/Type.h> #include <boost/type_traits.hpp> - #include <functional> namespace Xtl { --- 7,10 ---- *************** *** 56,60 **** Ptr clone() const { ! return Ptr( new ThisType( current_, last_ ) ); } --- 55,59 ---- Ptr clone() const { ! return Ptr( new ThisType( current_, last_, adaptor_ ) ); } *************** *** 80,84 **** ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; --- 79,83 ---- ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlRangeAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; *************** *** 95,99 **** enumStlAdapt( const StlContainerType &sequence, Adaptor adaptor ) { ! return enumStlAdapt( sequence.begin(), sequence.end(), adaptor ); } --- 94,98 ---- enumStlAdapt( const StlContainerType &sequence, Adaptor adaptor ) { ! return enumStlRangeAdapt( sequence.begin(), sequence.end(), adaptor ); } *************** *** 104,112 **** enumStl( const StlContainerType &sequence, Type<EnumeratedType> ) { ! return Enumerator<EnumeratedType>( ! new StlEnumeratorImpl<BOOST_DEDUCED_TYPENAME StlContainerType::const_iterator ! ,EnumeratedType ! ,ConstructEnumAdaptor<EnumeratedType> >( ! sequence.begin(), sequence.end() ) ); } --- 103,107 ---- enumStl( const StlContainerType &sequence, Type<EnumeratedType> ) { ! return enumStlAdapt( sequence, ConstructEnumAdaptor<EnumeratedType>() ); } *************** *** 124,128 **** ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStl( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { return Enumerator<EnumeratedType>( --- 119,123 ---- ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlRange( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { return Enumerator<EnumeratedType>( *************** *** 142,150 **** ,typename IteratorType> Enumerator<EnumeratedType> ! enumStl( const std::iterator<Category, EnumeratedType, Distance> &first, ! const IteratorType &last ) { ! return enumStlAdapt( static_cast<const IteratorType &>(first), last, ! IdendityEnumAdpator<EnumeratedType>() ); } --- 137,145 ---- ,typename IteratorType> Enumerator<EnumeratedType> ! enumStlRange( const std::iterator<Category, EnumeratedType, Distance> &first, ! const IteratorType &last ) { ! return enumStlRangeAdapt( static_cast<const IteratorType &>(first), last, ! IdendityEnumAdpator<EnumeratedType>() ); } *************** *** 152,158 **** template<typename EnumeratedType> Enumerator<EnumeratedType> ! enumStl( const EnumeratedType *first, const EnumeratedType *last ) { ! return enumStlAdapt( first, last, IdendityEnumAdpator<EnumeratedType>() ); } --- 147,153 ---- template<typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlRange( const EnumeratedType *first, const EnumeratedType *last ) { ! return enumStlRangeAdapt( first, last, IdendityEnumAdpator<EnumeratedType>() ); } *************** *** 161,169 **** template<typename StlIteratorType> Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStl( StlIteratorType first, StlIteratorType last ) { typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlAdapt( first, last, ! IdendityEnumAdpator<EnumeratedType>() ); } --- 156,164 ---- template<typename StlIteratorType> Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStlRange( StlIteratorType first, StlIteratorType last ) { typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlRangeAdapt( first, last, ! IdendityEnumAdpator<EnumeratedType>() ); } *************** *** 199,208 **** template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStlMapKeys( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlAdapt( first, last, ! FirstEnumAdaptor<EnumeratedType>() ); } --- 194,203 ---- template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::first_type> ! enumStlMapKeysRange( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::first_type EnumeratedType; ! return enumStlRangeAdapt( first, last, ! FirstEnumAdaptor<EnumeratedType>() ); } *************** *** 211,218 **** ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapKeys( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! return enumStlAdapt( first, last, ! ComposeAdaptor<Adaptor,FirstEnumAdaptor>() ); } --- 206,214 ---- ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapKeysRangeAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; ! return enumStlRangeAdapt( first, last, ! ComposeAdaptor<Adaptor,FirstEnumAdaptor<EnumeratedType> >() ); } *************** *** 221,227 **** ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapKeys( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapKeysAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } --- 217,223 ---- ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapKeysRange( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapKeysRangeAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } *************** *** 241,245 **** enumStlMapValuesAdapt( const StlMapType &map, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME StlMapType::referent_type EnumeratedType; return enumStlAdapt( map, ComposeAdaptor<Adaptor,SecondEnumAdaptor>() ); } --- 237,241 ---- enumStlMapValuesAdapt( const StlMapType &map, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; return enumStlAdapt( map, ComposeAdaptor<Adaptor,SecondEnumAdaptor>() ); } *************** *** 247,256 **** template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStlMapValues( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlAdapt( first, last, ! SecondEnumAdaptor<EnumeratedType>() ); } --- 243,252 ---- template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::second_type> ! enumStlMapValuesRange( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::second_type EnumeratedType; ! return enumStlRangeAdapt( first, last, ! SecondEnumAdaptor<EnumeratedType>() ); } *************** *** 259,266 **** ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapValuesAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! return enumStlAdapt( first, last, ! ComposeAdaptor<Adaptor,SecondEnumAdaptor>() ); } --- 255,264 ---- ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapValuesRangeAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; ! return enumStlRangeAdapt( first, last, ! ComposeAdaptor<Adaptor ! ,SecondEnumAdaptor<EnumeratedType> >() ); } *************** *** 269,275 **** ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapValues( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapValuesAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } --- 267,273 ---- ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapValuesRange( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapValuesRangeAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } |
From: <net...@us...> - 2003-04-28 02:52:56
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv29359/src/rftaparser Modified Files: UnparsedDeclarationMutatorTest.cpp Log Message: -- removed old code Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 02:45:42 -0000 1.2 --- UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 02:52:50 -0000 1.3 *************** *** 53,123 **** } - static void checkDeclaration( const std::string& source, - const SourceASTNodePtr& sourceNode, - const std::vector<int> specifierStart, - const std::vector<int> specifierLen, - const std::vector<int> declStart, - const std::vector<int> declLen, - const CppUnit::SourceLine &sourceLine ) - { - ASTNodePtr node = sourceNode->getChildAt(0); - - int specifierCount = __min(specifierStart.size(), specifierLen.size()); - int declaratorCount = __min(declStart.size() , declLen.size()); - - // check AST: - checkASTNodeHas ( node, - ASTNodeTypes::declaration, - 0, - source.length(), - sourceLine, - "ASTNodeTypes::declaration" - ); - - if (specifierCount>0) - checkASTNodePropertyHas( node, - ASTNodeProperties::declarationSpecifiersProperty, - ASTNodeTypes::declarationSpecifierList, - specifierStart[0], - specifierLen[specifierCount-1]+specifierStart[specifierCount-1]-specifierStart[0], - sourceLine, - "ASTNodeProperties::declarationSpecifiersProperty" - ); - - ASTNodePtr specifierList = node->getProperty(ASTNodeProperties::declarationSpecifiersProperty); - - // check number of specifiers parsed: - CppUnit::assertEquals( specifierList->getChildCount(), specifierCount, sourceLine, - boost::io::str(boost::format("Bad number of specifiers:\n Actual %1%\n Expected %2%.") - % specifierList->getChildCount() - % specifierCount ) ); - int idx; - - for (idx=0; idx<specifierCount; idx++) - { - - ASTNodePtr specifierNode = specifierList->getChildAt(idx); - - CppUnit::assertEquals( specifierStart[idx], specifierNode->getStartIndex(), sourceLine, - boost::io::str(boost::format("Specifier %1%: bad node start index.") % idx) ); - CppUnit::assertEquals( specifierLen[idx] , specifierNode->getLength(), sourceLine, - boost::io::str(boost::format("Specifier %1%: bad node length.") % idx) ); - } - // check declarators - CppUnit::assertEquals( node->getChildCount() , declaratorCount , sourceLine, - "Wrong number of declarators." ); - - for (idx=0; idx<declaratorCount; idx++) - { - ASTNodePtr declNode = node->getChildAt(idx); - - CppUnit::assertEquals( declStart[idx], declNode->getStartIndex(), sourceLine, - boost::io::str(boost::format("Declarator %1%: bad node start index.") % idx) ); - CppUnit::assertEquals( declLen[idx] , declNode->getLength(), sourceLine, - boost::io::str(boost::format("Declarator %1%: bad node length.") % idx) ); - } - - } - static void checkDeclaration( const Testing::KeyedString& source, const SourceASTNodePtr& sourceNode, --- 53,56 ---- *************** *** 192,200 **** #define RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ) \ Refactoring::Testing::checkDeclarationMutatorPass( source, CPPUNIT_SOURCELINE() ) - - #define RFTA_ASSERT_DECLARATION_OLD( source,sourceAST,specStart,specLen,declaratorStart,declaratorLen )\ - Refactoring::Testing::checkDeclaration( \ - source, sourceAST, specStart, specLen, \ - declaratorStart, declaratorLen, CPPUNIT_SOURCELINE() ) #define RFTA_ASSERT_DECLARATION( source,sourceAST )\ --- 125,128 ---- |
From: <net...@us...> - 2003-04-28 02:50:41
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv28501/src/rftaparser Modified Files: rftaparser.dsp Log Message: -- grouping of the tests and new util class for tests Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** rftaparser.dsp 27 Apr 2003 21:59:49 -0000 1.41 --- rftaparser.dsp 28 Apr 2003 02:49:51 -0000 1.42 *************** *** 56,61 **** # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Release/rftaparser_mdr.ext" /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\prg\vc\Rfta\build\rftaparser\Release ! TargetPath=\prg\vc\Rfta\build\rftaparser\Release\rftaparser_mdr.ext TargetName=rftaparser_mdr SOURCE="$(InputPath)" --- 56,61 ---- # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Release/rftaparser_mdr.ext" /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\Projects\Cpptool\rfta\build\rftaparser\Release ! TargetPath=\Projects\Cpptool\rfta\build\rftaparser\Release\rftaparser_mdr.ext TargetName=rftaparser_mdr SOURCE="$(InputPath)" *************** *** 90,95 **** # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd_dll.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Debug/rftaparser_mdd.ext" /pdbtype:sept /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\prg\vc\Rfta\build\rftaparser\Debug ! TargetPath=\prg\vc\Rfta\build\rftaparser\Debug\rftaparser_mdd.ext TargetName=rftaparser_mdd SOURCE="$(InputPath)" --- 90,95 ---- # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd_dll.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Debug/rftaparser_mdd.ext" /pdbtype:sept /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\Projects\Cpptool\rfta\build\rftaparser\Debug ! TargetPath=\Projects\Cpptool\rfta\build\rftaparser\Debug\rftaparser_mdd.ext TargetName=rftaparser_mdd SOURCE="$(InputPath)" *************** *** 650,653 **** --- 650,656 ---- # End Source File # End Group + # Begin Group "ParserTests" + + # PROP Default_Filter "" # Begin Source File *************** *** 782,786 **** # Begin Source File ! SOURCE=.\ExpressionMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 785,789 ---- # Begin Source File ! SOURCE=.\ForStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 795,799 **** # Begin Source File ! SOURCE=.\ExpressionMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 798,802 ---- # Begin Source File ! SOURCE=.\ForStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 808,812 **** # Begin Source File ! SOURCE=.\ExpressionOperationMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 811,815 ---- # Begin Source File ! SOURCE=.\IfStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 821,825 **** # Begin Source File ! SOURCE=.\ExpressionOperationMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 824,828 ---- # Begin Source File ! SOURCE=.\IfStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 834,838 **** # Begin Source File ! SOURCE=.\ForStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 837,841 ---- # Begin Source File ! SOURCE=.\KeywordStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 847,851 **** # Begin Source File ! SOURCE=.\ForStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 850,854 ---- # Begin Source File ! SOURCE=.\KeywordStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 860,864 **** # Begin Source File ! SOURCE=.\IfStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 863,867 ---- # Begin Source File ! SOURCE=.\NonSemanticBlankerTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 873,877 **** # Begin Source File ! SOURCE=.\IfStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 876,880 ---- # Begin Source File ! SOURCE=.\NullStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 886,890 **** # Begin Source File ! SOURCE=.\KeywordStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 889,893 ---- # Begin Source File ! SOURCE=.\NullStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 899,903 **** # Begin Source File ! SOURCE=.\KeywordStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 902,906 ---- # Begin Source File ! SOURCE=.\ReturnStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 912,916 **** # Begin Source File ! SOURCE=.\NonSemanticBlankerTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 915,919 ---- # Begin Source File ! SOURCE=.\ReturnStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 925,929 **** # Begin Source File ! SOURCE=.\NonSemanticBlankerTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 928,932 ---- # Begin Source File ! SOURCE=.\RftaParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 938,942 **** # Begin Source File ! SOURCE=.\NullStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 941,945 ---- # Begin Source File ! SOURCE=.\StatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 951,955 **** # Begin Source File ! SOURCE=.\NullStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 954,958 ---- # Begin Source File ! SOURCE=.\StatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 964,968 **** # Begin Source File ! SOURCE=.\ParseContextTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 967,971 ---- # Begin Source File ! SOURCE=.\StatementsParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 977,981 **** # Begin Source File ! SOURCE=.\ParseContextTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 980,984 ---- # Begin Source File ! SOURCE=.\StatementsParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 990,994 **** # Begin Source File ! SOURCE=.\ParserTesting.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 993,997 ---- # Begin Source File ! SOURCE=.\SwitchStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1003,1007 **** # Begin Source File ! SOURCE=.\ReturnStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1006,1010 ---- # Begin Source File ! SOURCE=.\SwitchStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1016,1020 **** # Begin Source File ! SOURCE=.\ReturnStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1019,1023 ---- # Begin Source File ! SOURCE=.\TypeDeclarationStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1029,1033 **** # Begin Source File ! SOURCE=.\RftaParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1032,1036 ---- # Begin Source File ! SOURCE=.\TypeDeclarationStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1040,1046 **** # End Source File # Begin Source File ! SOURCE=.\SourceRangeTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1043,1053 ---- # End Source File + # End Group + # Begin Group "MutatorTests" + + # PROP Default_Filter "" # Begin Source File ! SOURCE=.\ExpressionMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1055,1059 **** # Begin Source File ! SOURCE=.\SourceRangeTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1062,1066 ---- # Begin Source File ! SOURCE=.\ExpressionMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1068,1072 **** # Begin Source File ! SOURCE=.\StatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1075,1079 ---- # Begin Source File ! SOURCE=.\ExpressionOperationMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1081,1085 **** # Begin Source File ! SOURCE=.\StatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1088,1092 ---- # Begin Source File ! SOURCE=.\ExpressionOperationMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1094,1098 **** # Begin Source File ! SOURCE=.\StatementsParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1101,1105 ---- # Begin Source File ! SOURCE=.\UnparsedCompoundMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1107,1111 **** # Begin Source File ! SOURCE=.\StatementsParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1114,1118 ---- # Begin Source File ! SOURCE=.\UnparsedCompoundMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1120,1124 **** # Begin Source File ! SOURCE=.\SwitchStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1127,1131 ---- # Begin Source File ! SOURCE=.\UnparsedDeclarationListMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1133,1137 **** # Begin Source File ! SOURCE=.\SwitchStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1140,1144 ---- # Begin Source File ! SOURCE=.\UnparsedDeclarationListMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1146,1150 **** # Begin Source File ! SOURCE=.\TypeDeclarationStatementParserTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1153,1157 ---- # Begin Source File ! SOURCE=.\UnparsedDeclarationMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1159,1163 **** # Begin Source File ! SOURCE=.\TypeDeclarationStatementParserTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1166,1170 ---- # Begin Source File ! SOURCE=.\UnparsedDeclarationMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1172,1176 **** # Begin Source File ! SOURCE=.\UnitTesting.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1179,1183 ---- # Begin Source File ! SOURCE=.\VariableDeclMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1185,1189 **** # Begin Source File ! SOURCE=.\UnparsedCompoundMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1192,1196 ---- # Begin Source File ! SOURCE=.\VariableDeclMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1196,1202 **** # End Source File # Begin Source File ! SOURCE=.\UnparsedCompoundMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1203,1218 ---- # End Source File + # End Group + # Begin Group "Testing" + + # PROP Default_Filter "" # Begin Source File ! SOURCE=.\KeyedString.h ! # End Source File ! # End Group ! # Begin Source File ! ! SOURCE=.\NonSemanticBlankerTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1211,1215 **** # Begin Source File ! SOURCE=.\UnparsedDeclarationListMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1227,1231 ---- # Begin Source File ! SOURCE=.\ParseContextTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1224,1228 **** # Begin Source File ! SOURCE=.\UnparsedDeclarationListMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1240,1244 ---- # Begin Source File ! SOURCE=.\ParseContextTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1237,1241 **** # Begin Source File ! SOURCE=.\UnparsedDeclarationMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1253,1257 ---- # Begin Source File ! SOURCE=.\ParserTesting.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1250,1254 **** # Begin Source File ! SOURCE=.\UnparsedDeclarationMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1266,1270 ---- # Begin Source File ! SOURCE=.\SourceRangeTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1263,1267 **** # Begin Source File ! SOURCE=.\VariableDeclMutatorTest.cpp !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1279,1283 ---- # Begin Source File ! SOURCE=.\SourceRangeTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" *************** *** 1276,1280 **** # Begin Source File ! SOURCE=.\VariableDeclMutatorTest.h !IF "$(CFG)" == "rftaparser - Win32 Release" --- 1292,1296 ---- # Begin Source File ! SOURCE=.\UnitTesting.h !IF "$(CFG)" == "rftaparser - Win32 Release" |
From: <net...@us...> - 2003-04-28 02:45:45
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv27469/src/rftaparser Modified Files: UnparsedDeclarationMutatorTest.cpp UnparsedDeclarationMutator.cpp Log Message: -- code refactoring (keystring) Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnparsedDeclarationMutatorTest.cpp 26 Apr 2003 11:06:25 -0000 1.1 --- UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 02:45:42 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- #include "UnparsedDeclarationMutator.h" #include "UnparsedDeclarationMutatorTest.h" + #include "KeyedString.h" #include <rfta/parser/ASTNode.h> #include <rfta/parser/ASTNodes.h> *************** *** 20,23 **** --- 21,26 ---- RFTAPARSER_TEST_SUITE_REGISTRATION( UnparsedDeclarationMutatorTest ); [...1021 lines suppressed...] ! { ! Testing::KeyedString source; ! source.addKeyed(SPECIFIER , "struct c { int a; }" ) << " "; ! source.addKeyed(SPECIFIER , "typedef" ) << " "; ! source.addKeyed(DECLARATOR, "* mystruct" ) << ";"; SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); *************** *** 835,839 **** // check AST: ! RFTA_ASSERT_DECLARATION(source,sourceAST,specStart,specLen,declStart,declLen); // check declarator types: --- 709,713 ---- // check AST: ! RFTA_ASSERT_DECLARATION( source, sourceAST ); // check declarator types: Index: UnparsedDeclarationMutator.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutator.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnparsedDeclarationMutator.cpp 26 Apr 2003 11:06:26 -0000 1.1 --- UnparsedDeclarationMutator.cpp 28 Apr 2003 02:45:42 -0000 1.2 *************** *** 857,863 **** // skip over the type-specifier and ptr-operator elements ! readUntilNextOf("("); ! if ( !tryReadNext("()") ) ! throwFailure( "Expect '()' after a conversion function operator" ); } --- 857,861 ---- // skip over the type-specifier and ptr-operator elements ! readUntilNextOf("("); } |
From: <net...@us...> - 2003-04-28 02:45:05
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv27286/src/rftaparser Added Files: KeyedString.h Log Message: -- Util class for testing --- NEW FILE: KeyedString.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Andre Baresel // Created: 2003/04/28 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_KEYEDSTRING_H #define RFTA_KEYEDSTRING_H #include <vector> #include <map> #include <string> namespace Refactoring { namespace Testing { class KeyedString { public: KeyedString& operator<< (std::string characters); operator std::string () const; KeyedString& addKeyed (std::string key , std::string word ); std::string asString() const; std::vector<int> getKeyedIndex(std::string key) const; std::vector<int> getKeyedLen(std::string key) const; std::string getWord(std::string key, int index) const; int length() const; protected: std::string sequence_; std::map<std::string,std::vector<int> > wordIndex_; std::map<std::string,std::vector<int> > wordLen_; std::map<std::string,std::vector<std::string> > word_; }; // INLINED MEMBERS: inline KeyedString& KeyedString::operator<<(std::string characters) { sequence_.append(characters); return *this; } inline KeyedString::operator std::string() const { return sequence_; } inline std::string KeyedString::asString() const { return sequence_; } inline std::vector<int> KeyedString::getKeyedIndex(std::string key) const { std::map<std::string,std::vector<int> >::const_iterator it; it = wordIndex_.find(key); if (it == wordIndex_.end()) return std::vector<int>(); return (*it).second; } inline std::vector<int> KeyedString::getKeyedLen(std::string key) const { std::map<std::string,std::vector<int> >::const_iterator it; it = wordLen_.find(key); if (it == wordLen_.end()) return std::vector<int>(); return (*it).second; } inline std::string KeyedString::getWord(std::string key, int index) const { std::map<std::string,std::vector<std::string> >::const_iterator it; it = word_.find(key); if (it == word_.end()) return std::string(); return ((*it).second)[index]; } inline KeyedString& KeyedString::addKeyed(std::string key,std::string word) { wordIndex_[key].push_back(sequence_.length()); wordLen_[key].push_back(word.length()); word_[key].push_back(word); sequence_.append(word); return *this; } inline int KeyedString::length() const { return sequence_.length(); } } // namespace Testing } // namespace Refactoring #endif // RFTA_KEYEDSTRING_H |
From: <bl...@us...> - 2003-04-27 22:03:41
|
Update of /cvsroot/cpptool/rfta/src/pyrfta/pytest In directory sc8-pr-cvs1:/tmp/cvs-serv31156/src/pyrfta/pytest Added Files: alltests.py codeanalysis.py codeanalysistest.py Log Message: * converting the IdentifierResolver to python using the code model. --- NEW FILE: alltests.py --- #!/usr/bin/env python # # Example of assembling all available unit tests into one suite. This usually # varies greatly from one project to the next, so the code shown below will not # be incorporated into the 'unittest' module. Instead, modify it for your own # purposes. # # $Id: alltests.py,v 1.1 2003/04/27 22:03:38 blep Exp $ import unittest def suite(): modules_to_test = ('identifierresolvertest') # and so on alltests = unittest.TestSuite() for module in map(__import__, modules_to_test): alltests.addTest(unittest.findTestCases(module)) return alltests if __name__ == '__main__': unittest.main(defaultTest='suite') --- NEW FILE: codeanalysis.py --- import pyrfta class LocalVariableDeclarator(pyrfta.StatementVisitor): def __init__( self, resolver ): self.resolver = resolver def declare(self, functionBody): functionBody.accept(self) def visitCompoundStatement(self,compound): pass class LocalVariableResolver: def isLocaleVariable(self, variableName): return false def declareVariable(self, variableName): pass def enterScope(self): pass def exitScope(self): pass --- NEW FILE: codeanalysistest.py --- import unittest from codeanalysis import * class IdentifierResolverTestCase(unittest.TestCase): """IdentifierResolver tests""" def setUp(self): pass def tearDown(self): pass def testConstructor(self): resolver = IdentifierResolver( None ) def suite(): return unittest.makeSuite(IdentifierResolverTestCase) if __name__ == '__main__': unittest.TextTestRunner().run(suite()) |
From: <bl...@us...> - 2003-04-27 22:02:43
|
Update of /cvsroot/cpptool/rfta/include/xtl In directory sc8-pr-cvs1:/tmp/cvs-serv30912/include/xtl Modified Files: Forwards.h Log Message: * added Enumerator concept. Allow enumeration of STL container while hiding implementation. Index: Forwards.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/xtl/Forwards.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Forwards.h 26 Apr 2003 21:13:00 -0000 1.1 --- Forwards.h 27 Apr 2003 22:02:37 -0000 1.2 *************** *** 8,11 **** --- 8,17 ---- class CStringBackEnumerator; + template<typename EnumeratedType> + class Enumerator; + + template<typename WrappedType> + struct Type; + } // namespace Xtl |