You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Travis Vitek <tv...@quovadx.com> on 2007/08/14 23:57:38 UTC

[PATCH] Update tests 22.locale.[money,num,time].put.mt.cpp to validate results [take 3]

Attached is a patch to enhance the money_put, num_put and time_put facet mt
tests. Threads verify that the values put compare equal to those put in the
primary thread. Also includes change to rw_locale() so that the C
locale can always appear at the front of the locale list.

2007-08-14	Travis Vitek	<vi...@roguewave.com>

	* rw_locale.h(rw_locales): Added new parameter to indicate the
	"C" locale should appear at the front of returned locale list.
	* locale.cpp(rw_locales): Added support for new parameter.
	* testdefs.h: Added convenience macro RW_COUNT_OF that can be used
	to get the number of elements in an array.
	* 22.locale.money.put.mt.cpp(MyIos, MyStreambuf, MyMoneyData):
	Added structures to simplify testing.
	(run_test): Build a table of in/outptus for verification in test
	threads.
	(thread_func): Assert the data written matches expected.
	(main): Add support for --nlocales and --shared-locale command
	line arguments
	* 22.locale.num.put.mt.cpp(MyIos, MyStreambuf, MyNumData): Added
	Added structures to simplify testing.
	(run_test): Build a table of in/outptus for verification in test
	threads.
	(thread_func): Assert the data written matches expected.
	(main): Add support for --nlocales and --shared-locale command
	line arguments
	* 22.locale.time.put.mt.cpp(run_test, thread_func): Use macro
	RW_COUNT_OF. Remove "C" locale fallback. Eliminate unnecessary
	rdbuf() calls.

Re: [PATCH] Update tests 22.locale.[money,num,time].put.mt.cpp to validate results [take 3]

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
> Attached is a patch to enhance the money_put, num_put and time_put facet mt
> tests. Threads verify that the values put compare equal to those put in the
> primary thread. Also includes change to rw_locale() so that the C
> locale can always appear at the front of the locale list.

Thanks Travis, this is good. I've committed your patch as is,
despite there still being a few formatting issues. I'll correct
those myself in a followup change. In the future, please do try
to double check your formatting before submitting your patches,
especially things like spaces before open parentheses and
brackets, including in your ChangeLog. Our ChangeLog formatting
convention is the same as the one used by GNU software, e.g.,
emacs or gcc. Emacs syntax highlighting makes it easy to spot
missing spaces in ChangeLogs but lesser editors probably don't ;-)
I realize this might take some getting used to on your part but
I feel consistency is important and makes a better product. If
it helps, use a simple grep script to check these things for you
(see below). Also, please remember to send patches in a format
can be easily commented on (this one doesn't get copied into
the editor when replying).

$   grep "^\+ .*[a-zA-Z_0-9][[(]" locale.tests.patch \
   | grep -v -e "\"[^\"]*[a-zA-Z_0-9][[(]" -e "\[]"
+            strcpy(locname, deflocname);
+            locname += strlen(deflocname) + 1;
+            if (prepend_c_loc && !strcmp(linebuf, deflocname))
+            put_data(data, np, std::ostreambuf_iterator<char>(&nsb),
+            put_data(data, wp, std::ostreambuf_iterator<wchar_t>(&wsb),
+            data.type_ = MyNumData::PutId(nlocales % MyNumData::put_max);
+            put_data(data, np, std::ostreambuf_iterator<char>(&nsb),
+            put_data(data, wp, std::ostreambuf_iterator<wchar_t>(&wsb),
+            RW_ASSERT (!rw_strncmp(ncs, data.ncs_));
+            RW_ASSERT (!rw_strncmp(wcs, data.wcs_));
+            data.type_ = MyMoneyData::PutId(nlocales % 
MyMoneyData::put_max);

Martin

PS For reference, the change is here:
http://svn.apache.org/viewvc?view=rev&rev=565991

> 
> 2007-08-14	Travis Vitek	<vi...@roguewave.com>
> 
> 	* rw_locale.h(rw_locales): Added new parameter to indicate the
> 	"C" locale should appear at the front of returned locale list.
> 	* locale.cpp(rw_locales): Added support for new parameter.
> 	* testdefs.h: Added convenience macro RW_COUNT_OF that can be used
> 	to get the number of elements in an array.
> 	* 22.locale.money.put.mt.cpp(MyIos, MyStreambuf, MyMoneyData):
> 	Added structures to simplify testing.
> 	(run_test): Build a table of in/outptus for verification in test
> 	threads.
> 	(thread_func): Assert the data written matches expected.
> 	(main): Add support for --nlocales and --shared-locale command
> 	line arguments
> 	* 22.locale.num.put.mt.cpp(MyIos, MyStreambuf, MyNumData): Added
> 	Added structures to simplify testing.
> 	(run_test): Build a table of in/outptus for verification in test
> 	threads.
> 	(thread_func): Assert the data written matches expected.
> 	(main): Add support for --nlocales and --shared-locale command
> 	line arguments
> 	* 22.locale.time.put.mt.cpp(run_test, thread_func): Use macro
> 	RW_COUNT_OF. Remove "C" locale fallback. Eliminate unnecessary
> 	rdbuf() calls.
>