General Purpose library for Freestanding C++ and POSIX systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

4 years ago
  1. #include "gp_config.hpp"
  2. #include "allocator.hpp"
  3. #include "test_scaffold.h"
  4. #include <iostream>
  5. alignas(2048) gp::array<char, 4096> static_mapper::store;
  6. gp::buddy<> static_mapper::impl = gp::buddy<>{store.begin().data, store.size()};
  7. std::vector<std::unique_ptr<test_scaffold>> tests;
  8. int main()
  9. {
  10. uint failed = 0;
  11. uint runned = 0;
  12. for(auto& test : tests)
  13. {
  14. ++runned;
  15. int value;
  16. try{
  17. value = test->run();
  18. if(value)
  19. {
  20. std::cout << std::dec << test->name << " failed with "<< value << std::endl;
  21. }
  22. } catch (gp::runtime_error err) {
  23. std::cout << test->name << " failed with an exception: " << err.what() << std::endl;
  24. value = -1;
  25. } catch (gp_config::assert_failure err) {
  26. std::cout << test->name << " failed with an assertion failure: " << err.what() << std::endl;
  27. value = -1;
  28. } catch (...) {
  29. std::cout << test->name << " failed with an exception" << std::endl;
  30. value = -1;
  31. }
  32. failed += (value != 0);
  33. }
  34. std::cout << std::dec << "Runned "<<runned<<" tests with "<<failed<<" failures" << std::endl;
  35. return 0;
  36. }