test.cc 693 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2009 The RE2 Authors. All Rights Reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. #include <stdio.h>
  5. #include <string>
  6. #include "util/test.h"
  7. namespace testing {
  8. std::string TempDir() { return "/tmp/"; }
  9. } // namespace testing
  10. struct Test {
  11. void (*fn)(void);
  12. const char *name;
  13. };
  14. static Test tests[10000];
  15. static int ntests;
  16. void RegisterTest(void (*fn)(void), const char *name) {
  17. tests[ntests].fn = fn;
  18. tests[ntests++].name = name;
  19. }
  20. int main(int argc, char** argv) {
  21. for (int i = 0; i < ntests; i++) {
  22. printf("%s\n", tests[i].name);
  23. tests[i].fn();
  24. }
  25. printf("PASS\n");
  26. return 0;
  27. }