| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // <string> |
| 10 | |
| 11 | // size_type find_first_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 |
| 12 | |
| 13 | #include <string> |
| 14 | #include <cassert> |
| 15 | |
| 16 | #include "test_macros.h" |
| 17 | #include "min_allocator.h" |
| 18 | |
| 19 | template <class S> |
| 20 | TEST_CONSTEXPR_CXX20 void |
| 21 | test(const S& s, |
| 22 | const typename S::value_type* str, |
| 23 | typename S::size_type pos, |
| 24 | typename S::size_type n, |
| 25 | typename S::size_type x) { |
| 26 | LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos, n)); |
| 27 | assert(s.find_first_of(str, pos, n) == x); |
| 28 | if (x != S::npos) |
| 29 | assert(pos <= x && x < s.size()); |
| 30 | } |
| 31 | |
| 32 | template <class S> |
| 33 | TEST_CONSTEXPR_CXX20 void test0() { |
| 34 | test(S("" ), "" , 0, 0, S::npos); |
| 35 | test(S("" ), "irkhs" , 0, 0, S::npos); |
| 36 | test(S("" ), "kante" , 0, 1, S::npos); |
| 37 | test(S("" ), "oknlr" , 0, 2, S::npos); |
| 38 | test(S("" ), "pcdro" , 0, 4, S::npos); |
| 39 | test(S("" ), "bnrpe" , 0, 5, S::npos); |
| 40 | test(S("" ), "jtdaefblso" , 0, 0, S::npos); |
| 41 | test(S("" ), "oselktgbca" , 0, 1, S::npos); |
| 42 | test(S("" ), "eqgaplhckj" , 0, 5, S::npos); |
| 43 | test(S("" ), "bjahtcmnlp" , 0, 9, S::npos); |
| 44 | test(S("" ), "hjlcmgpket" , 0, 10, S::npos); |
| 45 | test(S("" ), "htaobedqikfplcgjsmrn" , 0, 0, S::npos); |
| 46 | test(S("" ), "hpqiarojkcdlsgnmfetb" , 0, 1, S::npos); |
| 47 | test(S("" ), "dfkaprhjloqetcsimnbg" , 0, 10, S::npos); |
| 48 | test(S("" ), "ihqrfebgadntlpmjksoc" , 0, 19, S::npos); |
| 49 | test(S("" ), "ngtjfcalbseiqrphmkdo" , 0, 20, S::npos); |
| 50 | test(S("" ), "" , 1, 0, S::npos); |
| 51 | test(S("" ), "lbtqd" , 1, 0, S::npos); |
| 52 | test(S("" ), "tboim" , 1, 1, S::npos); |
| 53 | test(S("" ), "slcer" , 1, 2, S::npos); |
| 54 | test(S("" ), "cbjfs" , 1, 4, S::npos); |
| 55 | test(S("" ), "aqibs" , 1, 5, S::npos); |
| 56 | test(S("" ), "gtfblmqinc" , 1, 0, S::npos); |
| 57 | test(S("" ), "mkqpbtdalg" , 1, 1, S::npos); |
| 58 | test(S("" ), "kphatlimcd" , 1, 5, S::npos); |
| 59 | test(S("" ), "pblasqogic" , 1, 9, S::npos); |
| 60 | test(S("" ), "arosdhcfme" , 1, 10, S::npos); |
| 61 | test(S("" ), "blkhjeogicatqfnpdmsr" , 1, 0, S::npos); |
| 62 | test(S("" ), "bmhineprjcoadgstflqk" , 1, 1, S::npos); |
| 63 | test(S("" ), "djkqcmetslnghpbarfoi" , 1, 10, S::npos); |
| 64 | test(S("" ), "lgokshjtpbemarcdqnfi" , 1, 19, S::npos); |
| 65 | test(S("" ), "bqjhtkfepimcnsgrlado" , 1, 20, S::npos); |
| 66 | test(S("eaint" ), "" , 0, 0, S::npos); |
| 67 | test(S("binja" ), "gfsrt" , 0, 0, S::npos); |
| 68 | test(S("latkm" ), "pfsoc" , 0, 1, S::npos); |
| 69 | test(S("lecfr" ), "tpflm" , 0, 2, S::npos); |
| 70 | test(S("eqkst" ), "sgkec" , 0, 4, 0); |
| 71 | test(S("cdafr" ), "romds" , 0, 5, 1); |
| 72 | test(S("prbhe" ), "qhjistlgmr" , 0, 0, S::npos); |
| 73 | test(S("lbisk" ), "pedfirsglo" , 0, 1, S::npos); |
| 74 | test(S("hrlpd" ), "aqcoslgrmk" , 0, 5, S::npos); |
| 75 | test(S("ehmja" ), "dabckmepqj" , 0, 9, 0); |
| 76 | test(S("mhqgd" ), "pqscrjthli" , 0, 10, 1); |
| 77 | test(S("tgklq" ), "kfphdcsjqmobliagtren" , 0, 0, S::npos); |
| 78 | test(S("bocjs" ), "rokpefncljibsdhqtagm" , 0, 1, S::npos); |
| 79 | test(S("grbsd" ), "afionmkphlebtcjqsgrd" , 0, 10, S::npos); |
| 80 | test(S("ofjqr" ), "aenmqplidhkofrjbctsg" , 0, 19, 0); |
| 81 | test(S("btlfi" ), "osjmbtcadhiklegrpqnf" , 0, 20, 0); |
| 82 | test(S("clrgb" ), "" , 1, 0, S::npos); |
| 83 | test(S("tjmek" ), "osmia" , 1, 0, S::npos); |
| 84 | test(S("bgstp" ), "ckonl" , 1, 1, S::npos); |
| 85 | test(S("hstrk" ), "ilcaj" , 1, 2, S::npos); |
| 86 | test(S("kmspj" ), "lasiq" , 1, 4, 2); |
| 87 | test(S("tjboh" ), "kfqmr" , 1, 5, S::npos); |
| 88 | test(S("ilbcj" ), "klnitfaobg" , 1, 0, S::npos); |
| 89 | test(S("jkngf" ), "gjhmdlqikp" , 1, 1, 3); |
| 90 | test(S("gfcql" ), "skbgtahqej" , 1, 5, S::npos); |
| 91 | test(S("dqtlg" ), "bjsdgtlpkf" , 1, 9, 2); |
| 92 | test(S("bthpg" ), "bjgfmnlkio" , 1, 10, 4); |
| 93 | test(S("dgsnq" ), "lbhepotfsjdqigcnamkr" , 1, 0, S::npos); |
| 94 | test(S("rmfhp" ), "tebangckmpsrqdlfojhi" , 1, 1, S::npos); |
| 95 | test(S("jfdam" ), "joflqbdkhtegimscpanr" , 1, 10, 1); |
| 96 | test(S("edapb" ), "adpmcohetfbsrjinlqkg" , 1, 19, 1); |
| 97 | test(S("brfsm" ), "iacldqjpfnogbsrhmetk" , 1, 20, 1); |
| 98 | test(S("ndrhl" ), "" , 2, 0, S::npos); |
| 99 | test(S("mrecp" ), "otkgb" , 2, 0, S::npos); |
| 100 | test(S("qlasf" ), "cqsjl" , 2, 1, S::npos); |
| 101 | test(S("smaqd" ), "dpifl" , 2, 2, 4); |
| 102 | test(S("hjeni" ), "oapht" , 2, 4, S::npos); |
| 103 | test(S("ocmfj" ), "cifts" , 2, 5, 3); |
| 104 | test(S("hmftq" ), "nmsckbgalo" , 2, 0, S::npos); |
| 105 | test(S("fklad" ), "tpksqhamle" , 2, 1, S::npos); |
| 106 | test(S("dirnm" ), "tpdrchmkji" , 2, 5, 2); |
| 107 | test(S("hrgdc" ), "ijagfkblst" , 2, 9, 2); |
| 108 | test(S("ifakg" ), "kpocsignjb" , 2, 10, 3); |
| 109 | test(S("ebrgd" ), "pecqtkjsnbdrialgmohf" , 2, 0, S::npos); |
| 110 | test(S("rcjml" ), "aiortphfcmkjebgsndql" , 2, 1, S::npos); |
| 111 | test(S("peqmt" ), "sdbkeamglhipojqftrcn" , 2, 10, 3); |
| 112 | test(S("frehn" ), "ljqncehgmfktroapidbs" , 2, 19, 2); |
| 113 | test(S("tqolf" ), "rtcfodilamkbenjghqps" , 2, 20, 2); |
| 114 | test(S("cjgao" ), "" , 4, 0, S::npos); |
| 115 | test(S("kjplq" ), "mabns" , 4, 0, S::npos); |
| 116 | test(S("herni" ), "bdnrp" , 4, 1, S::npos); |
| 117 | test(S("tadrb" ), "scidp" , 4, 2, S::npos); |
| 118 | test(S("pkfeo" ), "agbjl" , 4, 4, S::npos); |
| 119 | test(S("hoser" ), "jfmpr" , 4, 5, 4); |
| 120 | test(S("kgrsp" ), "rbpefghsmj" , 4, 0, S::npos); |
| 121 | test(S("pgejb" ), "apsfntdoqc" , 4, 1, S::npos); |
| 122 | test(S("thlnq" ), "ndkjeisgcl" , 4, 5, S::npos); |
| 123 | test(S("nbmit" ), "rnfpqatdeo" , 4, 9, 4); |
| 124 | test(S("jgmib" ), "bntjlqrfik" , 4, 10, 4); |
| 125 | test(S("ncrfj" ), "kcrtmpolnaqejghsfdbi" , 4, 0, S::npos); |
| 126 | test(S("ncsik" ), "lobheanpkmqidsrtcfgj" , 4, 1, S::npos); |
| 127 | test(S("sgbfh" ), "athdkljcnreqbgpmisof" , 4, 10, 4); |
| 128 | test(S("dktbn" ), "qkdmjialrscpbhefgont" , 4, 19, 4); |
| 129 | test(S("fthqm" ), "dmasojntqleribkgfchp" , 4, 20, 4); |
| 130 | test(S("klopi" ), "" , 5, 0, S::npos); |
| 131 | test(S("dajhn" ), "psthd" , 5, 0, S::npos); |
| 132 | test(S("jbgno" ), "rpmjd" , 5, 1, S::npos); |
| 133 | test(S("hkjae" ), "dfsmk" , 5, 2, S::npos); |
| 134 | } |
| 135 | |
| 136 | template <class S> |
| 137 | TEST_CONSTEXPR_CXX20 void test1() { |
| 138 | test(S("gbhqo" ), "skqne" , 5, 4, S::npos); |
| 139 | test(S("ktdor" ), "kipnf" , 5, 5, S::npos); |
| 140 | test(S("ldprn" ), "hmrnqdgifl" , 5, 0, S::npos); |
| 141 | test(S("egmjk" ), "fsmjcdairn" , 5, 1, S::npos); |
| 142 | test(S("armql" ), "pcdgltbrfj" , 5, 5, S::npos); |
| 143 | test(S("cdhjo" ), "aekfctpirg" , 5, 9, S::npos); |
| 144 | test(S("jcons" ), "ledihrsgpf" , 5, 10, S::npos); |
| 145 | test(S("cbrkp" ), "mqcklahsbtirgopefndj" , 5, 0, S::npos); |
| 146 | test(S("fhgna" ), "kmlthaoqgecrnpdbjfis" , 5, 1, S::npos); |
| 147 | test(S("ejfcd" ), "sfhbamcdptojlkrenqgi" , 5, 10, S::npos); |
| 148 | test(S("kqjhe" ), "pbniofmcedrkhlstgaqj" , 5, 19, S::npos); |
| 149 | test(S("pbdjl" ), "mongjratcskbhqiepfdl" , 5, 20, S::npos); |
| 150 | test(S("gajqn" ), "" , 6, 0, S::npos); |
| 151 | test(S("stedk" ), "hrnat" , 6, 0, S::npos); |
| 152 | test(S("tjkaf" ), "gsqdt" , 6, 1, S::npos); |
| 153 | test(S("dthpe" ), "bspkd" , 6, 2, S::npos); |
| 154 | test(S("klhde" ), "ohcmb" , 6, 4, S::npos); |
| 155 | test(S("bhlki" ), "heatr" , 6, 5, S::npos); |
| 156 | test(S("lqmoh" ), "pmblckedfn" , 6, 0, S::npos); |
| 157 | test(S("mtqin" ), "aceqmsrbik" , 6, 1, S::npos); |
| 158 | test(S("dpqbr" ), "lmbtdehjrn" , 6, 5, S::npos); |
| 159 | test(S("kdhmo" ), "teqmcrlgib" , 6, 9, S::npos); |
| 160 | test(S("jblqp" ), "njolbmspac" , 6, 10, S::npos); |
| 161 | test(S("qmjgl" ), "pofnhidklamecrbqjgst" , 6, 0, S::npos); |
| 162 | test(S("rothp" ), "jbhckmtgrqnosafedpli" , 6, 1, S::npos); |
| 163 | test(S("ghknq" ), "dobntpmqklicsahgjerf" , 6, 10, S::npos); |
| 164 | test(S("eopfi" ), "tpdshainjkbfoemlrgcq" , 6, 19, S::npos); |
| 165 | test(S("dsnmg" ), "oldpfgeakrnitscbjmqh" , 6, 20, S::npos); |
| 166 | test(S("jnkrfhotgl" ), "" , 0, 0, S::npos); |
| 167 | test(S("dltjfngbko" ), "rqegt" , 0, 0, S::npos); |
| 168 | test(S("bmjlpkiqde" ), "dashm" , 0, 1, 8); |
| 169 | test(S("skrflobnqm" ), "jqirk" , 0, 2, 8); |
| 170 | test(S("jkpldtshrm" ), "rckeg" , 0, 4, 1); |
| 171 | test(S("ghasdbnjqo" ), "jscie" , 0, 5, 3); |
| 172 | test(S("igrkhpbqjt" ), "efsphndliq" , 0, 0, S::npos); |
| 173 | test(S("ikthdgcamf" ), "gdicosleja" , 0, 1, 5); |
| 174 | test(S("pcofgeniam" ), "qcpjibosfl" , 0, 5, 0); |
| 175 | test(S("rlfjgesqhc" ), "lrhmefnjcq" , 0, 9, 0); |
| 176 | test(S("itphbqsker" ), "dtablcrseo" , 0, 10, 1); |
| 177 | test(S("skjafcirqm" ), "apckjsftedbhgomrnilq" , 0, 0, S::npos); |
| 178 | test(S("tcqomarsfd" ), "pcbrgflehjtiadnsokqm" , 0, 1, S::npos); |
| 179 | test(S("rocfeldqpk" ), "nsiadegjklhobrmtqcpf" , 0, 10, 4); |
| 180 | test(S("cfpegndlkt" ), "cpmajdqnolikhgsbretf" , 0, 19, 0); |
| 181 | test(S("fqbtnkeasj" ), "jcflkntmgiqrphdosaeb" , 0, 20, 0); |
| 182 | test(S("shbcqnmoar" ), "" , 1, 0, S::npos); |
| 183 | test(S("bdoshlmfin" ), "ontrs" , 1, 0, S::npos); |
| 184 | test(S("khfrebnsgq" ), "pfkna" , 1, 1, S::npos); |
| 185 | test(S("getcrsaoji" ), "ekosa" , 1, 2, 1); |
| 186 | test(S("fjiknedcpq" ), "anqhk" , 1, 4, 4); |
| 187 | test(S("tkejgnafrm" ), "jekca" , 1, 5, 1); |
| 188 | test(S("jnakolqrde" ), "ikemsjgacf" , 1, 0, S::npos); |
| 189 | test(S("lcjptsmgbe" ), "arolgsjkhm" , 1, 1, S::npos); |
| 190 | test(S("itfsmcjorl" ), "oftkbldhre" , 1, 5, 1); |
| 191 | test(S("omchkfrjea" ), "gbkqdoeftl" , 1, 9, 4); |
| 192 | test(S("cigfqkated" ), "sqcflrgtim" , 1, 10, 1); |
| 193 | test(S("tscenjikml" ), "fmhbkislrjdpanogqcet" , 1, 0, S::npos); |
| 194 | test(S("qcpaemsinf" ), "rnioadktqlgpbcjsmhef" , 1, 1, S::npos); |
| 195 | test(S("gltkojeipd" ), "oakgtnldpsefihqmjcbr" , 1, 10, 1); |
| 196 | test(S("qistfrgnmp" ), "gbnaelosidmcjqktfhpr" , 1, 19, 1); |
| 197 | test(S("bdnpfcqaem" ), "akbripjhlosndcmqgfet" , 1, 20, 1); |
| 198 | test(S("ectnhskflp" ), "" , 5, 0, S::npos); |
| 199 | test(S("fgtianblpq" ), "pijag" , 5, 0, S::npos); |
| 200 | test(S("mfeqklirnh" ), "jrckd" , 5, 1, S::npos); |
| 201 | test(S("astedncjhk" ), "qcloh" , 5, 2, 6); |
| 202 | test(S("fhlqgcajbr" ), "thlmp" , 5, 4, S::npos); |
| 203 | test(S("epfhocmdng" ), "qidmo" , 5, 5, 6); |
| 204 | test(S("apcnsibger" ), "lnegpsjqrd" , 5, 0, S::npos); |
| 205 | test(S("aqkocrbign" ), "rjqdablmfs" , 5, 1, 5); |
| 206 | test(S("ijsmdtqgce" ), "enkgpbsjaq" , 5, 5, 7); |
| 207 | test(S("clobgsrken" ), "kdsgoaijfh" , 5, 9, 5); |
| 208 | test(S("jbhcfposld" ), "trfqgmckbe" , 5, 10, S::npos); |
| 209 | test(S("oqnpblhide" ), "igetsracjfkdnpoblhqm" , 5, 0, S::npos); |
| 210 | test(S("lroeasctif" ), "nqctfaogirshlekbdjpm" , 5, 1, S::npos); |
| 211 | test(S("bpjlgmiedh" ), "csehfgomljdqinbartkp" , 5, 10, 5); |
| 212 | test(S("pamkeoidrj" ), "qahoegcmplkfsjbdnitr" , 5, 19, 5); |
| 213 | test(S("espogqbthk" ), "dpteiajrqmsognhlfbkc" , 5, 20, 5); |
| 214 | test(S("shoiedtcjb" ), "" , 9, 0, S::npos); |
| 215 | test(S("ebcinjgads" ), "tqbnh" , 9, 0, S::npos); |
| 216 | test(S("dqmregkcfl" ), "akmle" , 9, 1, S::npos); |
| 217 | test(S("ngcrieqajf" ), "iqfkm" , 9, 2, S::npos); |
| 218 | test(S("qosmilgnjb" ), "tqjsr" , 9, 4, S::npos); |
| 219 | test(S("ikabsjtdfl" ), "jplqg" , 9, 5, 9); |
| 220 | test(S("ersmicafdh" ), "oilnrbcgtj" , 9, 0, S::npos); |
| 221 | test(S("fdnplotmgh" ), "morkglpesn" , 9, 1, S::npos); |
| 222 | test(S("fdbicojerm" ), "dmicerngat" , 9, 5, 9); |
| 223 | test(S("mbtafndjcq" ), "radgeskbtc" , 9, 9, S::npos); |
| 224 | test(S("mlenkpfdtc" ), "ljikprsmqo" , 9, 10, S::npos); |
| 225 | test(S("ahlcifdqgs" ), "trqihkcgsjamfdbolnpe" , 9, 0, S::npos); |
| 226 | test(S("bgjemaltks" ), "lqmthbsrekajgnofcipd" , 9, 1, S::npos); |
| 227 | test(S("pdhslbqrfc" ), "jtalmedribkgqsopcnfh" , 9, 10, S::npos); |
| 228 | test(S("dirhtsnjkc" ), "spqfoiclmtagejbndkrh" , 9, 19, 9); |
| 229 | test(S("dlroktbcja" ), "nmotklspigjrdhcfaebq" , 9, 20, 9); |
| 230 | test(S("ncjpmaekbs" ), "" , 10, 0, S::npos); |
| 231 | test(S("hlbosgmrak" ), "hpmsd" , 10, 0, S::npos); |
| 232 | test(S("pqfhsgilen" ), "qnpor" , 10, 1, S::npos); |
| 233 | test(S("gqtjsbdckh" ), "otdma" , 10, 2, S::npos); |
| 234 | test(S("cfkqpjlegi" ), "efhjg" , 10, 4, S::npos); |
| 235 | test(S("beanrfodgj" ), "odpte" , 10, 5, S::npos); |
| 236 | test(S("adtkqpbjfi" ), "bctdgfmolr" , 10, 0, S::npos); |
| 237 | test(S("iomkfthagj" ), "oaklidrbqg" , 10, 1, S::npos); |
| 238 | } |
| 239 | |
| 240 | template <class S> |
| 241 | TEST_CONSTEXPR_CXX20 void test2() { |
| 242 | test(S("sdpcilonqj" ), "dnjfsagktr" , 10, 5, S::npos); |
| 243 | test(S("gtfbdkqeml" ), "nejaktmiqg" , 10, 9, S::npos); |
| 244 | test(S("bmeqgcdorj" ), "pjqonlebsf" , 10, 10, S::npos); |
| 245 | test(S("etqlcanmob" ), "dshmnbtolcjepgaikfqr" , 10, 0, S::npos); |
| 246 | test(S("roqmkbdtia" ), "iogfhpabtjkqlrnemcds" , 10, 1, S::npos); |
| 247 | test(S("kadsithljf" ), "ngridfabjsecpqltkmoh" , 10, 10, S::npos); |
| 248 | test(S("sgtkpbfdmh" ), "athmknplcgofrqejsdib" , 10, 19, S::npos); |
| 249 | test(S("qgmetnabkl" ), "ldobhmqcafnjtkeisgrp" , 10, 20, S::npos); |
| 250 | test(S("cqjohampgd" ), "" , 11, 0, S::npos); |
| 251 | test(S("hobitmpsan" ), "aocjb" , 11, 0, S::npos); |
| 252 | test(S("tjehkpsalm" ), "jbrnk" , 11, 1, S::npos); |
| 253 | test(S("ngfbojitcl" ), "tqedg" , 11, 2, S::npos); |
| 254 | test(S("rcfkdbhgjo" ), "nqskp" , 11, 4, S::npos); |
| 255 | test(S("qghptonrea" ), "eaqkl" , 11, 5, S::npos); |
| 256 | test(S("hnprfgqjdl" ), "reaoicljqm" , 11, 0, S::npos); |
| 257 | test(S("hlmgabenti" ), "lsftgajqpm" , 11, 1, S::npos); |
| 258 | test(S("ofcjanmrbs" ), "rlpfogmits" , 11, 5, S::npos); |
| 259 | test(S("jqedtkornm" ), "shkncmiaqj" , 11, 9, S::npos); |
| 260 | test(S("rfedlasjmg" ), "fpnatrhqgs" , 11, 10, S::npos); |
| 261 | test(S("talpqjsgkm" ), "sjclemqhnpdbgikarfot" , 11, 0, S::npos); |
| 262 | test(S("lrkcbtqpie" ), "otcmedjikgsfnqbrhpla" , 11, 1, S::npos); |
| 263 | test(S("cipogdskjf" ), "bonsaefdqiprkhlgtjcm" , 11, 10, S::npos); |
| 264 | test(S("nqedcojahi" ), "egpscmahijlfnkrodqtb" , 11, 19, S::npos); |
| 265 | test(S("hefnrkmctj" ), "kmqbfepjthgilscrndoa" , 11, 20, S::npos); |
| 266 | test(S("atqirnmekfjolhpdsgcb" ), "" , 0, 0, S::npos); |
| 267 | test(S("echfkmlpribjnqsaogtd" ), "prboq" , 0, 0, S::npos); |
| 268 | test(S("qnhiftdgcleajbpkrosm" ), "fjcqh" , 0, 1, 4); |
| 269 | test(S("chamfknorbedjitgslpq" ), "fmosa" , 0, 2, 3); |
| 270 | test(S("njhqpibfmtlkaecdrgso" ), "qdbok" , 0, 4, 3); |
| 271 | test(S("ebnghfsqkprmdcljoiat" ), "amslg" , 0, 5, 3); |
| 272 | test(S("letjomsgihfrpqbkancd" ), "smpltjneqb" , 0, 0, S::npos); |
| 273 | test(S("nblgoipcrqeaktshjdmf" ), "flitskrnge" , 0, 1, 19); |
| 274 | test(S("cehkbngtjoiflqapsmrd" ), "pgqihmlbef" , 0, 5, 2); |
| 275 | test(S("mignapfoklbhcqjetdrs" ), "cfpdqjtgsb" , 0, 9, 2); |
| 276 | test(S("ceatbhlsqjgpnokfrmdi" ), "htpsiaflom" , 0, 10, 2); |
| 277 | test(S("ocihkjgrdelpfnmastqb" ), "kpjfiaceghsrdtlbnomq" , 0, 0, S::npos); |
| 278 | test(S("noelgschdtbrjfmiqkap" ), "qhtbomidljgafneksprc" , 0, 1, 16); |
| 279 | test(S("dkclqfombepritjnghas" ), "nhtjobkcefldimpsaqgr" , 0, 10, 1); |
| 280 | test(S("miklnresdgbhqcojftap" ), "prabcjfqnoeskilmtgdh" , 0, 19, 0); |
| 281 | test(S("htbcigojaqmdkfrnlsep" ), "dtrgmchilkasqoebfpjn" , 0, 20, 0); |
| 282 | test(S("febhmqtjanokscdirpgl" ), "" , 1, 0, S::npos); |
| 283 | test(S("loakbsqjpcrdhftniegm" ), "sqome" , 1, 0, S::npos); |
| 284 | test(S("reagphsqflbitdcjmkno" ), "smfte" , 1, 1, 6); |
| 285 | test(S("jitlfrqemsdhkopncabg" ), "ciboh" , 1, 2, 1); |
| 286 | test(S("mhtaepscdnrjqgbkifol" ), "haois" , 1, 4, 1); |
| 287 | test(S("tocesrfmnglpbjihqadk" ), "abfki" , 1, 5, 6); |
| 288 | test(S("lpfmctjrhdagneskbqoi" ), "frdkocntmq" , 1, 0, S::npos); |
| 289 | test(S("lsmqaepkdhncirbtjfgo" ), "oasbpedlnr" , 1, 1, 19); |
| 290 | test(S("epoiqmtldrabnkjhcfsg" ), "kltqmhgand" , 1, 5, 4); |
| 291 | test(S("emgasrilpknqojhtbdcf" ), "gdtfjchpmr" , 1, 9, 1); |
| 292 | test(S("hnfiagdpcklrjetqbsom" ), "ponmcqblet" , 1, 10, 1); |
| 293 | test(S("nsdfebgajhmtricpoklq" ), "sgphqdnofeiklatbcmjr" , 1, 0, S::npos); |
| 294 | test(S("atjgfsdlpobmeiqhncrk" ), "ljqprsmigtfoneadckbh" , 1, 1, 7); |
| 295 | test(S("sitodfgnrejlahcbmqkp" ), "ligeojhafnkmrcsqtbdp" , 1, 10, 1); |
| 296 | test(S("fraghmbiceknltjpqosd" ), "lsimqfnjarbopedkhcgt" , 1, 19, 1); |
| 297 | test(S("pmafenlhqtdbkirjsogc" ), "abedmfjlghniorcqptks" , 1, 20, 1); |
| 298 | test(S("pihgmoeqtnakrjslcbfd" ), "" , 10, 0, S::npos); |
| 299 | test(S("gjdkeprctqblnhiafsom" ), "hqtoa" , 10, 0, S::npos); |
| 300 | test(S("mkpnblfdsahrcqijteog" ), "cahif" , 10, 1, 12); |
| 301 | test(S("gckarqnelodfjhmbptis" ), "kehis" , 10, 2, S::npos); |
| 302 | test(S("gqpskidtbclomahnrjfe" ), "kdlmh" , 10, 4, 10); |
| 303 | test(S("pkldjsqrfgitbhmaecno" ), "paeql" , 10, 5, 15); |
| 304 | test(S("aftsijrbeklnmcdqhgop" ), "aghoqiefnb" , 10, 0, S::npos); |
| 305 | test(S("mtlgdrhafjkbiepqnsoc" ), "jrbqaikpdo" , 10, 1, S::npos); |
| 306 | test(S("pqgirnaefthokdmbsclj" ), "smjonaeqcl" , 10, 5, 11); |
| 307 | test(S("kpdbgjmtherlsfcqoina" ), "eqbdrkcfah" , 10, 9, 10); |
| 308 | test(S("jrlbothiknqmdgcfasep" ), "kapmsienhf" , 10, 10, 11); |
| 309 | test(S("mjogldqferckabinptsh" ), "jpqotrlenfcsbhkaimdg" , 10, 0, S::npos); |
| 310 | test(S("apoklnefbhmgqcdrisjt" ), "jlbmhnfgtcqprikeados" , 10, 1, 18); |
| 311 | test(S("ifeopcnrjbhkdgatmqls" ), "stgbhfmdaljnpqoicker" , 10, 10, 10); |
| 312 | test(S("ckqhaiesmjdnrgolbtpf" ), "oihcetflbjagdsrkmqpn" , 10, 19, 10); |
| 313 | test(S("bnlgapfimcoterskqdjh" ), "adtclebmnpjsrqfkigoh" , 10, 20, 10); |
| 314 | test(S("kgdlrobpmjcthqsafeni" ), "" , 19, 0, S::npos); |
| 315 | test(S("dfkechomjapgnslbtqir" ), "beafg" , 19, 0, S::npos); |
| 316 | test(S("rloadknfbqtgmhcsipje" ), "iclat" , 19, 1, S::npos); |
| 317 | test(S("mgjhkolrnadqbpetcifs" ), "rkhnf" , 19, 2, S::npos); |
| 318 | test(S("cmlfakiojdrgtbsphqen" ), "clshq" , 19, 4, S::npos); |
| 319 | test(S("kghbfipeomsntdalrqjc" ), "dtcoj" , 19, 5, 19); |
| 320 | test(S("eldiqckrnmtasbghjfpo" ), "rqosnjmfth" , 19, 0, S::npos); |
| 321 | test(S("abqjcfedgotihlnspkrm" ), "siatdfqglh" , 19, 1, S::npos); |
| 322 | test(S("qfbadrtjsimkolcenhpg" ), "mrlshtpgjq" , 19, 5, S::npos); |
| 323 | test(S("abseghclkjqifmtodrnp" ), "adlcskgqjt" , 19, 9, S::npos); |
| 324 | test(S("ibmsnlrjefhtdokacqpg" ), "drshcjknaf" , 19, 10, S::npos); |
| 325 | test(S("mrkfciqjebaponsthldg" ), "etsaqroinghpkjdlfcbm" , 19, 0, S::npos); |
| 326 | test(S("mjkticdeoqshpalrfbgn" ), "sgepdnkqliambtrocfhj" , 19, 1, S::npos); |
| 327 | test(S("rqnoclbdejgiphtfsakm" ), "nlmcjaqgbsortfdihkpe" , 19, 10, 19); |
| 328 | test(S("plkqbhmtfaeodjcrsing" ), "racfnpmosldibqkghjet" , 19, 19, 19); |
| 329 | test(S("oegalhmstjrfickpbndq" ), "fjhdsctkqeiolagrnmbp" , 19, 20, 19); |
| 330 | test(S("rdtgjcaohpblniekmsfq" ), "" , 20, 0, S::npos); |
| 331 | test(S("ofkqbnjetrmsaidphglc" ), "ejanp" , 20, 0, S::npos); |
| 332 | test(S("grkpahljcftesdmonqib" ), "odife" , 20, 1, S::npos); |
| 333 | test(S("jimlgbhfqkteospardcn" ), "okaqd" , 20, 2, S::npos); |
| 334 | test(S("gftenihpmslrjkqadcob" ), "lcdbi" , 20, 4, S::npos); |
| 335 | test(S("bmhldogtckrfsanijepq" ), "fsqbj" , 20, 5, S::npos); |
| 336 | test(S("nfqkrpjdesabgtlcmoih" ), "bigdomnplq" , 20, 0, S::npos); |
| 337 | test(S("focalnrpiqmdkstehbjg" ), "apiblotgcd" , 20, 1, S::npos); |
| 338 | test(S("rhqdspkmebiflcotnjga" ), "acfhdenops" , 20, 5, S::npos); |
| 339 | test(S("rahdtmsckfboqlpniegj" ), "jopdeamcrk" , 20, 9, S::npos); |
| 340 | test(S("fbkeiopclstmdqranjhg" ), "trqncbkgmh" , 20, 10, S::npos); |
| 341 | test(S("lifhpdgmbconstjeqark" ), "tomglrkencbsfjqpihda" , 20, 0, S::npos); |
| 342 | } |
| 343 | |
| 344 | template <class S> |
| 345 | TEST_CONSTEXPR_CXX20 void test3() { |
| 346 | test(S("pboqganrhedjmltsicfk" ), "gbkhdnpoietfcmrslajq" , 20, 1, S::npos); |
| 347 | test(S("klchabsimetjnqgorfpd" ), "rtfnmbsglkjaichoqedp" , 20, 10, S::npos); |
| 348 | test(S("sirfgmjqhctndbklaepo" ), "ohkmdpfqbsacrtjnlgei" , 20, 19, S::npos); |
| 349 | test(S("rlbdsiceaonqjtfpghkm" ), "dlbrteoisgphmkncajfq" , 20, 20, S::npos); |
| 350 | test(S("ecgdanriptblhjfqskom" ), "" , 21, 0, S::npos); |
| 351 | test(S("fdmiarlpgcskbhoteqjn" ), "sjrlo" , 21, 0, S::npos); |
| 352 | test(S("rlbstjqopignecmfadkh" ), "qjpor" , 21, 1, S::npos); |
| 353 | test(S("grjpqmbshektdolcafni" ), "odhfn" , 21, 2, S::npos); |
| 354 | test(S("sakfcohtqnibprjmlged" ), "qtfin" , 21, 4, S::npos); |
| 355 | test(S("mjtdglasihqpocebrfkn" ), "hpqfo" , 21, 5, S::npos); |
| 356 | test(S("okaplfrntghqbmeicsdj" ), "fabmertkos" , 21, 0, S::npos); |
| 357 | test(S("sahngemrtcjidqbklfpo" ), "brqtgkmaej" , 21, 1, S::npos); |
| 358 | test(S("dlmsipcnekhbgoaftqjr" ), "nfrdeihsgl" , 21, 5, S::npos); |
| 359 | test(S("ahegrmqnoiklpfsdbcjt" ), "hlfrosekpi" , 21, 9, S::npos); |
| 360 | test(S("hdsjbnmlegtkqripacof" ), "atgbkrjdsm" , 21, 10, S::npos); |
| 361 | test(S("pcnedrfjihqbalkgtoms" ), "blnrptjgqmaifsdkhoec" , 21, 0, S::npos); |
| 362 | test(S("qjidealmtpskrbfhocng" ), "ctpmdahebfqjgknloris" , 21, 1, S::npos); |
| 363 | test(S("qeindtagmokpfhsclrbj" ), "apnkeqthrmlbfodiscgj" , 21, 10, S::npos); |
| 364 | test(S("kpfegbjhsrnodltqciam" ), "jdgictpframeoqlsbknh" , 21, 19, S::npos); |
| 365 | test(S("hnbrcplsjfgiktoedmaq" ), "qprlsfojamgndekthibc" , 21, 20, S::npos); |
| 366 | } |
| 367 | |
| 368 | template <class S> |
| 369 | TEST_CONSTEXPR_CXX20 void test_string() { |
| 370 | test0<S>(); |
| 371 | test1<S>(); |
| 372 | test2<S>(); |
| 373 | test3<S>(); |
| 374 | } |
| 375 | |
| 376 | TEST_CONSTEXPR_CXX20 bool test() { |
| 377 | test_string<std::string>(); |
| 378 | #if TEST_STD_VER >= 11 |
| 379 | test_string<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); |
| 380 | #endif |
| 381 | |
| 382 | return true; |
| 383 | } |
| 384 | |
| 385 | int main(int, char**) { |
| 386 | test(); |
| 387 | #if TEST_STD_VER > 17 |
| 388 | static_assert(test()); |
| 389 | #endif |
| 390 | |
| 391 | return 0; |
| 392 | } |
| 393 | |