Added "ImproveCacheLocality"-Step; Added Unit tests (3 at the moment); Fixed hp spelling errors.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@68 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
61
test/unit/utRemoveComments.cpp
Normal file
61
test/unit/utRemoveComments.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
|
||||
#include "utRemoveComments.h"
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (RemoveCommentsTest);
|
||||
|
||||
void RemoveCommentsTest :: setUp (void)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
void RemoveCommentsTest :: tearDown (void)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
void RemoveCommentsTest :: testSingleLineComments (void)
|
||||
{
|
||||
const char* szTest = "int i = 0; \n"
|
||||
"if (4 == //)\n"
|
||||
"\ttrue) { // do something here \n"
|
||||
"\t// hello ... and bye //\n";
|
||||
|
||||
|
||||
char* szTest2 = new char[::strlen(szTest)+1];
|
||||
::strcpy(szTest2,szTest);
|
||||
|
||||
const char* szTestResult = "int i = 0; \n"
|
||||
"if (4 == \n"
|
||||
"\ttrue) { \n"
|
||||
"\t \n";
|
||||
|
||||
CommentRemover::RemoveLineComments("//",szTest2,' ');
|
||||
CPPUNIT_ASSERT(0 == ::strcmp(szTest2,szTestResult));
|
||||
|
||||
delete[] szTest2;
|
||||
}
|
||||
|
||||
void RemoveCommentsTest :: testMultiLineComments (void)
|
||||
{
|
||||
char* szTest =
|
||||
"/* comment to be removed */\n"
|
||||
"valid text /* \n "
|
||||
" comment across multiple lines */"
|
||||
" / * Incomplete comment */ /* /* multiple comments */ */";
|
||||
|
||||
const char* szTestResult =
|
||||
" \n"
|
||||
"valid text "
|
||||
" "
|
||||
" / * Incomplete comment */ */";
|
||||
|
||||
char* szTest2 = new char[::strlen(szTest)+1];
|
||||
::strcpy(szTest2,szTest);
|
||||
|
||||
CommentRemover::RemoveMultiLineComments("/*","*/",szTest2,' ');
|
||||
CPPUNIT_ASSERT(0 == ::strcmp(szTest2,szTestResult));
|
||||
|
||||
delete[] szTest2;
|
||||
}
|
||||
Reference in New Issue
Block a user