File: utils_no_dependencies_tests.cc

package info (click to toggle)
gnome-commander 1.18.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,796 kB
  • sloc: cpp: 44,531; xml: 3,929; lex: 600; sh: 80; makefile: 13
file content (48 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * @file utils_no_dependencies_test.cc
 * @brief Part of GNOME Commander - A GNOME based file manager
 *
 * @details In this file all tests are placed which belong to the
 * Boyer–Moore string search algorithm, used in the internal viewer of
 * GCMD. Currently, only a single test is implemented in which a short
 * pattern of integers is searched inside a bigger array of integers.
 *
 * @copyright (C) 2013-2024 Uwe Scholz\n
 *
 * @copyright 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.
 *
 * @copyright 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.
 *
 * @copyright 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <glib.h>
#include <gtest/gtest.h>
#include "../src/gnome-cmd-includes.h"
#include "../src/utils-no-dependencies.h"


TEST(StrUriBasename, ReturnNull)
{
    EXPECT_EQ (NULL, str_uri_basename(NULL));

    // If argument string length is shorter
    // than two bytes return null
    EXPECT_EQ (NULL, str_uri_basename((gchar*) "a"));
}


TEST(StrUriBasename, ReturnEscapedStringAfterLastSlash)
{
    EXPECT_STREQ ("xyz", str_uri_basename((gchar*) "http://xyz"));
    EXPECT_STREQ ("xyz?", str_uri_basename((gchar*) "http://xyz?"));
}