fork download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <algorithm>
  4. #include <array>
  5.  
  6. bool T1() { return false; }
  7.  
  8. bool T2() { return true; }
  9.  
  10. typedef bool (*Test)();
  11.  
  12. std::array<Test, 2> tests {{ T1, T2 }};
  13.  
  14. void TestAll()
  15. {
  16. size_t i = 1;
  17. std::for_each(tests.begin(), tests.end(),
  18. [&i](Test& t)
  19. {
  20. std::cout << "Test " << i++ << (t() ? " PASSED" : " FAILED") << std::endl;
  21. });
  22. }
  23.  
  24. int main()
  25. {
  26. TestAll();
  27. }
  28.  
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
Test 1 FAILED
Test 2 PASSED