[sldev] Unit Test Harness: Patch-2

John Hurliman jhurliman at wsu.edu
Sat Mar 3 02:17:01 PST 2007


Rahul Agarwal wrote:
> John,
>
> Please look at test case 1 in lldatapacket_tut.cpp in unittest-2.patch.
>
> orig F32 value = 44.44f (44.439999)
> final F32 value after pack/unpack =  44.437500
>
> The delta (0.002499) after serialization is greater than the tolerance as
> per is_approx_equal.
>
> Fail:
> LLDataPackerBinaryBuffer::(un)packFixed
> LLDataPackerAsciiBuffer::(un)packFixed
> LLDataPackerAsciiFile::(un)packFixed
> LLDataPackerAsciiBuffer::(un)packF32
> LLDataPackerAsciiFile::(un)packF32
>
> Pass:
> LLDataPackerBinaryBuffer::(un)packF32
>
> Thx
> Rahul

Thanks for that, I'm still reviewing the unit test patches. The 
immediate problem I see here is that the fixed packing allows you to 
specify a variable number of bytes to use for packing the integer 
portion and decimal portion of the float, but is_approx_equal isn't 
smart enough to realize how tightly packed the float in question is. So 
if you specify two bits to be used for the decimal part, obviously 
you're not going to get a very accurate decimal and is_approx_equal is 
going to fail, but is that expected behavior? Should is_appox_equal() 
take more parameters to take in to account the amount of packing done 
and adjust the tolerance? That's what I'm contemplating for libsecondlife.


More information about the SLDev mailing list