From: <sv...@ww...> - 2005-12-04 21:17:44
|
Author: mkrose Date: 2005-12-04 13:17:37 -0800 (Sun, 04 Dec 2005) New Revision: 1716 Removed: trunk/CSP/csp/csplib/util/test_FileUtility.cpp trunk/CSP/csp/csplib/util/test_Ref.cpp Log: Remove tests that have already been copied to the test/ subdirectory (but which should have been moved). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1716 Deleted: trunk/CSP/csp/csplib/util/test_FileUtility.cpp =================================================================== --- trunk/CSP/csp/csplib/util/test_FileUtility.cpp 2005-12-04 21:15:53 UTC (rev 1715) +++ trunk/CSP/csp/csplib/util/test_FileUtility.cpp 2005-12-04 21:17:37 UTC (rev 1716) @@ -1,80 +0,0 @@ -/* Combat Simulator Project - * Copyright (C) 2004 Mark Rose <mk...@us...> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -/** - * @file test_FileUtility.h - * @brief Test file utilites. - */ - - -#include <csp/lib/util/FileUtility.h> -#include <csp/lib/util/Testing.h> - -using namespace csp::ospath; - -CSP_TESTFIXTURE(FileUtility) { - - CSP_TESTCASE(PathManipulation) { - // test directory (minimal!) - DirectoryContents dc = getDirectoryContents("."); - assert(dc.size() > 0); - - // test file extension - CSP_VERIFY_EQ(getFileExtension("/foo/bar.baz"), "baz"); - CSP_VERIFY_EQ(getFileExtension("\\foo\\bar.baz"), "baz"); - CSP_VERIFY_EQ(getFileExtension("/foo/bar.baz.bif"), "bif"); - CSP_VERIFY_EQ(getFileExtension("\\foo\\bar.baz.bif"), "bif"); - CSP_VERIFY_EQ(getFileExtension("/foo.dir/bar"), ""); - CSP_VERIFY_EQ(getFileExtension("\\foo.dir\\bar"), ""); - CSP_VERIFY_EQ(getFileExtension("/foo.dir/bar.x"), "x"); - CSP_VERIFY_EQ(getFileExtension("\\foo.dir\\bar.x"), "x"); - CSP_VERIFY_EQ(getFileExtension("bar.x"), "x"); - CSP_VERIFY_EQ(getFileExtension("/bar.x"), "x"); - CSP_VERIFY_EQ(getFileExtension("\\bar.x"), "x"); - CSP_VERIFY_EQ(getFileExtension("bar"), ""); - CSP_VERIFY_EQ(getFileExtension("/bar"), ""); - CSP_VERIFY_EQ(getFileExtension("\\bar"), ""); - CSP_VERIFY_EQ(getFileExtension(""), ""); - - // test file extension stripping - std::string path; - path = "/foo/bar.baz"; - CSP_VERIFY_EQ(stripFileExtension(path), "baz"); - CSP_VERIFY_EQ(path, "/foo/bar"); - path = "\\foo\\bar.baz"; - CSP_VERIFY_EQ(stripFileExtension(path), "baz"); - CSP_VERIFY_EQ(path, "\\foo\\bar"); - path = "/foo/bar.baz.bif"; - CSP_VERIFY_EQ(stripFileExtension(path), "bif"); - CSP_VERIFY_EQ(path, "/foo/bar.baz"); - path = "foo.bif"; - CSP_VERIFY_EQ(stripFileExtension(path), "bif"); - CSP_VERIFY_EQ(path, "foo"); - path = "foobar"; - CSP_VERIFY_EQ(stripFileExtension(path), ""); - CSP_VERIFY_EQ(path, "foobar"); - path = ".foobar"; - CSP_VERIFY_EQ(stripFileExtension(path), "foobar"); - CSP_VERIFY_EQ(path, ""); - path = ""; - CSP_VERIFY_EQ(stripFileExtension(path), ""); - CSP_VERIFY_EQ(path, ""); - } -}; - Deleted: trunk/CSP/csp/csplib/util/test_Ref.cpp =================================================================== --- trunk/CSP/csp/csplib/util/test_Ref.cpp 2005-12-04 21:15:53 UTC (rev 1715) +++ trunk/CSP/csp/csplib/util/test_Ref.cpp 2005-12-04 21:17:37 UTC (rev 1716) @@ -1,64 +0,0 @@ -/* Combat Simulator Project - * Copyright (C) 2004 Mark Rose <mk...@us...> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -/** - * @file test_Ref.h - * @brief Test reference counting. - */ - - -#include <csp/lib/util/Ref.h> -#include <csp/lib/util/Testing.h> - - -CSP_TESTFIXTURE(Ref) { - - struct R: public csp::Referenced { - int &m_count; - R(int &count): m_count(count) { ++m_count; } - ~R() { --m_count; } - }; - - typedef csp::Ref<R> Ref; - - CSP_TESTCASE(Count) { - int count = 0; - CSP_VERIFY_EQ(count, 0); - Ref x = new R(count); - CSP_VERIFY_EQ(count, 1); - { - Ref y = x; - CSP_VERIFY_EQ(count, 1); - } - CSP_VERIFY_EQ(count, 1); - { - Ref y = new R(count); - CSP_VERIFY_EQ(count, 2); - y = x; - CSP_VERIFY_EQ(count, 1); - y = new R(count); - CSP_VERIFY_EQ(count, 2); - } - CSP_VERIFY_EQ(count, 1); - x = 0; - CSP_VERIFY_EQ(count, 0); - } -}; - - |