summaryrefslogtreecommitdiff
path: root/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp')
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
new file mode 100644
index 0000000000000..06df185757d22
--- /dev/null
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// size_t converted() const;
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+ typedef std::codecvt_utf8<wchar_t> Codecvt;
+ typedef std::wstring_convert<Codecvt> Myconv;
+ Myconv myconv;
+ assert(myconv.converted() == 0);
+ std::string bs = myconv.to_bytes(L"\x40003");
+ assert(myconv.converted() == 1);
+ bs = myconv.to_bytes(L"\x40003\x65");
+ assert(myconv.converted() == 2);
+ std::wstring ws = myconv.from_bytes("\xF1\x80\x80\x83");
+ assert(myconv.converted() == 4);
+}