https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 8b696ce71200ca397c7960249fea8df3c32ea5bd authored by Tom Fischer on 17 January 2023, 09:06:11 UTC
Merge branch 'GMLOutput' into 'master'
Tip revision: 8b696ce
TestFilePathStringManipulation.cpp
/**
 * \file
 * \author
 * \date
 * \brief
 *
 * \copyright
 * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 */

#include <gtest/gtest.h>

#include "BaseLib/FileTools.h"

#ifdef WIN32
TEST(BaseLib, CopyPathToFileNameWin)
{
    ASSERT_EQ("extend\\file", BaseLib::copyPathToFileName("file", "extend"));
    ASSERT_EQ("path\\file",
              BaseLib::copyPathToFileName("path\\file", "extend"));
    ASSERT_EQ("extend\\file", BaseLib::copyPathToFileName("file", "extend\\"));
    ASSERT_EQ("path\\file",
              BaseLib::copyPathToFileName("path\\file", "extend\\"));
    ASSERT_EQ("extend\\smth\\file",
              BaseLib::copyPathToFileName("file", "extend\\smth"));
    ASSERT_EQ("path\\file",
              BaseLib::copyPathToFileName("path\\file", "extend\\smth"));
}
#else
TEST(BaseLib, CopyPathToFileNameUnix)
{
    ASSERT_EQ("extend/file", BaseLib::copyPathToFileName("file", "extend"));
    ASSERT_EQ("path/file", BaseLib::copyPathToFileName("path/file", "extend"));
    ASSERT_EQ("extend/file", BaseLib::copyPathToFileName("file", "extend/"));
    ASSERT_EQ("path/file", BaseLib::copyPathToFileName("path/file", "extend/"));

    ASSERT_EQ("extend/smth/file",
              BaseLib::copyPathToFileName("file", "extend/smth"));
    ASSERT_EQ("path/file",
              BaseLib::copyPathToFileName("path/file", "extend/smth"));
}
#endif
back to top