//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // template <> class codecvt // int length(stateT& state, const externT* from, const externT* from_end, size_t max) const; #include #include #include "test_macros.h" typedef std::codecvt F; int main(int, char**) { std::locale l = std::locale::classic(); const F& f = std::use_facet(l); std::mbstate_t mbs = {}; const char from[10]= {0}; assert(f.length(mbs, from, from+10, 0) == 0); assert(f.length(mbs, from, from+10, 9) == 9); assert(f.length(mbs, from, from+10, 10) == 10); assert(f.length(mbs, from, from+10, 11) == 10); assert(f.length(mbs, from, from+10, 100) == 10); return 0; }