Results.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
  3. * Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
  4. * Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
  5. * Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
  6. *
  7. * SPDX-License-Identifier: BSD-2-Clause
  8. */
  9. #pragma once
  10. #include <AK/ByteString.h>
  11. #include <AK/Vector.h>
  12. namespace Test {
  13. enum class Result {
  14. Pass,
  15. Fail,
  16. Skip,
  17. ExpectedFail,
  18. Crashed,
  19. };
  20. struct Case {
  21. ByteString name;
  22. Result result;
  23. ByteString details;
  24. u64 duration_us;
  25. };
  26. struct Suite {
  27. ByteString path;
  28. ByteString name;
  29. // A failed test takes precedence over a skipped test, which both have
  30. // precedence over a passed test
  31. Result most_severe_test_result { Result::Pass };
  32. Vector<Case> tests {};
  33. };
  34. struct Counts {
  35. // Not all of these might be used by a certain test runner, e.g. some
  36. // do not have a concept of suites, or might not load tests from files.
  37. unsigned tests_failed { 0 };
  38. unsigned tests_passed { 0 };
  39. unsigned tests_skipped { 0 };
  40. unsigned tests_expected_failed { 0 };
  41. unsigned suites_failed { 0 };
  42. unsigned suites_passed { 0 };
  43. unsigned files_total { 0 };
  44. };
  45. }