This provides a substantial readability improvement IMO and also
showcases how to use gmock matchers. I'm even defining custom matchers
to facilitate the specific patterns used throughout this test code.
Even with the (fairly verbose) definition of slightly fancy new matcher,
the total code size shrinks. In several cases the checks are now
substantially more precise. And the failure messages will be much more
explanatory when things go wrong.
Note that I'm not looking for immediate or detailed review. This patch is
mostly to serve as an example in an llvm-dev discussion about whether we should
start leveraging some facitilies of GoogleMock in LLVM unit tests.