Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(477)

Issue 239300043: Data Driven Tests for DecimalFormat.

Can't Edit
Can't Publish+Mail
Start Review
Created:
8 years, 11 months ago by tkeep
Modified:
8 years, 10 months ago
Reviewers:
andy.heninger
Base URL:
svn+ssh://source.icu-project.org/repos/icu/icu/branches/tkeep/11692/
Visibility:
Public.

Description

Data Driven Tests for DecimalFormat.

Patch Set 1 #

Total comments: 27
Unified diffs Side-by-side diffs Delta from patch set Stats (+2174 lines, -1 line) Patch
M source/test/intltest/Makefile.in View 1 chunk +2 lines, -1 line 3 comments Download
A source/test/intltest/datadrivennumberformattestsuite.h View 1 chunk +134 lines, -0 lines 4 comments Download
A source/test/intltest/datadrivennumberformattestsuite.cpp View 1 chunk +294 lines, -0 lines 0 comments Download
M source/test/intltest/intltest.h View 1 chunk +1 line, -0 lines 2 comments Download
A source/test/intltest/numberformattesttuple.h View 1 chunk +170 lines, -0 lines 1 comment Download
A source/test/intltest/numberformattesttuple.cpp View 1 chunk +444 lines, -0 lines 13 comments Download
M source/test/intltest/numfmtst.h View 1 chunk +3 lines, -0 lines 0 comments Download
M source/test/intltest/numfmtst.cpp View 3 chunks +377 lines, -0 lines 2 comments Download
A source/test/testdata/numberformattestspecification.txt View 1 chunk +749 lines, -0 lines 2 comments Download

Messages

Total messages: 5
tkeep
8 years, 11 months ago (2015-05-26 18:48:56 UTC) #1
andy.heninger
https://codereview.appspot.com/239300043/diff/1/source/test/intltest/Makefile.in File source/test/intltest/Makefile.in (right): https://codereview.appspot.com/239300043/diff/1/source/test/intltest/Makefile.in#newcode61 source/test/intltest/Makefile.in:61: scientificnumberformattertest.o datadrivennumberformattestsuite.o \ We are going to need the ...
8 years, 11 months ago (2015-05-26 23:30:27 UTC) #2
tkeep
https://codereview.appspot.com/239300043/diff/1/source/test/intltest/Makefile.in File source/test/intltest/Makefile.in (right): https://codereview.appspot.com/239300043/diff/1/source/test/intltest/Makefile.in#newcode61 source/test/intltest/Makefile.in:61: scientificnumberformattertest.o datadrivennumberformattestsuite.o \ On 2015/05/26 23:30:26, andy.heninger wrote: > ...
8 years, 10 months ago (2015-05-27 18:02:43 UTC) #3
andy.heninger
https://codereview.appspot.com/239300043/diff/1/source/test/intltest/numberformattesttuple.cpp File source/test/intltest/numberformattesttuple.cpp (right): https://codereview.appspot.com/239300043/diff/1/source/test/intltest/numberformattesttuple.cpp#newcode19 source/test/intltest/numberformattesttuple.cpp:19: #define FIELD_OFFSET(fieldName) ((int32_t) (((char *) &gNullPtr->fieldName) - ((char *) ...
8 years, 10 months ago (2015-05-27 21:33:24 UTC) #4
tkeep
8 years, 10 months ago (2015-05-27 21:57:12 UTC) #5
https://codereview.appspot.com/239300043/diff/1/source/test/intltest/Makefile.in
File source/test/intltest/Makefile.in (right):

https://codereview.appspot.com/239300043/diff/1/source/test/intltest/Makefile...
source/test/intltest/Makefile.in:61: scientificnumberformattertest.o
datadrivennumberformattestsuite.o \
On 2015/05/27 18:02:43, tkeep wrote:
> On 2015/05/26 23:30:26, andy.heninger wrote:
> > We are going to need the corresponding additions to the visual studio
project
> > files.
> 
> Will do this part in a separate commit.

Done.

https://codereview.appspot.com/239300043/diff/1/source/test/intltest/numberfo...
File source/test/intltest/numberformattesttuple.cpp (right):

https://codereview.appspot.com/239300043/diff/1/source/test/intltest/numberfo...
source/test/intltest/numberformattesttuple.cpp:287: const
NumberFormatTestTupleFieldOps *ops;
On 2015/05/27 21:33:24, andy.heninger wrote:
> So we are assembling structs with virtual functions implemented as pointers to
C
> functions.

Not sure what you are asking me to do here.

https://codereview.appspot.com/239300043/diff/1/source/test/intltest/numberfo...
source/test/intltest/numberformattesttuple.cpp:441: 
On 2015/05/27 21:33:24, andy.heninger wrote:
> Here's an approach to doing the tuple field access without all the casting and
> unsafe pointer arithmetic, but otherwise keeping the structure similar to what
> it is.
> 
> class Tuple {
>   public:
>     int32_t       a;
>     int32_t       b;
>     int32_t       c;
> 
>     UnicodeString s;
>     double        d;
> 
>     void setByName(const char *field, UnicodeString value);
>     UnicodeString &appendByName(const char *field, UnicodeString &appendTo);
> };
> 
> struct TupleItem {
>     TupleItem(const char *name) {fName = name;};
> 
>     const char *fName;
>     virtual void set(Tuple *tuple, const UnicodeString &value) = 0;
>     virtual UnicodeString &toString(Tuple *tuple, UnicodeString &appendTo) =
0;
> };   
> 
> struct IntItem: public TupleItem {
>     IntItem(const char *name, int Tuple::*pdata) : TupleItem(name),
> fpdata(pdata) {}; 
>     int32_t Tuple::*fpdata;
> 
>     void set(Tuple *tuple, const UnicodeString &value) {
>         // value = convert the string.
>         tuple->*fpdata = 0  /* value */;
>     }
> 
>     UnicodeString &toString(Tuple *tuple, UnicodeString &appendTo) {
>         int32_t v = tuple->*fpdata;
>         // Append v to the string.
>         return appendTo;
>     }
> };
> 
> struct StringItem: public TupleItem {
>     StringItem(const char *name, UnicodeString Tuple::*pdata) :
TupleItem(name),
> fpdata(pdata) {}; 
>     UnicodeString Tuple::*fpdata;
> 
>     void set(Tuple *tuple, const UnicodeString &value) {
>         tuple->*fpdata = value;
>     }
>     
>     UnicodeString &toString(Tuple *tuple, UnicodeString &appendTo) {
>         appendTo.append(tuple->*fpdata);
>         return appendTo;
>     }
> };
> 
> 
> int main() {
>     TupleItem *tupleDesc[] = {
>         new IntItem("a", &Tuple::a),
>         new IntItem("b", &Tuple::b),
>         new IntItem("c", &Tuple::c),
>         new StringItem("s", &Tuple::s)
>     };
> 
> Not clear if its worth changing, though, since its working as it is.
> 
> The thing is really a map of field names to fields. Too bad we can't use std
> classes. UHash might save a few lines of code in handling name lookups, and
keep
> the intent clear.

Are you ok with trying what I have out in the trunk? If it breaks, we will know
within 1 to 2 hours. Then we can decide whether doing this change is worth it?
Does that sound reasonable? Of course I have never rolled back a commit to trunk
before.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b