Bugs item #2871203, was opened at 2009-10-01 11:16
Message generated for change (Tracker Item Submitted) made by luccat
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=2871203&group_id=51305

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxJSON
Group: last released version
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Luciano Cattani (luccat)
Assigned to: Nobody/Anonymous (nobody)
Summary: [wxJSON] bugs in wxJSONValue::IsSameAs() function

Initial Comment:
There are a few bugs in the wxJSONValue::IsSameAs() function.
The wxJSONValue class does not define a operator= function because testing two 
JSON values
for equality does not make much sense.
For example, if two JSON values contains the same type and value but they differ
in the comment lines, they are not stricly equal but they are the same.

BUG #1: comparing signed and unsigned returns wrong results
Example:
        wxJSONValue v1( 100 );
        wxJSONValue v2( (unsigned) 100 );
        bool r = v1.IsSameAs( v2 );                     // should return TRUE

Actually the function returns FALSE but it should return TRUE if the
values are within 0 and LLONG_MAX (positive).


BUG #2: comparing very large INT64 returns the wrong result
Example:
        wxJSONValue i( (wxInt64) 9223372036854775706LL );       // LLONG_MAX - 
101
        wxJSONValue d( (double) 9223372036854775707LL );        // LLONG_MAX - 
100
        r = i.IsSameAs( d );
        ASSERT( r == false );
        
Actually, the comparison of numbers is done by promoting all of them to
DOUBLE and then compating the DOUBLE values.
This works for INTs and LONGs but for very large 64-bits-INTs that differ by a
small amount the conversion to DOUBLE truncates the INT to the closest
available DOUBLE so that they have the same value.
The comparison of INTs has to be done without promotion.


BUG #3: wrong result in array comparison
Example:
        {
                "v1" : [ 10, 20 ],
                "v2" : [ 20, 10 ]
        }

Actually, the two arrays "v1" and "v2" are considered the same because they
contains the same values although in a different order.
Yhe JSON syntax states that an array is an _ordered_ collection of values so
the ORDER of elements is important.
If the order differs, the arrays are NOT THE SAME.


Bugs will be fixed in version 1.1.0 which is planned for the end of october
Luciano



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=2871203&group_id=51305

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to