Windows porting work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
#include <locale>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../../../platform_support.h" // locale name macros
|
||||
|
||||
class test
|
||||
: public std::ios
|
||||
{
|
||||
@@ -34,7 +36,7 @@ void f1(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
{
|
||||
if (ev == std::ios_base::imbue_event)
|
||||
{
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 4);
|
||||
++f1_called;
|
||||
}
|
||||
@@ -47,6 +49,6 @@ int main()
|
||||
b.register_callback(f1, 4);
|
||||
b.register_callback(f1, 4);
|
||||
b.register_callback(f1, 4);
|
||||
std::locale l = b.imbue(std::locale("en_US.UTF-8"));
|
||||
std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
|
||||
assert(f1_called == 3);
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <locale>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../../../platform_support.h" // locale name macros
|
||||
|
||||
class test
|
||||
: public std::ios
|
||||
{
|
||||
@@ -39,7 +41,7 @@ void f1(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!f1_called);
|
||||
assert( f2_called);
|
||||
assert( f3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 4);
|
||||
f1_called = true;
|
||||
}
|
||||
@@ -52,7 +54,7 @@ void f2(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!f1_called);
|
||||
assert(!f2_called);
|
||||
assert( f3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 5);
|
||||
f2_called = true;
|
||||
}
|
||||
@@ -65,7 +67,7 @@ void f3(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!f1_called);
|
||||
assert(!f2_called);
|
||||
assert(!f3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 6);
|
||||
f3_called = true;
|
||||
}
|
||||
@@ -78,9 +80,9 @@ int main()
|
||||
b.register_callback(f1, 4);
|
||||
b.register_callback(f2, 5);
|
||||
b.register_callback(f3, 6);
|
||||
std::locale l = b.imbue(std::locale("en_US.UTF-8"));
|
||||
std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
|
||||
assert(l.name() == std::string("C"));
|
||||
assert(b.getloc().name() == std::string("en_US.UTF-8"));
|
||||
assert(b.getloc().name() == std::string(LOCALE_en_US_UTF_8));
|
||||
assert(f1_called);
|
||||
assert(f2_called);
|
||||
assert(f3_called);
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../../../platform_support.h" // locale name macros
|
||||
|
||||
struct testbuf
|
||||
: public std::streambuf
|
||||
{
|
||||
@@ -38,7 +40,7 @@ void f1(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!g1_called);
|
||||
assert(!g2_called);
|
||||
assert(!g3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 4);
|
||||
f1_called = true;
|
||||
}
|
||||
@@ -53,7 +55,7 @@ void f2(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!g1_called);
|
||||
assert(!g2_called);
|
||||
assert(!g3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 5);
|
||||
f2_called = true;
|
||||
}
|
||||
@@ -68,7 +70,7 @@ void g1(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!g1_called);
|
||||
assert( g2_called);
|
||||
assert( g3_called);
|
||||
assert(stream.getloc().name() == "fr_FR.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
|
||||
assert(index == 7);
|
||||
g1_called = true;
|
||||
}
|
||||
@@ -83,7 +85,7 @@ void g2(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!g1_called);
|
||||
assert(!g2_called);
|
||||
assert( g3_called);
|
||||
assert(stream.getloc().name() == "fr_FR.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
|
||||
assert(index == 8);
|
||||
g2_called = true;
|
||||
}
|
||||
@@ -98,7 +100,7 @@ void g3(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!g1_called);
|
||||
assert(!g2_called);
|
||||
assert(!g3_called);
|
||||
assert(stream.getloc().name() == "fr_FR.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
|
||||
assert(index == 9);
|
||||
g3_called = true;
|
||||
}
|
||||
@@ -111,7 +113,7 @@ int main()
|
||||
ios1.flags(std::ios::boolalpha | std::ios::dec | std::ios::fixed);
|
||||
ios1.precision(1);
|
||||
ios1.width(11);
|
||||
ios1.imbue(std::locale("en_US.UTF-8"));
|
||||
ios1.imbue(std::locale(LOCALE_en_US_UTF_8));
|
||||
ios1.exceptions(std::ios::failbit);
|
||||
ios1.setstate(std::ios::eofbit);
|
||||
ios1.register_callback(f1, 4);
|
||||
@@ -131,7 +133,7 @@ int main()
|
||||
ios2.flags(std::ios::showpoint | std::ios::uppercase);
|
||||
ios2.precision(2);
|
||||
ios2.width(12);
|
||||
ios2.imbue(std::locale("fr_FR.UTF-8"));
|
||||
ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
|
||||
ios2.exceptions(std::ios::eofbit);
|
||||
ios2.setstate(std::ios::goodbit);
|
||||
ios2.register_callback(g1, 7);
|
||||
@@ -165,7 +167,7 @@ int main()
|
||||
assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
|
||||
assert(ios1.precision() == 2);
|
||||
assert(ios1.width() == 12);
|
||||
assert(ios1.getloc().name() == "fr_FR.UTF-8");
|
||||
assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
|
||||
assert(ios1.exceptions() == std::ios::eofbit);
|
||||
assert(f1_called);
|
||||
assert(f2_called);
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../../../platform_support.h" // locale name macros
|
||||
|
||||
struct testbuf
|
||||
: public std::streambuf
|
||||
{
|
||||
@@ -33,7 +35,7 @@ void f1(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!f1_called);
|
||||
assert( f2_called);
|
||||
assert( f3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 4);
|
||||
f1_called = true;
|
||||
}
|
||||
@@ -46,7 +48,7 @@ void f2(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!f1_called);
|
||||
assert(!f2_called);
|
||||
assert( f3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 5);
|
||||
f2_called = true;
|
||||
}
|
||||
@@ -59,7 +61,7 @@ void f3(std::ios_base::event ev, std::ios_base& stream, int index)
|
||||
assert(!f1_called);
|
||||
assert(!f2_called);
|
||||
assert(!f3_called);
|
||||
assert(stream.getloc().name() == "en_US.UTF-8");
|
||||
assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(index == 6);
|
||||
f3_called = true;
|
||||
}
|
||||
@@ -72,9 +74,9 @@ int main()
|
||||
ios.register_callback(f1, 4);
|
||||
ios.register_callback(f2, 5);
|
||||
ios.register_callback(f3, 6);
|
||||
std::locale l = ios.imbue(std::locale("en_US.UTF-8"));
|
||||
std::locale l = ios.imbue(std::locale(LOCALE_en_US_UTF_8));
|
||||
assert(l.name() == std::string("C"));
|
||||
assert(ios.getloc().name() == std::string("en_US.UTF-8"));
|
||||
assert(ios.getloc().name() == std::string(LOCALE_en_US_UTF_8));
|
||||
assert(f1_called);
|
||||
assert(f2_called);
|
||||
assert(f3_called);
|
||||
@@ -88,10 +90,10 @@ int main()
|
||||
ios.register_callback(f1, 4);
|
||||
ios.register_callback(f2, 5);
|
||||
ios.register_callback(f3, 6);
|
||||
std::locale l = ios.imbue(std::locale("en_US.UTF-8"));
|
||||
std::locale l = ios.imbue(std::locale(LOCALE_en_US_UTF_8));
|
||||
assert(l.name() == std::string("C"));
|
||||
assert(ios.getloc().name() == std::string("en_US.UTF-8"));
|
||||
assert(sb.getloc().name() == std::string("en_US.UTF-8"));
|
||||
assert(ios.getloc().name() == std::string(LOCALE_en_US_UTF_8));
|
||||
assert(sb.getloc().name() == std::string(LOCALE_en_US_UTF_8));
|
||||
assert(f1_called);
|
||||
assert(f2_called);
|
||||
assert(f3_called);
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../../../platform_support.h" // locale name macros
|
||||
|
||||
struct testbuf
|
||||
: public std::streambuf
|
||||
{
|
||||
@@ -82,7 +84,7 @@ int main()
|
||||
ios2.flags(std::ios::showpoint | std::ios::uppercase);
|
||||
ios2.precision(2);
|
||||
ios2.width(12);
|
||||
ios2.imbue(std::locale("fr_FR.UTF-8"));
|
||||
ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
|
||||
ios2.exceptions(std::ios::eofbit);
|
||||
ios2.setstate(std::ios::goodbit);
|
||||
ios2.register_callback(g1, 7);
|
||||
@@ -107,7 +109,7 @@ int main()
|
||||
assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
|
||||
assert(ios1.precision() == 2);
|
||||
assert(ios1.width() == 12);
|
||||
assert(ios1.getloc().name() == "fr_FR.UTF-8");
|
||||
assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
|
||||
assert(ios1.exceptions() == std::ios::eofbit);
|
||||
assert(!f1_called);
|
||||
assert(!f2_called);
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../../../platform_support.h" // locale name macros
|
||||
|
||||
struct testbuf
|
||||
: public std::streambuf
|
||||
{
|
||||
@@ -73,7 +75,7 @@ int main()
|
||||
ios1.flags(std::ios::boolalpha | std::ios::dec | std::ios::fixed);
|
||||
ios1.precision(1);
|
||||
ios1.width(11);
|
||||
ios1.imbue(std::locale("en_US.UTF-8"));
|
||||
ios1.imbue(std::locale(LOCALE_en_US_UTF_8));
|
||||
ios1.exceptions(std::ios::failbit);
|
||||
ios1.setstate(std::ios::eofbit);
|
||||
ios1.register_callback(f1, 4);
|
||||
@@ -93,7 +95,7 @@ int main()
|
||||
ios2.flags(std::ios::showpoint | std::ios::uppercase);
|
||||
ios2.precision(2);
|
||||
ios2.width(12);
|
||||
ios2.imbue(std::locale("fr_FR.UTF-8"));
|
||||
ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
|
||||
ios2.exceptions(std::ios::eofbit);
|
||||
ios2.setstate(std::ios::goodbit);
|
||||
ios2.register_callback(g1, 7);
|
||||
@@ -118,7 +120,7 @@ int main()
|
||||
assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
|
||||
assert(ios1.precision() == 2);
|
||||
assert(ios1.width() == 12);
|
||||
assert(ios1.getloc().name() == "fr_FR.UTF-8");
|
||||
assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
|
||||
assert(ios1.exceptions() == std::ios::eofbit);
|
||||
assert(!f1_called);
|
||||
assert(!f2_called);
|
||||
@@ -147,7 +149,7 @@ int main()
|
||||
assert(ios2.flags() == (std::ios::boolalpha | std::ios::dec | std::ios::fixed));
|
||||
assert(ios2.precision() == 1);
|
||||
assert(ios2.width() == 11);
|
||||
assert(ios2.getloc().name() == "en_US.UTF-8");
|
||||
assert(ios2.getloc().name() == LOCALE_en_US_UTF_8);
|
||||
assert(ios2.exceptions() == std::ios::failbit);
|
||||
assert(ios2.iword(0) == 1);
|
||||
assert(ios2.iword(1) == 2);
|
||||
|
Reference in New Issue
Block a user