Lolly 1.4.28
Loading...
Searching...
No Matches
string_view_test.cpp
Go to the documentation of this file.
1
2/** \file string_view_test.cpp
3 * \copyright GPLv3
4 * \details Test for string_view
5 * \author jingkaimori
6 * \date 2024
7 */
8
9#include "a_lolly_test.hpp"
12#include <doctest/doctest.h>
13
15
16TEST_CASE ("construct string_view") {
17 const char16_t arr[6]= u"hello";
18 CHECK (string_u16_view (arr) == u"hello");
19 const char16_t arr3[6]= {u'5', u'c', u'h', u'a', u'r', u's'};
20 CHECK (string_u16_view (arr3) == u"5char");
21
22 const char16_t arr11[12]= u"hello";
23 string_u16_view view11 = string_u16_view (arr11);
24 CHECK (view11.N == 11);
25 CHECK (view11 (0, 5) == u"hello");
26
27 CHECK (string_u16_view (u"abc") == u"abc");
28
29 const char16_t* str= u"def";
30 CHECK (string_u16_view (str, 3) == u"def");
31
32 const std::u16string std_str (u"ghij");
33 CHECK (string_u16_view (std_str) == u"ghij");
34}
The list class represents a linked list.
Definition list.hpp:48
list(T item)
Construct a new list object with a single item.
Definition list.hpp:137
TEST_CASE("test for operator+= and advance()")