[libc-commits] [PATCH] D72743: [libc] Replace the use of gtest with a new light weight unittest framework.

Petr Hosek via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jan 17 14:52:44 PST 2020


phosek accepted this revision.
phosek added a comment.

LGTM



================
Comment at: libc/utils/UnitTest/Test.cpp:118
+  Ctx.markFail();
+  llvm::outs() << "Unexpected test condition.\n";
+  return false;
----------------
Have you considered using a `switch` instead so that the compiler statically checks that you've handled all conditions? I'd expect it to also be more efficient.


================
Comment at: libc/utils/UnitTest/Test.cpp:149
+    auto Result = Ctx.status();
+    if (Result == RunContext::Result_Fail) {
+      llvm::outs() << "[  FAILED  ] " << TestName << '\n';
----------------
This could also be a `switch`.


================
Comment at: libc/utils/UnitTest/Test.h:95
+
+  static int runTests();
+
----------------
Why not `bool` as a return value`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72743/new/

https://reviews.llvm.org/D72743





More information about the libc-commits mailing list