fake_gtest.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <iostream>
  2. #include <string>
  3. int main(int argc, char** argv)
  4. {
  5. // Note: GoogleTest.cmake doesn't actually depend on Google Test as such;
  6. // it only requires that we produces output in the expected format when
  7. // invoked with --gtest_list_tests. Thus, we fake that here. This allows us
  8. // to test the module without actually needing Google Test.
  9. if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") {
  10. std::cout << "basic." << std::endl;
  11. std::cout << " case_foo" << std::endl;
  12. std::cout << " case_bar" << std::endl;
  13. std::cout << " DISABLED_disabled_case" << std::endl;
  14. std::cout << "DISABLED_disabled." << std::endl;
  15. std::cout << " case" << std::endl;
  16. std::cout << "typed/0. # TypeParam = short" << std::endl;
  17. std::cout << " case" << std::endl;
  18. std::cout << "typed/1. # TypeParam = float" << std::endl;
  19. std::cout << " case" << std::endl;
  20. std::cout << "value/test." << std::endl;
  21. std::cout << " case/0 # GetParam() = 1" << std::endl;
  22. std::cout << " case/1 # GetParam() = \"foo\"" << std::endl;
  23. return 0;
  24. }
  25. if (argc > 5) {
  26. // Simple test of EXTRA_ARGS
  27. if (std::string(argv[3]) == "how" && std::string(argv[4]) == "now" &&
  28. std::string(argv[5]) == "\"brown\" cow") {
  29. return 0;
  30. }
  31. }
  32. // Print arguments for debugging, if we didn't get the expected arguments
  33. for (int i = 1; i < argc; ++i) {
  34. std::cerr << "arg[" << i << "]: '" << argv[i] << "'\n";
  35. }
  36. return 1;
  37. }