Fix compiling tests.

This commit is contained in:
Kimmo Varis 2010-03-12 17:21:41 +02:00
parent 7ea37de329
commit 95cbb60974
2 changed files with 26 additions and 15 deletions

View File

@ -262,6 +262,10 @@
RelativePath="..\lib\filelister.cpp"
>
</File>
<File
RelativePath="..\lib\filelister_win32.cpp"
>
</File>
<File
RelativePath="..\lib\mathlib.cpp"
>
@ -452,6 +456,10 @@
RelativePath="..\lib\filelister.h"
>
</File>
<File
RelativePath="..\lib\filelister_win32.h"
>
</File>
<File
RelativePath="..\lib\mathlib.h"
>

View File

@ -18,7 +18,12 @@
#include <string>
#include "testsuite.h"
#include "filelister.h"
#if defined(_WIN32)
#include "../lib/fileLister_win32.h"
#else // POSIX-style system
#include "../lib/filelister_unix.h"
#endif
class TestFileLister : public TestFixture
{
@ -35,21 +40,19 @@ private:
void simplify_path()
{
ASSERT_EQUALS("index.h", FileLister::simplifyPath("index.h"));
ASSERT_EQUALS("/index.h", FileLister::simplifyPath("/index.h"));
ASSERT_EQUALS("/path/", FileLister::simplifyPath("/path/"));
ASSERT_EQUALS("/", FileLister::simplifyPath("/"));
ASSERT_EQUALS("./index.h", FileLister::simplifyPath("./index.h"));
ASSERT_EQUALS("../index.h", FileLister::simplifyPath("../index.h"));
ASSERT_EQUALS("/index.h", FileLister::simplifyPath("/path/../index.h"));
ASSERT_EQUALS("/index.h", FileLister::simplifyPath("/path/../other/../index.h"));
ASSERT_EQUALS("/index.h", FileLister::simplifyPath("/path/../other///././../index.h"));
ASSERT_EQUALS("../path/index.h", FileLister::simplifyPath("../path/other/../index.h"));
ASSERT_EQUALS("a/index.h", FileLister::simplifyPath("a/../a/index.h"));
ASSERT_EQUALS("a/..", FileLister::simplifyPath("a/.."));
ASSERT_EQUALS("index.h", getFileLister()->simplifyPath("index.h"));
ASSERT_EQUALS("/index.h", getFileLister()->simplifyPath("/index.h"));
ASSERT_EQUALS("/path/", getFileLister()->simplifyPath("/path/"));
ASSERT_EQUALS("/", getFileLister()->simplifyPath("/"));
ASSERT_EQUALS("./index.h", getFileLister()->simplifyPath("./index.h"));
ASSERT_EQUALS("../index.h", getFileLister()->simplifyPath("../index.h"));
ASSERT_EQUALS("/index.h", getFileLister()->simplifyPath("/path/../index.h"));
ASSERT_EQUALS("/index.h", getFileLister()->simplifyPath("/path/../other/../index.h"));
ASSERT_EQUALS("/index.h", getFileLister()->simplifyPath("/path/../other///././../index.h"));
ASSERT_EQUALS("../path/index.h", getFileLister()->simplifyPath("../path/other/../index.h"));
ASSERT_EQUALS("a/index.h", getFileLister()->simplifyPath("a/../a/index.h"));
ASSERT_EQUALS("a/..", getFileLister()->simplifyPath("a/.."));
}
};
REGISTER_TEST(TestFileLister)