[llvm] r227018 - InstrProf: Add operator!= to coverage counters
Marshall Clow
mclow.lists at gmail.com
Tue Jan 27 17:44:49 PST 2015
> On Jan 27, 2015, at 5:34 PM, Justin Bogner <mail at justinbogner.com> wrote:
>
> David Blaikie <dblaikie at gmail.com> writes:
>> On Sat, Jan 24, 2015 at 1:13 PM, Justin Bogner <mail at justinbogner.com> wrote:
>>
>> Author: bogner
>> Date: Sat Jan 24 15:13:23 2015
>> New Revision: 227018
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=227018&view=rev
>> Log:
>> InstrProf: Add operator!= to coverage counters
>>
>> I'll use this in clang shortly. Also makes the operator definition
>> style more consistent in this class.
>>
>> Test cases?
>
> I'm not convinced it's valuable to test an operator!= whose
> implementation is literally "return !(LHS == RHS)". If you feel really
> strongly I can write some unit tests for this type, but they'll be
> pretty pointless.
My take on this is that you want to make sure that the op!= is callable.
That’s the big test here.
So, I would suggest you write a couple tests like this:
assert ((a != b) == !(a ==b));
which checks that it’s callable, and that it gets the right answer.
and toss them in with the tests for op==.
I wouldn’t think you would need a separate test case, though.
— Marshall
More information about the llvm-commits
mailing list