put_long_double_fr_FR.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
16f56ab789cb470620554d624c37f488285b3b04eDan Albert//===----------------------------------------------------------------------===// 26f56ab789cb470620554d624c37f488285b3b04eDan Albert// 36f56ab789cb470620554d624c37f488285b3b04eDan Albert// The LLVM Compiler Infrastructure 46f56ab789cb470620554d624c37f488285b3b04eDan Albert// 56f56ab789cb470620554d624c37f488285b3b04eDan Albert// This file is distributed under the University of Illinois Open Source 66f56ab789cb470620554d624c37f488285b3b04eDan Albert// License. See LICENSE.TXT for details. 76f56ab789cb470620554d624c37f488285b3b04eDan Albert// 86f56ab789cb470620554d624c37f488285b3b04eDan Albert//===----------------------------------------------------------------------===// 96f56ab789cb470620554d624c37f488285b3b04eDan Albert 106f56ab789cb470620554d624c37f488285b3b04eDan Albert// <locale> 116f56ab789cb470620554d624c37f488285b3b04eDan Albert 126f56ab789cb470620554d624c37f488285b3b04eDan Albert// class money_put<charT, OutputIterator> 136f56ab789cb470620554d624c37f488285b3b04eDan Albert 146f56ab789cb470620554d624c37f488285b3b04eDan Albert// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, 156f56ab789cb470620554d624c37f488285b3b04eDan Albert// long double units) const; 166f56ab789cb470620554d624c37f488285b3b04eDan Albert 176f56ab789cb470620554d624c37f488285b3b04eDan Albert#include <locale> 186f56ab789cb470620554d624c37f488285b3b04eDan Albert#include <ios> 196f56ab789cb470620554d624c37f488285b3b04eDan Albert#include <streambuf> 206f56ab789cb470620554d624c37f488285b3b04eDan Albert#include <cassert> 216f56ab789cb470620554d624c37f488285b3b04eDan Albert#include "iterators.h" 226f56ab789cb470620554d624c37f488285b3b04eDan Albert 236f56ab789cb470620554d624c37f488285b3b04eDan Alberttypedef std::money_put<char, output_iterator<char*> > Fn; 246f56ab789cb470620554d624c37f488285b3b04eDan Albert 256f56ab789cb470620554d624c37f488285b3b04eDan Albertclass my_facet 266f56ab789cb470620554d624c37f488285b3b04eDan Albert : public Fn 276f56ab789cb470620554d624c37f488285b3b04eDan Albert{ 286f56ab789cb470620554d624c37f488285b3b04eDan Albertpublic: 296f56ab789cb470620554d624c37f488285b3b04eDan Albert explicit my_facet(std::size_t refs = 0) 306f56ab789cb470620554d624c37f488285b3b04eDan Albert : Fn(refs) {} 316f56ab789cb470620554d624c37f488285b3b04eDan Albert}; 326f56ab789cb470620554d624c37f488285b3b04eDan Albert 336f56ab789cb470620554d624c37f488285b3b04eDan Alberttypedef std::money_put<wchar_t, output_iterator<wchar_t*> > Fw; 346f56ab789cb470620554d624c37f488285b3b04eDan Albert 356f56ab789cb470620554d624c37f488285b3b04eDan Albertclass my_facetw 366f56ab789cb470620554d624c37f488285b3b04eDan Albert : public Fw 376f56ab789cb470620554d624c37f488285b3b04eDan Albert{ 386f56ab789cb470620554d624c37f488285b3b04eDan Albertpublic: 396f56ab789cb470620554d624c37f488285b3b04eDan Albert explicit my_facetw(std::size_t refs = 0) 406f56ab789cb470620554d624c37f488285b3b04eDan Albert : Fw(refs) {} 416f56ab789cb470620554d624c37f488285b3b04eDan Albert}; 426f56ab789cb470620554d624c37f488285b3b04eDan Albert 436f56ab789cb470620554d624c37f488285b3b04eDan Albertint main() 446f56ab789cb470620554d624c37f488285b3b04eDan Albert{ 456f56ab789cb470620554d624c37f488285b3b04eDan Albert std::ios ios(0); 466f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string loc_name("fr_FR"); 476f56ab789cb470620554d624c37f488285b3b04eDan Albert ios.imbue(std::locale(ios.getloc(), 486f56ab789cb470620554d624c37f488285b3b04eDan Albert new std::moneypunct_byname<char, false>(loc_name))); 496f56ab789cb470620554d624c37f488285b3b04eDan Albert ios.imbue(std::locale(ios.getloc(), 506f56ab789cb470620554d624c37f488285b3b04eDan Albert new std::moneypunct_byname<char, true>(loc_name))); 516f56ab789cb470620554d624c37f488285b3b04eDan Albert ios.imbue(std::locale(ios.getloc(), 526f56ab789cb470620554d624c37f488285b3b04eDan Albert new std::moneypunct_byname<wchar_t, false>(loc_name))); 536f56ab789cb470620554d624c37f488285b3b04eDan Albert ios.imbue(std::locale(ios.getloc(), 546f56ab789cb470620554d624c37f488285b3b04eDan Albert new std::moneypunct_byname<wchar_t, true>(loc_name))); 556f56ab789cb470620554d624c37f488285b3b04eDan Albert{ 566f56ab789cb470620554d624c37f488285b3b04eDan Albert const my_facet f(1); 576f56ab789cb470620554d624c37f488285b3b04eDan Albert // char, national 586f56ab789cb470620554d624c37f488285b3b04eDan Albert { // zero 596f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = 0; 606f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 616f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 626f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 636f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 646f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "0,00 "); 656f56ab789cb470620554d624c37f488285b3b04eDan Albert } 666f56ab789cb470620554d624c37f488285b3b04eDan Albert { // negative one 676f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = -1; 686f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 696f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 706f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 716f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 726f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "0,01 -"); 736f56ab789cb470620554d624c37f488285b3b04eDan Albert } 746f56ab789cb470620554d624c37f488285b3b04eDan Albert { // positive 756f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = 123456789; 766f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 776f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 786f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 796f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 806f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "1 234 567,89 "); 816f56ab789cb470620554d624c37f488285b3b04eDan Albert } 826f56ab789cb470620554d624c37f488285b3b04eDan Albert { // negative 836f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = -123456789; 846f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 856f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 866f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 876f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 886f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "1 234 567,89 -"); 896f56ab789cb470620554d624c37f488285b3b04eDan Albert } 906f56ab789cb470620554d624c37f488285b3b04eDan Albert { // zero, showbase 916f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = 0; 926f56ab789cb470620554d624c37f488285b3b04eDan Albert showbase(ios); 936f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 946f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 956f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 966f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 976f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "0,00 Eu"); 986f56ab789cb470620554d624c37f488285b3b04eDan Albert } 996f56ab789cb470620554d624c37f488285b3b04eDan Albert { // negative one, showbase 1006f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = -1; 1016f56ab789cb470620554d624c37f488285b3b04eDan Albert showbase(ios); 1026f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 1036f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 1046f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 1056f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 1066f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "0,01 Eu-"); 1076f56ab789cb470620554d624c37f488285b3b04eDan Albert } 1086f56ab789cb470620554d624c37f488285b3b04eDan Albert { // positive, showbase 1096f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = 123456789; 1106f56ab789cb470620554d624c37f488285b3b04eDan Albert showbase(ios); 1116f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 1126f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 1136f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 1146f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 1156f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "1 234 567,89 Eu"); 1166f56ab789cb470620554d624c37f488285b3b04eDan Albert } 1176f56ab789cb470620554d624c37f488285b3b04eDan Albert { // negative, showbase 1186f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = -123456789; 1196f56ab789cb470620554d624c37f488285b3b04eDan Albert showbase(ios); 1206f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 1216f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 1226f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, '*', v); 1236f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 1246f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "1 234 567,89 Eu-"); 1256f56ab789cb470620554d624c37f488285b3b04eDan Albert } 1266f56ab789cb470620554d624c37f488285b3b04eDan Albert { // negative, showbase, left 1276f56ab789cb470620554d624c37f488285b3b04eDan Albert long double v = -123456789; 1286f56ab789cb470620554d624c37f488285b3b04eDan Albert showbase(ios); 1296f56ab789cb470620554d624c37f488285b3b04eDan Albert ios.width(20); 1306f56ab789cb470620554d624c37f488285b3b04eDan Albert left(ios); 1316f56ab789cb470620554d624c37f488285b3b04eDan Albert char str[100]; 1326f56ab789cb470620554d624c37f488285b3b04eDan Albert output_iterator<char*> iter = f.put(output_iterator<char*>(str), 1336f56ab789cb470620554d624c37f488285b3b04eDan Albert false, ios, ' ', v); 1346f56ab789cb470620554d624c37f488285b3b04eDan Albert std::string ex(str, iter.base()); 1356f56ab789cb470620554d624c37f488285b3b04eDan Albert assert(ex == "1 234 567,89 Eu- "); 136 assert(ios.width() == 0); 137 } 138 { // negative, showbase, internal 139 long double v = -123456789; 140 showbase(ios); 141 ios.width(20); 142 internal(ios); 143 char str[100]; 144 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 145 false, ios, ' ', v); 146 std::string ex(str, iter.base()); 147 assert(ex == "1 234 567,89 Eu-"); 148 assert(ios.width() == 0); 149 } 150 { // negative, showbase, right 151 long double v = -123456789; 152 showbase(ios); 153 ios.width(20); 154 right(ios); 155 char str[100]; 156 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 157 false, ios, ' ', v); 158 std::string ex(str, iter.base()); 159 assert(ex == " 1 234 567,89 Eu-"); 160 assert(ios.width() == 0); 161 } 162 163 // char, international 164 noshowbase(ios); 165 ios.unsetf(std::ios_base::adjustfield); 166 { // zero 167 long double v = 0; 168 char str[100]; 169 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 170 true, ios, '*', v); 171 std::string ex(str, iter.base()); 172 assert(ex == "0,00 "); 173 } 174 { // negative one 175 long double v = -1; 176 char str[100]; 177 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 178 true, ios, '*', v); 179 std::string ex(str, iter.base()); 180 assert(ex == "0,01 -"); 181 } 182 { // positive 183 long double v = 123456789; 184 char str[100]; 185 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 186 true, ios, '*', v); 187 std::string ex(str, iter.base()); 188 assert(ex == "1 234 567,89 "); 189 } 190 { // negative 191 long double v = -123456789; 192 char str[100]; 193 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 194 true, ios, '*', v); 195 std::string ex(str, iter.base()); 196 assert(ex == "1 234 567,89 -"); 197 } 198 { // zero, showbase 199 long double v = 0; 200 showbase(ios); 201 char str[100]; 202 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 203 true, ios, '*', v); 204 std::string ex(str, iter.base()); 205 assert(ex == "0,00 EUR "); 206 } 207 { // negative one, showbase 208 long double v = -1; 209 showbase(ios); 210 char str[100]; 211 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 212 true, ios, '*', v); 213 std::string ex(str, iter.base()); 214 assert(ex == "0,01 EUR -"); 215 } 216 { // positive, showbase 217 long double v = 123456789; 218 showbase(ios); 219 char str[100]; 220 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 221 true, ios, '*', v); 222 std::string ex(str, iter.base()); 223 assert(ex == "1 234 567,89 EUR "); 224 } 225 { // negative, showbase 226 long double v = -123456789; 227 showbase(ios); 228 char str[100]; 229 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 230 true, ios, '*', v); 231 std::string ex(str, iter.base()); 232 assert(ex == "1 234 567,89 EUR -"); 233 } 234 { // negative, showbase, left 235 long double v = -123456789; 236 showbase(ios); 237 ios.width(20); 238 left(ios); 239 char str[100]; 240 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 241 true, ios, ' ', v); 242 std::string ex(str, iter.base()); 243 assert(ex == "1 234 567,89 EUR - "); 244 assert(ios.width() == 0); 245 } 246 { // negative, showbase, internal 247 long double v = -123456789; 248 showbase(ios); 249 ios.width(20); 250 internal(ios); 251 char str[100]; 252 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 253 true, ios, ' ', v); 254 std::string ex(str, iter.base()); 255 assert(ex == "1 234 567,89 EUR -"); 256 assert(ios.width() == 0); 257 } 258 { // negative, showbase, right 259 long double v = -123456789; 260 showbase(ios); 261 ios.width(20); 262 right(ios); 263 char str[100]; 264 output_iterator<char*> iter = f.put(output_iterator<char*>(str), 265 true, ios, ' ', v); 266 std::string ex(str, iter.base()); 267 assert(ex == " 1 234 567,89 EUR -"); 268 assert(ios.width() == 0); 269 } 270} 271{ 272 const my_facetw f(1); 273 // wchar_t, national 274 noshowbase(ios); 275 ios.unsetf(std::ios_base::adjustfield); 276 { // zero 277 long double v = 0; 278 wchar_t str[100]; 279 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 280 false, ios, '*', v); 281 std::wstring ex(str, iter.base()); 282 assert(ex == L"0,00 "); 283 } 284 { // negative one 285 long double v = -1; 286 wchar_t str[100]; 287 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 288 false, ios, '*', v); 289 std::wstring ex(str, iter.base()); 290 assert(ex == L"0,01 -"); 291 } 292 { // positive 293 long double v = 123456789; 294 wchar_t str[100]; 295 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 296 false, ios, '*', v); 297 std::wstring ex(str, iter.base()); 298 assert(ex == L"1 234 567,89 "); 299 } 300 { // negative 301 long double v = -123456789; 302 wchar_t str[100]; 303 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 304 false, ios, '*', v); 305 std::wstring ex(str, iter.base()); 306 assert(ex == L"1 234 567,89 -"); 307 } 308 { // zero, showbase 309 long double v = 0; 310 showbase(ios); 311 wchar_t str[100]; 312 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 313 false, ios, '*', v); 314 std::wstring ex(str, iter.base()); 315 assert(ex == L"0,00 Eu"); 316 } 317 { // negative one, showbase 318 long double v = -1; 319 showbase(ios); 320 wchar_t str[100]; 321 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 322 false, ios, '*', v); 323 std::wstring ex(str, iter.base()); 324 assert(ex == L"0,01 Eu-"); 325 } 326 { // positive, showbase 327 long double v = 123456789; 328 showbase(ios); 329 wchar_t str[100]; 330 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 331 false, ios, '*', v); 332 std::wstring ex(str, iter.base()); 333 assert(ex == L"1 234 567,89 Eu"); 334 } 335 { // negative, showbase 336 long double v = -123456789; 337 showbase(ios); 338 wchar_t str[100]; 339 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 340 false, ios, '*', v); 341 std::wstring ex(str, iter.base()); 342 assert(ex == L"1 234 567,89 Eu-"); 343 } 344 { // negative, showbase, left 345 long double v = -123456789; 346 showbase(ios); 347 ios.width(20); 348 left(ios); 349 wchar_t str[100]; 350 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 351 false, ios, ' ', v); 352 std::wstring ex(str, iter.base()); 353 assert(ex == L"1 234 567,89 Eu- "); 354 assert(ios.width() == 0); 355 } 356 { // negative, showbase, internal 357 long double v = -123456789; 358 showbase(ios); 359 ios.width(20); 360 internal(ios); 361 wchar_t str[100]; 362 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 363 false, ios, ' ', v); 364 std::wstring ex(str, iter.base()); 365 assert(ex == L"1 234 567,89 Eu-"); 366 assert(ios.width() == 0); 367 } 368 { // negative, showbase, right 369 long double v = -123456789; 370 showbase(ios); 371 ios.width(20); 372 right(ios); 373 wchar_t str[100]; 374 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 375 false, ios, ' ', v); 376 std::wstring ex(str, iter.base()); 377 assert(ex == L" 1 234 567,89 Eu-"); 378 assert(ios.width() == 0); 379 } 380 381 // wchar_t, international 382 noshowbase(ios); 383 ios.unsetf(std::ios_base::adjustfield); 384 { // zero 385 long double v = 0; 386 wchar_t str[100]; 387 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 388 true, ios, '*', v); 389 std::wstring ex(str, iter.base()); 390 assert(ex == L"0,00 "); 391 } 392 { // negative one 393 long double v = -1; 394 wchar_t str[100]; 395 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 396 true, ios, '*', v); 397 std::wstring ex(str, iter.base()); 398 assert(ex == L"0,01 -"); 399 } 400 { // positive 401 long double v = 123456789; 402 wchar_t str[100]; 403 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 404 true, ios, '*', v); 405 std::wstring ex(str, iter.base()); 406 assert(ex == L"1 234 567,89 "); 407 } 408 { // negative 409 long double v = -123456789; 410 wchar_t str[100]; 411 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 412 true, ios, '*', v); 413 std::wstring ex(str, iter.base()); 414 assert(ex == L"1 234 567,89 -"); 415 } 416 { // zero, showbase 417 long double v = 0; 418 showbase(ios); 419 wchar_t str[100]; 420 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 421 true, ios, '*', v); 422 std::wstring ex(str, iter.base()); 423 assert(ex == L"0,00 EUR "); 424 } 425 { // negative one, showbase 426 long double v = -1; 427 showbase(ios); 428 wchar_t str[100]; 429 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 430 true, ios, '*', v); 431 std::wstring ex(str, iter.base()); 432 assert(ex == L"0,01 EUR -"); 433 } 434 { // positive, showbase 435 long double v = 123456789; 436 showbase(ios); 437 wchar_t str[100]; 438 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 439 true, ios, '*', v); 440 std::wstring ex(str, iter.base()); 441 assert(ex == L"1 234 567,89 EUR "); 442 } 443 { // negative, showbase 444 long double v = -123456789; 445 showbase(ios); 446 wchar_t str[100]; 447 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 448 true, ios, '*', v); 449 std::wstring ex(str, iter.base()); 450 assert(ex == L"1 234 567,89 EUR -"); 451 } 452 { // negative, showbase, left 453 long double v = -123456789; 454 showbase(ios); 455 ios.width(20); 456 left(ios); 457 wchar_t str[100]; 458 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 459 true, ios, ' ', v); 460 std::wstring ex(str, iter.base()); 461 assert(ex == L"1 234 567,89 EUR - "); 462 assert(ios.width() == 0); 463 } 464 { // negative, showbase, internal 465 long double v = -123456789; 466 showbase(ios); 467 ios.width(20); 468 internal(ios); 469 wchar_t str[100]; 470 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 471 true, ios, ' ', v); 472 std::wstring ex(str, iter.base()); 473 assert(ex == L"1 234 567,89 EUR -"); 474 assert(ios.width() == 0); 475 } 476 { // negative, showbase, right 477 long double v = -123456789; 478 showbase(ios); 479 ios.width(20); 480 right(ios); 481 wchar_t str[100]; 482 output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), 483 true, ios, ' ', v); 484 std::wstring ex(str, iter.base()); 485 assert(ex == L" 1 234 567,89 EUR -"); 486 assert(ios.width() == 0); 487 } 488} 489} 490