Commit Graph

152 Commits

Author SHA1 Message Date
Thomas Jarosch 1a454256dc Cache result of tok->isStandardType()
Also contains test order improvements from Johan Samuelson (#3116).

Run time went down from 15.15s to 14.95s for the case below.

Benchmarked using these settings:
- CXXFLAGS="-O2 -g -NDEBUG"
- time -p cppcheck.git -q --std=posix --enable=all --inconclusive -Dfoo .

on the "rpm" codebase.
2011-11-09 21:56:30 +01:00
Edoardo Prezioso 8a60ceed82 Add test for Token::eraseTokens. 2011-11-08 18:59:31 +01:00
Thomas Jarosch a83c47d9cf Fix false positive of %or% match in alternative pattern match code
%or% triggered on code using "|=" or "||".
2011-11-06 22:12:31 +01:00
Thomas Jarosch 1360c554ed Extended isOp() tests to do proper negative testing against other operators 2011-11-06 21:20:13 +01:00
Thomas Jarosch 7ef1107a55 Unit test for Token::isArithmeticalOp() and Token::isStandardType() 2011-11-06 18:55:02 +01:00
Thomas Jarosch d7ce892c06 Unit test for %varid% match
Also run astyle.
2011-11-06 18:37:45 +01:00
Thomas Jarosch 05c4b97bbe Unit test for %type% and %str% matches 2011-11-06 18:30:34 +01:00
Thomas Jarosch 95851454cc Unit test for Token::isExtendedOp() and Token::isAssignmentOp() 2011-11-06 18:19:27 +01:00
Thomas Jarosch 19c9c97608 Fix single %op% operator not working at all
When parsing the Token::Match pattern, we accesed
the wrong character in the pattern and never
executed the %op% check.

In addition the unit test function for %op%
wasn't registered in the test suite. Ups.

All fixed now and also provide a complete
check for all operators %op% supports.
2011-11-06 18:02:18 +01:00
Daniel Marjamäki 5edf153602 Fixed #3294 (Token::Match multi compare false negative) 2011-11-05 19:24:21 +01:00
Thomas Jarosch 2a46c635f6 Test case to demonstrate #3294 2011-11-05 14:04:23 +01:00
Thomas Jarosch 91a5d95bc9 Use Token::simpleMatch() / Token::findsimplematch() where possible 2011-10-28 22:31:05 +02:00
Thomas Jarosch 1ccb57e595 Document and test Token::concatStr() 2011-10-23 21:21:42 +02:00
Thomas Jarosch 5b97cc1440 Bugfix: Update token properties on string changes 2011-10-23 21:06:56 +02:00
PKEuS 54b3d72ee3 Added Token::nextArgument() 2011-10-23 11:23:48 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Robert Reif daf0c71f77 fix #2911 (Token::Match(tok, %oror%|&&) doesn't match &&) 2011-07-31 13:26:26 -04:00
Robert Reif 76960e54a1 testcase for broken Token::Match %oror%|&& 2011-07-16 07:28:26 -04:00
Daniel Marjamäki d78d8660ab astyle formatting 2011-07-15 19:02:16 +02:00
John Smits 7f2d62cbde Fixed #2882 (One-character token can be mistaken for a multiCompare) 2011-07-15 19:01:36 +02:00
Daniel Marjamäki af60f2c4ef Token: Added testcase for matching of %op% 2011-04-10 11:15:57 +02:00
Daniel Marjamäki 747a2331c6 Token::Match : Allow that %oror% and %or% is used in multiCompare patterns 2011-04-10 08:39:55 +02:00
Daniel Marjamäki 6c4f5fc496 Token::multiCompare : allow that %op% is used in multiCompare pattern 2011-04-09 18:09:13 +02:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki a9aa6375b7 gcc: disabled -Wconversion again - too many warnings 2011-01-01 09:16:31 +01:00
Pete Johns 2e61736c73 Refactoring following #2377 (Technically the member function xxx can be const)
symboldatabase now recognises variables with arbitrarily many scopes.

Extracted method isVariableDeclaration()

Added unit tests for isVariableDeclaration in new file testsymboldatabase.cpp

Extracted givenACodeSampleToTokenize helper class into testutils.h to reduce duplication.
2010-12-30 19:46:44 +11:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Zachary Blair 26afb04dc5 Fixed #2105 (Incorrect operator: mutual exclusion over ||) 2010-10-24 18:14:21 -07:00
Pete Johns 5dc4759598 Replaced TODO in numeric test with two passing tests.
Just getting to grips with how the tokenizer behaves.
2010-09-26 16:39:19 +10:00
Pete Johns acad87c3e3 Improved test coverage.
Refactored to extract givenACodeSampleToTokenize, reducing LOC.
2010-09-26 13:31:36 +10:00
Daniel Marjamäki 86a08b9f0e unit testing: moved TestTokenizer::match tests to the TestToken 2010-09-07 20:42:29 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Daniel Marjamäki 262e5390a0 Refactoring: Renamed TestTOKEN to TestToken 2010-04-05 10:15:30 +02:00
Daniel Marjamäki 0cad22314e Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup. 2010-04-02 07:30:58 +02:00
Martin Ettl 193aa7d1d3 astyle fix 2010-04-02 02:21:53 +02:00
Reijo Tomperi 913ede45aa Get rid of casting in test file.
http://sourceforge.net/apps/trac/cppcheck/ticket/1242
2010-01-12 21:24:44 +02:00
Daniel Marjamäki 1c69d54fb3 ivoire: 64-bit portability fix 2010-01-10 17:30:35 +01:00
Daniel Marjamäki 57d1da3910 Ticket #1228 : Handle tokensBack in the Token class. When adding&removing tokens the Token class can make sure that this pointer is updated accordingly. It is very important that the tokensBack has the same scope as the token list, otherwise there will be a dead pointer problem. 2010-01-06 20:19:27 +01:00
Daniel Marjamäki 09859c1019 refactoring the folder structure 2009-10-25 12:49:06 +01:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Slava Semushin 50a34b8a37 Fixed #731 (False positive, strcpy copying a buffer with a null character)
http://sourceforge.net/apps/trac/cppcheck/ticket/731
2009-09-26 22:58:14 +07:00
Slava Semushin dade31b6d7 TestTOKEN::getStrLength(): allocate tok variable in stack (instead of in heap)
No functional change.
2009-09-13 15:08:43 +07:00
Reijo Tomperi 241f585d34 Fix #594 (division by zero not detected when using atol or atof)
http://sourceforge.net/apps/trac/cppcheck/ticket/594
Simplify atol("0") into 0 (and other atol() calls also)
2009-09-12 23:54:47 +03:00
Slava Semushin 843ede94f3 Token::getStrLength(): introduce new static method.
No functional change.
2009-08-30 18:07:10 +07:00
Slava Semushin bc32d04efa Replace tok->previous()->previous() call to tok->tokAt(-2).
Done by command:
git grep -l 'previous()->previous()' | xargs sed -i 's|previous()->previous()|tokAt(-2)|'

No functional change.
2009-06-14 13:33:45 +07:00
Slava Semushin 4245047674 Replace tok->next()->next() call to tok->tokAt(2).
Done by command:
git grep -l 'next()->next()' | xargs sed -i 's|next()->next()|tokAt(2)|'

No functional change.
2009-06-14 13:33:45 +07:00
Reijo Tomperi 58eda6e978 Fix ticket #325 (Replace developer names in source files with AUTHORS file)
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Reijo Tomperi 24d96b188e Fix ticket #305 (Negative value passed to ASSERT_EQUALS)
http://apps.sourceforge.net/trac/cppcheck/ticket/305
Moved also test case from testtokenizer to testtoken.
2009-05-12 21:28:02 +03:00
Reijo Tomperi 896abcb569 Fixed some memory leaks in test cases 2009-03-17 21:59:40 +02:00
Reijo Tomperi fc8f47145a Copyrights updated 2009-03-01 19:52:33 +00:00
Reijo Tomperi 176dd41306 Fixed Ticket #40, Check copyright texts in files, now that we have new developers. 2009-01-21 20:04:20 +00:00
Reijo Tomperi e435a1f1d6 Refactoring: Added src/ and test/ folders. Moved source files to those folders, updated makefile and codeblocks project file. 2009-01-06 14:18:36 +00:00