OSDN Git Service

2002-01-16 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / 22_locale / time_get_members_char.cc
1 // 2001-09-21 Benjamin Kosnik  <bkoz@redhat.com>
2
3 // Copyright (C) 2001, 2002 Free Software Foundation
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING.  If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20
21 // 22.2.5.1.1 time_get members
22
23 #include <locale>
24 #include <sstream>
25 #include <testsuite_hooks.h>
26
27 // XXX This test is not working for non-glibc locale models.
28 // { dg-do run { xfail *-*-* } }
29
30 void test01()
31 {
32   using namespace std;
33   typedef time_base::dateorder dateorder;
34   typedef istreambuf_iterator<char> iterator_type;
35
36   bool test = true;
37
38   // basic construction and sanity checks.
39   locale loc_c = locale::classic();
40   locale loc_hk("en_HK");
41   locale loc_fr("fr_FR@euro");
42   locale loc_de("de_DE");
43   VERIFY( loc_hk != loc_c );
44   VERIFY( loc_hk != loc_fr );
45   VERIFY( loc_hk != loc_de );
46   VERIFY( loc_de != loc_fr );
47
48   // cache the __timepunct facets, for quicker gdb inspection
49   const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); 
50   const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); 
51   const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); 
52   const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); 
53
54   const string empty;
55
56   // create an ostream-derived object, cache the time_get facet
57   iterator_type end;
58
59   istringstream iss;
60   const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); 
61
62   const ios_base::iostate good = ios_base::goodbit;
63   ios_base::iostate errorstate = good;
64
65   // create "C" time objects
66   const tm time_bday = { 0, 0, 12, 4, 3, 71 };
67   const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
68                     "%w %W %x %X %y %Y %Z %%";
69   const char* date = "%A, the second of %B";
70   const char* date_ex = "%Ex";
71
72   // 1
73   // dateorder date_order() const
74   iss.imbue(loc_c);
75   dateorder do1 = tim_get.date_order();
76   //  VERIFY( do1 == time_base::mdy );
77   VERIFY( do1 == time_base::no_order );
78
79   // 2
80   // iter_type 
81   // get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
82
83   // sanity checks for "C" locale
84   iss.str("12:00:00");
85   iterator_type is_it01(iss);
86   tm time01;
87   errorstate = good;
88   tim_get.get_time(is_it01, end, iss, errorstate, &time01);
89   VERIFY( time01.tm_sec == time_bday.tm_sec );
90   VERIFY( time01.tm_min == time_bday.tm_min );
91   VERIFY( time01.tm_hour == time_bday.tm_hour );
92   VERIFY( errorstate == ios_base::eofbit );
93
94   iss.str("12:00:00 ");
95   iterator_type is_it02(iss);
96   tm time02;
97   errorstate = good;
98   tim_get.get_time(is_it02, end, iss, errorstate, &time02);
99   VERIFY( time01.tm_sec == time_bday.tm_sec );
100   VERIFY( time01.tm_min == time_bday.tm_min );
101   VERIFY( time01.tm_hour == time_bday.tm_hour );
102   VERIFY( errorstate == good );
103
104   iss.str("12:61:00 ");
105   iterator_type is_it03(iss);
106   tm time03;
107   errorstate = good;
108   tim_get.get_time(is_it03, end, iss, errorstate, &time03);
109   VERIFY( time01.tm_hour == time_bday.tm_hour );
110   VERIFY( errorstate == ios_base::failbit );
111
112   iss.str("12:a:00 ");
113   iterator_type is_it04(iss);
114   tm time04;
115   errorstate = good;
116   tim_get.get_time(is_it04, end, iss, errorstate, &time04);
117   VERIFY( time01.tm_hour == time_bday.tm_hour );
118   VERIFY( *is_it04 == 'a');
119   VERIFY( errorstate == ios_base::failbit );
120
121   // inspection of named locales, de_DE
122   iss.imbue(loc_de);
123   iss.str("12:00:00");
124   iterator_type is_it10(iss);
125   tm time10;
126   errorstate = good;
127   tim_get.get_time(is_it10, end, iss, errorstate, &time10);
128   VERIFY( time10.tm_sec == time_bday.tm_sec );
129   VERIFY( time10.tm_min == time_bday.tm_min );
130   VERIFY( time10.tm_hour == time_bday.tm_hour );
131   VERIFY( errorstate == ios_base::eofbit );
132
133   // inspection of named locales, en_HK
134   iss.imbue(loc_hk);
135   iss.str("12:00:00 PST"); 
136   // Hong Kong in California! Well, they have Paris in Vegas... this
137   // is all a little disney-esque anyway. Besides, you can get decent
138   // Dim Sum in San Francisco.
139   iterator_type is_it20(iss);
140   tm time20;
141   errorstate = good;
142   tim_get.get_time(is_it20, end, iss, errorstate, &time20);
143   VERIFY( time10.tm_sec == time_bday.tm_sec );
144   VERIFY( time10.tm_min == time_bday.tm_min );
145   VERIFY( time10.tm_hour == time_bday.tm_hour );
146   VERIFY( errorstate == ios_base::eofbit );
147 }
148
149 void test02()
150 {
151   using namespace std;
152   typedef time_base::dateorder dateorder;
153   typedef istreambuf_iterator<char> iterator_type;
154
155   bool test = true;
156
157   // basic construction and sanity checks.
158   locale loc_c = locale::classic();
159   locale loc_hk("en_HK");
160   locale loc_fr("fr_FR@euro");
161   locale loc_de("de_DE");
162   VERIFY( loc_hk != loc_c );
163   VERIFY( loc_hk != loc_fr );
164   VERIFY( loc_hk != loc_de );
165   VERIFY( loc_de != loc_fr );
166
167   // cache the __timepunct facets, for quicker gdb inspection
168   const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); 
169   const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); 
170   const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); 
171   const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); 
172
173   const string empty;
174
175   // create an ostream-derived object, cache the time_get facet
176   iterator_type end;
177
178   istringstream iss;
179   const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); 
180
181   const ios_base::iostate good = ios_base::goodbit;
182   ios_base::iostate errorstate = good;
183
184   // create "C" time objects
185   const tm time_bday = { 0, 0, 12, 4, 3, 71 };
186   const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
187                     "%w %W %x %X %y %Y %Z %%";
188   const char* date = "%A, the second of %B";
189   const char* date_ex = "%Ex";
190
191   // iter_type 
192   // get_weekday(iter_type, iter_type, ios_base&, 
193   //             ios_base::iostate&, tm*) const
194
195   // sanity checks for "C" locale
196   iss.str("Sunday");
197   iterator_type is_it01(iss);
198   tm time01;
199   errorstate = good;
200   tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
201   VERIFY( time01.tm_wday == time_bday.tm_wday );
202   VERIFY( errorstate == ios_base::eofbit );
203
204   iss.str("Sun");
205   iterator_type is_it02(iss);
206   tm time02;
207   errorstate = good;
208   tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
209   VERIFY( time02.tm_wday == time_bday.tm_wday );
210   VERIFY( errorstate == ios_base::eofbit );
211
212   iss.str("Sun ");
213   iterator_type is_it03(iss);
214   tm time03;
215   errorstate = good;
216   tim_get.get_weekday(is_it03, end, iss, errorstate, &time03);
217   VERIFY( time03.tm_wday == time_bday.tm_wday );
218   VERIFY( errorstate == good );
219   VERIFY( *is_it03 == ' ');
220
221   iss.str("San");
222   iterator_type is_it04(iss);
223   tm time04;
224   time04.tm_wday = 4;
225   errorstate = good;
226   tim_get.get_weekday(is_it04, end, iss, errorstate, &time04);
227   VERIFY( time04.tm_wday == 4 );
228   VERIFY( *is_it04 == 'n');
229   VERIFY( errorstate == ios_base::failbit );
230
231   iss.str("Tuesday ");
232   iterator_type is_it05(iss);
233   tm time05;
234   errorstate = good;
235   tim_get.get_weekday(is_it05, end, iss, errorstate, &time05);
236   VERIFY( time05.tm_wday == 2 );
237   VERIFY( errorstate == good );
238   VERIFY( *is_it05 == ' ');
239
240   iss.str("Tuesducky "); // Kind of like Fryday, without the swirls.
241   iterator_type is_it06(iss);
242   tm time06;
243   time06.tm_wday = 4;
244   errorstate = good;
245   tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
246   VERIFY( time06.tm_wday == 4 );
247   VERIFY( errorstate == ios_base::failbit );
248   VERIFY( *is_it05 == 'u');
249
250   // inspection of named locales, de_DE
251   iss.imbue(loc_de);
252   iss.str("Sonntag");
253   iterator_type is_it10(iss);
254   tm time10;
255   errorstate = good;
256   tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
257   VERIFY( time10.tm_wday == time_bday.tm_wday );
258   VERIFY( errorstate == ios_base::eofbit );
259
260   // inspection of named locales, en_HK
261   iss.imbue(loc_hk);
262   iss.str("Sunday"); 
263   iterator_type is_it20(iss);
264   tm time20;
265   errorstate = good;
266   tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
267   VERIFY( time20.tm_wday == time_bday.tm_wday );
268   VERIFY( errorstate == ios_base::eofbit );
269 }
270
271 void test03()
272 {
273   using namespace std;
274   typedef time_base::dateorder dateorder;
275   typedef istreambuf_iterator<char> iterator_type;
276
277   bool test = true;
278
279   // basic construction and sanity checks.
280   locale loc_c = locale::classic();
281   locale loc_hk("en_HK");
282   locale loc_fr("fr_FR@euro");
283   locale loc_de("de_DE");
284   VERIFY( loc_hk != loc_c );
285   VERIFY( loc_hk != loc_fr );
286   VERIFY( loc_hk != loc_de );
287   VERIFY( loc_de != loc_fr );
288
289   // cache the __timepunct facets, for quicker gdb inspection
290   const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); 
291   const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); 
292   const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); 
293   const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); 
294
295   const string empty;
296
297   // create an ostream-derived object, cache the time_get facet
298   iterator_type end;
299
300   istringstream iss;
301   const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); 
302
303   const ios_base::iostate good = ios_base::goodbit;
304   ios_base::iostate errorstate = good;
305
306   // create "C" time objects
307   const tm time_bday = { 0, 0, 12, 4, 3, 71 };
308   const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
309                     "%w %W %x %X %y %Y %Z %%";
310   const char* date = "%A, the second of %B";
311   const char* date_ex = "%Ex";
312
313   // iter_type 
314   // get_monthname(iter_type, iter_type, ios_base&, 
315   //               ios_base::iostate&, tm*) const
316
317   // sanity checks for "C" locale
318   iss.str("April");
319   iterator_type is_it01(iss);
320   tm time01;
321   errorstate = good;
322   tim_get.get_monthname(is_it01, end, iss, errorstate, &time01);
323   VERIFY( time01.tm_wday == time_bday.tm_wday );
324   VERIFY( errorstate == ios_base::eofbit );
325
326   iss.str("Apr");
327   iterator_type is_it02(iss);
328   tm time02;
329   errorstate = good;
330   tim_get.get_monthname(is_it02, end, iss, errorstate, &time02);
331   VERIFY( time02.tm_mon == time_bday.tm_mon );
332   VERIFY( errorstate == ios_base::eofbit );
333
334   iss.str("Apr ");
335   iterator_type is_it03(iss);
336   tm time03;
337   errorstate = good;
338   tim_get.get_monthname(is_it03, end, iss, errorstate, &time03);
339   VERIFY( time03.tm_mon == time_bday.tm_mon );
340   VERIFY( errorstate == good );
341   VERIFY( *is_it03 == ' ');
342
343   iss.str("Aar");
344   iterator_type is_it04(iss);
345   tm time04;
346   time04.tm_mon = 5;
347   errorstate = good;
348   tim_get.get_monthname(is_it04, end, iss, errorstate, &time04);
349   VERIFY( time04.tm_mon == 5 );
350   VERIFY( *is_it04 == 'a');
351   VERIFY( errorstate == ios_base::failbit );
352
353   iss.str("December ");
354   iterator_type is_it05(iss);
355   tm time05;
356   errorstate = good;
357   tim_get.get_monthname(is_it05, end, iss, errorstate, &time05);
358   VERIFY( time05.tm_mon == 11 );
359   VERIFY( errorstate == good );
360   VERIFY( *is_it05 == ' ');
361
362   iss.str("Decelember "); 
363   iterator_type is_it06(iss);
364   tm time06;
365   time06.tm_mon = 4;
366   errorstate = good;
367   tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
368   VERIFY( time06.tm_mon == 4 );
369   VERIFY( errorstate == ios_base::failbit );
370   VERIFY( *is_it05 == 'l');
371
372   // inspection of named locales, de_DE
373   iss.imbue(loc_de);
374   iss.str("April");
375   iterator_type is_it10(iss);
376   tm time10;
377   errorstate = good;
378   tim_get.get_monthname(is_it10, end, iss, errorstate, &time10);
379   VERIFY( time10.tm_mon == time_bday.tm_mon );
380   VERIFY( errorstate == ios_base::eofbit );
381
382   // inspection of named locales, en_HK
383   iss.imbue(loc_hk);
384   iss.str("April"); 
385   iterator_type is_it20(iss);
386   tm time20;
387   errorstate = good;
388   tim_get.get_monthname(is_it20, end, iss, errorstate, &time20);
389   VERIFY( time20.tm_mon == time_bday.tm_mon );
390   VERIFY( errorstate == ios_base::eofbit );
391 }
392
393 void test04()
394 {
395   using namespace std;
396   typedef time_base::dateorder dateorder;
397   typedef istreambuf_iterator<char> iterator_type;
398
399   bool test = true;
400
401   // basic construction and sanity checks.
402   locale loc_c = locale::classic();
403   locale loc_hk("en_HK");
404   locale loc_fr("fr_FR@euro");
405   locale loc_de("de_DE");
406   VERIFY( loc_hk != loc_c );
407   VERIFY( loc_hk != loc_fr );
408   VERIFY( loc_hk != loc_de );
409   VERIFY( loc_de != loc_fr );
410
411   // cache the __timepunct facets, for quicker gdb inspection
412   const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); 
413   const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); 
414   const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); 
415   const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); 
416
417   const string empty;
418
419   // create an ostream-derived object, cache the time_get facet
420   iterator_type end;
421
422   istringstream iss;
423   const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); 
424
425   const ios_base::iostate good = ios_base::goodbit;
426   ios_base::iostate errorstate = good;
427
428   // create "C" time objects
429   const tm time_bday = { 0, 0, 12, 4, 3, 71 };
430   const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
431                     "%w %W %x %X %y %Y %Z %%";
432   const char* date = "%A, the second of %B";
433   const char* date_ex = "%Ex";
434
435   // iter_type 
436   // get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
437
438   // sanity checks for "C" locale
439   iss.str("1971");
440   iterator_type is_it01(iss);
441   tm time01;
442   errorstate = good;
443   tim_get.get_year(is_it01, end, iss, errorstate, &time01);
444   VERIFY( time01.tm_year == time_bday.tm_year );
445   VERIFY( errorstate == ios_base::eofbit );
446
447   iss.str("1971 ");
448   iterator_type is_it02(iss);
449   tm time02;
450   errorstate = good;
451   tim_get.get_year(is_it02, end, iss, errorstate, &time02);
452   VERIFY( time02.tm_year == time_bday.tm_year );
453   VERIFY( errorstate == good );
454   VERIFY( *is_it02 == ' ');
455
456   iss.str("197d1 ");
457   iterator_type is_it03(iss);
458   tm time03;
459   time03.tm_year = 3;
460   errorstate = good;
461   tim_get.get_year(is_it03, end, iss, errorstate, &time03);
462   VERIFY( time03.tm_year == 3 );
463   VERIFY( errorstate == ios_base::failbit );
464   VERIFY( *is_it03 == 'd');
465
466   iss.str("71d71");
467   iterator_type is_it04(iss);
468   tm time04;
469   errorstate = good;
470   tim_get.get_year(is_it04, end, iss, errorstate, &time04);
471   VERIFY( time04.tm_year == time_bday.tm_year );
472   VERIFY( errorstate == good );
473   VERIFY( *is_it03 == 'd');
474
475   iss.str("71");
476   iterator_type is_it05(iss);
477   tm time05;
478   errorstate = good;
479   tim_get.get_year(is_it05, end, iss, errorstate, &time05);
480   VERIFY( time05.tm_year == time_bday.tm_year );
481   VERIFY( errorstate == ios_base::eofbit );
482 }
483
484 void test05()
485 {
486   using namespace std;
487   typedef time_base::dateorder dateorder;
488   typedef istreambuf_iterator<char> iterator_type;
489
490   bool test = true;
491
492   // basic construction and sanity checks.
493   locale loc_c = locale::classic();
494   locale loc_hk("en_HK");
495   locale loc_fr("fr_FR@euro");
496   locale loc_de("de_DE");
497   VERIFY( loc_hk != loc_c );
498   VERIFY( loc_hk != loc_fr );
499   VERIFY( loc_hk != loc_de );
500   VERIFY( loc_de != loc_fr );
501
502   // cache the __timepunct facets, for quicker gdb inspection
503   const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c); 
504   const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de); 
505   const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk); 
506   const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr); 
507
508   const string empty;
509
510   // create an ostream-derived object, cache the time_get facet
511   iterator_type end;
512
513   istringstream iss;
514   const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc()); 
515
516   const ios_base::iostate good = ios_base::goodbit;
517   ios_base::iostate errorstate = good;
518
519   // create "C" time objects
520   const tm time_bday = { 0, 0, 12, 4, 3, 71 };
521   const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
522                     "%w %W %x %X %y %Y %Z %%";
523   const char* date = "%A, the second of %B";
524   const char* date_ex = "%Ex";
525
526   // iter_type 
527   // get_date(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
528
529   // sanity checks for "C" locale
530   iss.str("04/04/71");
531   iterator_type is_it01(iss);
532   tm time01;
533   errorstate = good;
534   tim_get.get_date(is_it01, end, iss, errorstate, &time01);
535   VERIFY( time01.tm_year == time_bday.tm_year );
536   VERIFY( time01.tm_mon == time_bday.tm_mon );
537   VERIFY( time01.tm_mday == time_bday.tm_mday );
538   VERIFY( errorstate == ios_base::eofbit );
539
540   iss.str("04/04/71 ");
541   iterator_type is_it02(iss);
542   tm time02;
543   errorstate = good;
544   tim_get.get_date(is_it02, end, iss, errorstate, &time02);
545   VERIFY( time02.tm_year == time_bday.tm_year );
546   VERIFY( time02.tm_mon == time_bday.tm_mon );
547   VERIFY( time02.tm_mday == time_bday.tm_mday );
548   VERIFY( errorstate == good );
549   VERIFY( *is_it02 == ' ');
550
551   iss.str("04/04d/71 ");
552   iterator_type is_it03(iss);
553   tm time03;
554   time03.tm_year = 3;
555   errorstate = good;
556   tim_get.get_date(is_it03, end, iss, errorstate, &time03);
557   VERIFY( time03.tm_year == 3 );
558   VERIFY( time03.tm_mon == time_bday.tm_mon );
559   VERIFY( time03.tm_mday == time_bday.tm_mday );
560   VERIFY( errorstate == ios_base::failbit );
561   VERIFY( *is_it03 == 'd');
562
563   // inspection of named locales, de_DE
564   iss.imbue(loc_de);
565   iss.str("04.04.1971");
566   iterator_type is_it10(iss);
567   tm time10;
568   errorstate = good;
569   tim_get.get_date(is_it10, end, iss, errorstate, &time10);
570   VERIFY( time10.tm_mon == time_bday.tm_mon );
571   VERIFY( time10.tm_mday == time_bday.tm_mday );
572   VERIFY( time10.tm_year == time_bday.tm_year );
573   VERIFY( errorstate == ios_base::eofbit );
574
575   // inspection of named locales, en_HK
576   iss.imbue(loc_hk);
577   iss.str("Sunday, April 04, 1971"); 
578   iterator_type is_it20(iss);
579   tm time20;
580   errorstate = good;
581   tim_get.get_date(is_it20, end, iss, errorstate, &time20);
582   VERIFY( time20.tm_mon == time_bday.tm_mon );
583   VERIFY( time20.tm_mday == time_bday.tm_mday );
584   VERIFY( time20.tm_year == time_bday.tm_year );
585   VERIFY( errorstate == ios_base::eofbit );
586 }
587
588 void test06()
589 {
590   using namespace std;
591   bool test = true;
592
593   // Check time_get works with other iterators besides streambuf
594   // input iterators.
595   typedef string::const_iterator iter_type;
596   typedef time_get<char, iter_type> time_get_type;
597   const ios_base::iostate goodbit = ios_base::goodbit;
598   const ios_base::iostate eofbit = ios_base::eofbit;
599   ios_base::iostate err = goodbit;
600   const locale loc_c = locale::classic();
601   // Cindy Sherman's Untitled Film Stills
602   // June 26-September 2, 1997
603   const string str = "12:00:00 06/26/97 Tuesday September 1997 Cindy Sherman";
604  
605   // Create "C" time objects
606   const tm time_sanity = { 0, 0, 12, 26, 5, 97, 2 };
607   tm tm1;
608
609   istringstream iss; 
610   iss.imbue(locale(loc_c, new time_get_type));
611
612   // Iterator advanced, state, output.
613   const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
614
615   // 01 get_time
616   // 02 get_date
617   // 03 get_weekday
618   // 04 get_monthname
619   // 05 get_year
620
621   // 01 get_time
622   string res1;
623   err = goodbit;
624   iter_type end1 = tg.get_time(str.begin(), str.end(), iss, err, &tm1);
625   string rem1(end1, str.end());
626   VERIFY( err == goodbit );
627   VERIFY( tm1.tm_sec == time_sanity.tm_sec );
628   VERIFY( tm1.tm_min == time_sanity.tm_min );
629   VERIFY( tm1.tm_hour == time_sanity.tm_hour );
630   VERIFY( rem1 ==  " 06/26/97 Tuesday September 1997 Cindy Sherman" );
631
632   // 02 get_date
633   string res2;
634   err = goodbit;
635   // White space is not eaten, so manually increment past it.
636   iter_type end2 = tg.get_date(++end1, str.end(), iss, err, &tm1);
637   string rem2(end2, str.end());
638   VERIFY( err == goodbit );
639   VERIFY( tm1.tm_year == time_sanity.tm_year );
640   VERIFY( tm1.tm_mon == time_sanity.tm_mon );
641   VERIFY( tm1.tm_mday == time_sanity.tm_mday );
642   VERIFY( rem2 ==  " Tuesday September 1997 Cindy Sherman" );
643
644   // 03 get_weekday
645   string res3;
646   err = goodbit;
647   // White space is not eaten, so manually increment past it.
648   iter_type end3 = tg.get_weekday(++end2, str.end(), iss, err, &tm1);
649   string rem3(end3, str.end());
650   VERIFY( err == goodbit );
651   VERIFY( tm1.tm_wday == time_sanity.tm_wday );
652   VERIFY( rem3 ==  " September 1997 Cindy Sherman" );
653
654   // 04 get_monthname
655   string res4;
656   err = goodbit;
657   // White space is not eaten, so manually increment past it.
658   iter_type end4 = tg.get_monthname(++end3, str.end(), iss, err, &tm1);
659   string rem4(end4, str.end());
660   VERIFY( err == goodbit );
661   VERIFY( tm1.tm_mon == 8 );
662   VERIFY( rem4 ==  " 1997 Cindy Sherman" );
663
664   // 05 get_year
665   string res5;
666   err = goodbit;
667   // White space is not eaten, so manually increment past it.
668   iter_type end5 = tg.get_year(++end4, str.end(), iss, err, &tm1);
669   string rem5(end5, str.end());
670   VERIFY( err == goodbit );
671   VERIFY( tm1.tm_year == time_sanity.tm_year );
672   VERIFY( rem5 ==  " Cindy Sherman" );
673 }
674
675 int main()
676 {
677   test01();
678   test02();
679   test03();
680   test04();
681   test05();
682   
683   test06();
684   return 0;
685 }