[PATCH] D97403: [flang] updated character tests to gtest
Asher Mancinelli via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 4 11:33:41 PST 2021
ashermancinelli added inline comments.
================
Comment at: flang/unittests/RuntimeGTest/CharacterTest.cpp:197
+ auto res{
+ this->characterScanFunc(str, std::char_traits<TypeParam>::length(str),
+ set, std::char_traits<TypeParam>::length(set), back)};
----------------
AFAIK, `char_traits<>::length` is exactly the same as `strlen` but I can't verify this on cppref. If someone can verify that would be great.
================
Comment at: flang/unittests/RuntimeGTest/CharacterTest.cpp:263-271
+TYPED_TEST(CharacterVerifyTests, VerifyCharacters) {
+ for (auto const &[str, set, back, expect] : this->parameters) {
+ auto res{
+ this->characterVerifyFunc(str, std::char_traits<TypeParam>::length(str),
+ set, std::char_traits<TypeParam>::length(set), back)};
+ ASSERT_EQ(res, expect) << "Verify(" << str << ',' << set << ",back=" << back
+ << "): got " << res << ", should be " << expect;
----------------
The tests for `VerifyX` and `ScanX` are identical and could potentially be merged into one test case. I think this may increase the work needed to add test cases in the future so I kept them separate, but please feel free to suggest alternatives.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97403/new/
https://reviews.llvm.org/D97403
More information about the llvm-commits
mailing list