Boost logo

Boost Users :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2005-08-23 02:51:37


Steven Solie wrote:

> I'm getting the following output from one of the date_time tests with
> Boost 1.33.0 on AmigaOS:
>
> execute-test ../../../bin/boost/libs/date_time/test/testdate_facet_new.test/gcc/debug/testdate_facet_new.run
> ====== BEGIN OUTPUT ======
> Pass :: to_string & default formats match
> Pass :: to_string & default formats match
> FAIL :: default classic date
> FAIL :: default classic date period
> Pass :: custom date facet date period
> ....
>
> I've traced it down to the %x date format specifier using the default
> locale while the tests themselves expect something else.

The test looks like this:

date_facet* datefacet = new date_facet();
datefacet->format(date_facet::standard_format_specifier);
teststreaming("default classic date", d, std::string("10/13/04"),
   std::locale(std::locale::classic(), datefacet));

AFAICT, this should produce a date formatted for the classic locale, i.e.
the C locale. But isn't the output of the C local itself implementation
defined?

> According to the ANSI K&R C book this is correct behaviour because C++
> classic locale uses the same format specifiers as the ANSI C strftime()
> function.

The C++ classic locale's result is implementation defined, see 22.2.5.3.2
of the C++ std. OTOH, the std says that "Implementations are encouraged to
refer to other standards (such as POSIX) for these definitions.", so it
might be a reasonable assumption to expect the POSIX output format for this.

> So am I correct in assuming these two test cases are broken?

If the result of formatting with the classic locale really is
implementation defined, then yes, you are right. I'm sure Jeff can shed
some more light on this.

Markus


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net