catch_interfaces_config.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Created by Phil on 05/06/2012.
  3. * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
  4. *
  5. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
  9. #define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
  10. #include "catch_common.h"
  11. #include "catch_option.hpp"
  12. #include <chrono>
  13. #include <iosfwd>
  14. #include <string>
  15. #include <vector>
  16. #include <memory>
  17. namespace Catch {
  18. enum class Verbosity {
  19. Quiet = 0,
  20. Normal,
  21. High
  22. };
  23. struct WarnAbout { enum What {
  24. Nothing = 0x00,
  25. NoAssertions = 0x01,
  26. NoTests = 0x02
  27. }; };
  28. struct ShowDurations { enum OrNot {
  29. DefaultForReporter,
  30. Always,
  31. Never
  32. }; };
  33. struct RunTests { enum InWhatOrder {
  34. InDeclarationOrder,
  35. InLexicographicalOrder,
  36. InRandomOrder
  37. }; };
  38. struct UseColour { enum YesOrNo {
  39. Auto,
  40. Yes,
  41. No
  42. }; };
  43. struct WaitForKeypress { enum When {
  44. Never,
  45. BeforeStart = 1,
  46. BeforeExit = 2,
  47. BeforeStartAndExit = BeforeStart | BeforeExit
  48. }; };
  49. class TestSpec;
  50. struct IConfig : NonCopyable {
  51. virtual ~IConfig();
  52. virtual bool allowThrows() const = 0;
  53. virtual std::ostream& stream() const = 0;
  54. virtual std::string name() const = 0;
  55. virtual bool includeSuccessfulResults() const = 0;
  56. virtual bool shouldDebugBreak() const = 0;
  57. virtual bool warnAboutMissingAssertions() const = 0;
  58. virtual bool warnAboutNoTests() const = 0;
  59. virtual int abortAfter() const = 0;
  60. virtual bool showInvisibles() const = 0;
  61. virtual ShowDurations::OrNot showDurations() const = 0;
  62. virtual double minDuration() const = 0;
  63. virtual TestSpec const& testSpec() const = 0;
  64. virtual bool hasTestFilters() const = 0;
  65. virtual std::vector<std::string> const& getTestsOrTags() const = 0;
  66. virtual RunTests::InWhatOrder runOrder() const = 0;
  67. virtual unsigned int rngSeed() const = 0;
  68. virtual UseColour::YesOrNo useColour() const = 0;
  69. virtual std::vector<std::string> const& getSectionsToRun() const = 0;
  70. virtual Verbosity verbosity() const = 0;
  71. virtual bool benchmarkNoAnalysis() const = 0;
  72. virtual int benchmarkSamples() const = 0;
  73. virtual double benchmarkConfidenceInterval() const = 0;
  74. virtual unsigned int benchmarkResamples() const = 0;
  75. virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0;
  76. };
  77. using IConfigPtr = std::shared_ptr<IConfig const>;
  78. }
  79. #endif // TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED