Lolly
1.4.28
Loading...
Searching...
No Matches
tests
lolly
data
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
"
10
#include "
lolly/data/string_u16.hpp
"
11
#include "
lolly/data/string_view.hpp
"
12
#include <doctest/doctest.h>
13
14
using
lolly::data::string_u16_view
;
15
16
TEST_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
}
a_lolly_test.hpp
list
The list class represents a linked list.
Definition
list.hpp:48
list::list
list(T item)
Construct a new list object with a single item.
Definition
list.hpp:137
lolly::data::string_view
Definition
string_view.hpp:24
TEST_CASE
TEST_CASE("test for operator+= and advance()")
Definition
parse_string_test.cpp:85
string_u16.hpp
string_view.hpp
Generated by
1.10.0