Proposal to reuse existing equality testing in unit tests
Doug Simon
doug.simon at oracle.com
Mon Jun 16 18:50:28 UTC 2014
On Jun 16, 2014, at 6:33 PM, Deneau, Tom <tom.deneau at amd.com> wrote:
> A comment on GraalTest.API for asserting equality of floats and doubles. Rather than specifying an absolute delta parameter, it would be nice if there was a way to express a "relative delta" in terms of ULPs. (since this is how floating point accuracy is usually specified). Or is there a way to do that currently?
You should be able to achieve what you want by overriding GraalTest.assertDeepEquals(String, Object, Object, double).
-Doug
>> -----Original Message-----
>> From: Doug Simon [mailto:doug.simon at oracle.com]
>> Sent: Tuesday, May 13, 2014 3:27 PM
>> To: Deneau, Tom
>> Cc: graal-dev at openjdk.java.net
>> Subject: Re: Proposal to reuse existing equality testing in unit tests
>>
>>
>> On May 13, 2014, at 7:25 PM, Deneau, Tom <tom.deneau at amd.com> wrote:
>>
>>> Doug --
>>>
>>> To make it work I had to extend GraalCompilerTest rather than
>> GraalTest (new patch attached).
>>> Otherwise it didn't do the deep equals for arrays.
>>
>> You must be not on tip as I moved the necessary methods from
>> GraalCompilerTest to GraalTest.
>>
>>> But with that, this new patch works for me. Thanks for noticing this
>> duplication.
>>>
>>> One question, I know we weren't really using it yet but we had made an
>>> overrideable method that would determine whether two floats or two
>>> doubles were equal so they wouldn't have to be exactly equal.
>>
>>>
>>> Is there any provision for that in your infrastructure?
>>
>> Yes. The junit mechanism for this is to supply a 'delta' parameter when
>> comparing floats or doubles. I've ensured this mechanism is also exposed
>> in the GraalTest API and you can see an example of it being used in
>> FloatDivPrecisionTest once you pull the latest changes:
>>
>> http://hg.openjdk.java.net/graal/graal/rev/3c1a88470123#l3.9
>>
>> -Doug
>>
>>>> -----Original Message-----
>>>> From: Doug Simon [mailto:doug.simon at oracle.com]
>>>> Sent: Tuesday, May 13, 2014 10:34 AM
>>>> To: Deneau, Tom
>>>> Cc: graal-dev at openjdk.java.net
>>>> Subject: Proposal to reuse existing equality testing in unit tests
>>>>
>>>> Tom,
>>>>
>>>> I noticed the special logic in KernelTester for comparing results of
>>>> Okra based executions and sequential executions. As far as I can
>>>> tell, this duplicates code that already exists in Graal and Junit.
>>>> Could you please review this patch to remove the redundant logic:
>>>>
>>>> http://cr.openjdk.java.net/~dnsimon/use-existing-equality-testing/
>>>>
>>>> -Doug
>>> <reuse-existing-equality-testing.patch>
>
More information about the graal-dev
mailing list