aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/stringview.cpp
blob: 953a7de99603fe5cc378833b5a382836f3ad09c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <catch2/catch.hpp>

#include <vcpkg/base/stringview.h>

template<std::size_t N>
static vcpkg::StringView sv(const char (&cstr)[N])
{
    return cstr;
}

TEST_CASE ("string view operator==", "[stringview]")
{
    // these are due to a bug in operator==
    // see commit 782723959399a1a0725ac49
    REQUIRE(sv("hey") != sv("heys"));
    REQUIRE(sv("heys") != sv("hey"));
    REQUIRE(sv("hey") == sv("hey"));
    REQUIRE(sv("hey") != sv("hex"));
}