Mercurial > fife-parpg
comparison tests/core_tests/test_vfs.cpp @ 44:5a2db5e7ab54
renamed unittest++ based tests as they were with boost
author | jasoka@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 13 Jul 2008 07:52:58 +0000 |
parents | tests/core_tests/test_vfs++.cpp@4c8334b0ab30 |
children | 8c073dd2d3a3 |
comparison
equal
deleted
inserted
replaced
43:6daa907234e1 | 44:5a2db5e7ab54 |
---|---|
1 /*************************************************************************** | |
2 * Copyright (C) 2005-2008 by the FIFE team * | |
3 * http://www.fifengine.de * | |
4 * This file is part of FIFE. * | |
5 * * | |
6 * FIFE is free software; you can redistribute it and/or modify * | |
7 * it under the terms of the GNU General Public License as published by * | |
8 * the Free Software Foundation; either version 2 of the License, or * | |
9 * (at your option) any later version. * | |
10 * * | |
11 * This program is distributed in the hope that it will be useful, * | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
14 * GNU General Public License for more details. * | |
15 * * | |
16 * You should have received a copy of the GNU General Public License * | |
17 * along with this program; if not, write to the * | |
18 * Free Software Foundation, Inc., * | |
19 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * | |
20 ***************************************************************************/ | |
21 | |
22 // Standard C++ library includes | |
23 | |
24 // Platform specific includes | |
25 #include "fife_unittest++.h" | |
26 | |
27 // 3rd party library includes | |
28 #include <boost/scoped_ptr.hpp> | |
29 #include <boost/shared_ptr.hpp> | |
30 #include <boost/filesystem/convenience.hpp> | |
31 | |
32 // FIFE includes | |
33 // These includes are split up in two parts, separated by one empty line | |
34 // First block: files included from the FIFE root src directory | |
35 // Second block: files included from the same folder | |
36 #include "vfs/vfs.h" | |
37 #include "util/structures/rect.h" | |
38 #include "vfs/vfs.h" | |
39 #include "vfs/vfsdirectory.h" | |
40 #include "vfs/raw/rawdata.h" | |
41 #include "util/base/exception.h" | |
42 #include "vfs/directoryprovider.h" | |
43 | |
44 static const std::string FIFE_TEST_DIR = "fifetestdir"; | |
45 using namespace FIFE; | |
46 | |
47 TEST(test_is_directory) | |
48 { | |
49 boost::shared_ptr<VFS> vfs(new VFS()); | |
50 vfs->addSource(new VFSDirectory(vfs.get())); | |
51 | |
52 if(boost::filesystem::exists(FIFE_TEST_DIR+"/"+FIFE_TEST_DIR)) { | |
53 boost::filesystem::remove(FIFE_TEST_DIR+"/"+FIFE_TEST_DIR); | |
54 } | |
55 | |
56 if(boost::filesystem::exists(FIFE_TEST_DIR)) { | |
57 boost::filesystem::remove(FIFE_TEST_DIR); | |
58 } | |
59 CHECK(vfs->isDirectory("")); | |
60 CHECK(vfs->isDirectory("/")); | |
61 | |
62 CHECK(!vfs->isDirectory(FIFE_TEST_DIR)); | |
63 boost::filesystem::create_directory(FIFE_TEST_DIR); | |
64 CHECK(vfs->isDirectory(FIFE_TEST_DIR)); | |
65 CHECK(!vfs->isDirectory(FIFE_TEST_DIR+"/"+FIFE_TEST_DIR)); | |
66 boost::filesystem::create_directories(FIFE_TEST_DIR+"/"+FIFE_TEST_DIR); | |
67 CHECK(vfs->isDirectory(FIFE_TEST_DIR+"/"+FIFE_TEST_DIR)); | |
68 | |
69 } | |
70 | |
71 int main() { | |
72 return UnitTest::RunAllTests(); | |
73 } |