Home | History | Annotate | Download | only in string_assign

Lines Matching defs:sv

22 template <class S, class SV>
24 test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected)
26 if (pos <= sv.size())
28 s.assign(sv, pos, n);
37 s.assign(sv, pos, n);
42 assert(pos > sv.size());
48 template <class S, class SV>
50 test_npos(S s, SV sv, typename S::size_type pos, S expected)
52 if (pos <= sv.size())
54 s.assign(sv, pos);
63 s.assign(sv, pos);
68 assert(pos > sv.size());
78 typedef std::string_view SV;
79 test(S(), SV(), 0, 0, S());
80 test(S(), SV(), 1, 0, S());
81 test(S(), SV("12345"), 0, 3, S("123"));
82 test(S(), SV("12345"), 1, 4, S("2345"));
83 test(S(), SV("12345"), 3, 15, S("45"));
84 test(S(), SV("12345"), 5, 15, S(""));
85 test(S(), SV("12345"), 6, 15, S("not happening"));
86 test(S(), SV("12345678901234567890"), 0, 0, S());
87 test(S(), SV("12345678901234567890"), 1, 1, S("2"));
88 test(S(), SV("12345678901234567890"), 2, 3, S("345"));
89 test(S(), SV("12345678901234567890"), 12, 13, S("34567890"));
90 test(S(), SV("12345678901234567890"), 21, 13, S("not happening"));
92 test(S("12345"), SV(), 0, 0, S());
93 test(S("12345"), SV("12345"), 2, 2, S("34"));
94 test(S("12345"), SV("1234567890"), 0, 100, S("1234567890"));
96 test(S("12345678901234567890"), SV(), 0, 0, S());
97 test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
98 test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
104 typedef std::basic_string_view<char, std::char_traits<char> > SV;
105 test(S(), SV(), 0, 0, S());
106 test(S(), SV(), 1, 0, S());
107 test(S(), SV("12345"), 0, 3, S("123"));
108 test(S(), SV("12345"), 1, 4, S("2345"));
109 test(S(), SV("12345"), 3, 15, S("45"));
110 test(S(), SV("12345"), 5, 15, S(""));
111 test(S(), SV("12345"), 6, 15, S("not happening"));
112 test(S(), SV("12345678901234567890"), 0, 0, S());
113 test(S(), SV("12345678901234567890"), 1, 1, S("2"));
114 test(S(), SV("12345678901234567890"), 2, 3, S("345"));
115 test(S(), SV("12345678901234567890"), 12, 13, S("34567890"));
116 test(S(), SV("12345678901234567890"), 21, 13, S("not happening"));
118 test(S("12345"), SV(), 0, 0, S());
119 test(S("12345"), SV("12345"), 2, 2, S("34"));
120 test(S("12345"), SV("1234567890"), 0, 100, S("1234567890"));
122 test(S("12345678901234567890"), SV(), 0, 0, S());
123 test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
124 test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
130 typedef std::string_view SV;
131 test_npos(S(), SV(), 0, S());
132 test_npos(S(), SV(), 1, S());
133 test_npos(S(), SV("12345"), 0, S("12345"));
134 test_npos(S(), SV("12345"), 1, S("2345"));
135 test_npos(S(), SV("12345"), 3, S("45"));
136 test_npos(S(), SV("12345"), 5, S(""));
137 test_npos(S(), SV("12345"), 6, S("not happening"));
142 std::string_view sv = "EFGH";
153 s.assign(sv, 0); // calls assign(T, pos, npos)
154 assert(s == sv);
157 s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos)
158 assert(s == sv);
176 std::string_view sv = s;
177 s.assign(sv);
180 sv = s;
181 s.assign(sv, 0, std::string::npos);
187 std::string_view sv = s;
188 s.assign(sv);
191 sv = s;
192 s.assign(sv, 0, std::string::npos);