Use parameterized unit tests to test FileCheck ExpressionValue API
rather than hand written code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Honestly, my impression is that the code on the left reads much easier. And it is 100 lines shorter.
I am not familar with things like ::testing::TestWithParam though, may be there is a benefit of using it
that is not obvious to me atm.
I wonder what do other people think.
llvm/unittests/Support/FileCheckTest.cpp | ||
---|---|---|
296 | You can use INT64_MAX instead. | |
358 | UINT32_MAX? | |
418 | You can return here to avoid else: ASSERT_THAT_EXPECTED(SignedActualValue, Succeeded()); EXPECT_EQ(*SignedExpectedValue, *SignedActualValue); return; } |
Thanks for looking at this. This hasn't quite collapsed the code in the way that I imagined it would, so I'm happy for this idea to be abandoned if you don't think it is worthwhile. Otherwise, I'll take a look next week.
It could probably be quite shorter if there was a way to keep some parameter templated in the fixture (namely the distinction between signed and unsigned values). Unfortunately I had errors when I tried that.
You can use INT64_MAX instead.
(INT32_MAX/UINT32_MAX are used in many places in LLVM).