1 /************************************************************************
3 ** Copyright (C) 2011 John Schember
5 ** This file is part of FlightCrew.
7 ** FlightCrew is free software: you can redistribute it and/or modify
8 ** it under the terms of the GNU Lesser General Public License as published
9 ** by the Free Software Foundation, either version 3 of the License, or
10 ** (at your option) any later version.
12 ** FlightCrew is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU Lesser General Public License for more details.
17 ** You should have received a copy of the GNU Lesser General Public License
18 ** along with FlightCrew. If not, see <http://www.gnu.org/licenses/>.
20 *************************************************************************/
22 #include <stdafx_tests.h>
23 #include "Misc/Utilities.h"
24 #include "exception.h"
26 using namespace FlightCrew;
27 using namespace FlightCrew::Util;
29 TEST( NormalizePath, PathIsCorrect )
31 ASSERT_EQ( NormalizePath( "/var/folders/l3/image.html" ), Utf8PathToBoostPath( "/var/folders/l3/image.html" ) );
32 ASSERT_EQ( NormalizePath( "/var/folders/T/image.html" ), Utf8PathToBoostPath( "/var/folders/T/image.html" ) );
33 ASSERT_EQ( NormalizePath( "/var/folders/./image.html" ), Utf8PathToBoostPath( "/var/folders/image.html" ) );
34 ASSERT_EQ( NormalizePath( "/var/folders/../image.html" ), Utf8PathToBoostPath( "/var/image.html" ) );
35 ASSERT_EQ( NormalizePath( "/var/folders/../test/123/456/789/../.././abc/image.html" ), Utf8PathToBoostPath( "/var/test/123/abc/image.html" ) );
36 ASSERT_EQ( NormalizePath( "/var/folders/l3/_x3zf0jn3pz22r7_ktjtt0hw0000gn/T/Sigil/./scratchpad/2230a344-5ccb-42fa-99ab-29135345e11f/../../OEBPS/Text/../Images/ie5e3bpitabqoeb.png" ), Utf8PathToBoostPath( "/var/folders/l3/_x3zf0jn3pz22r7_ktjtt0hw0000gn/T/Sigil/OEBPS/Images/ie5e3bpitabqoeb.png" ) );