Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_test_case_info.h
Go to the documentation of this file.
1/*
2 * Created by Phil on 29/10/2010.
3 * Copyright 2010 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_TEST_CASE_INFO_H_INCLUDED
9#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
10
11#include "catch_common.h"
12#include "catch_test_registry.h"
13
14#include <string>
15#include <vector>
16#include <memory>
17
18#ifdef __clang__
19#pragma clang diagnostic push
20#pragma clang diagnostic ignored "-Wpadded"
21#endif
22
23namespace Catch {
24
25 struct ITestInvoker;
26
27 struct TestCaseInfo {
29 None = 0,
30 IsHidden = 1 << 1,
31 ShouldFail = 1 << 2,
32 MayFail = 1 << 3,
33 Throws = 1 << 4,
34 NonPortable = 1 << 5,
35 Benchmark = 1 << 6
36 };
37
38 TestCaseInfo( std::string const& _name,
39 std::string const& _className,
40 std::string const& _description,
41 std::vector<std::string> const& _tags,
42 SourceLineInfo const& _lineInfo );
43
44 friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );
45
46 bool isHidden() const;
47 bool throws() const;
48 bool okToFail() const;
49 bool expectedToFail() const;
50
51 std::string tagsAsString() const;
52
53 std::string name;
54 std::string className;
55 std::string description;
56 std::vector<std::string> tags;
57 std::vector<std::string> lcaseTags;
60 };
61
62 class TestCase : public TestCaseInfo {
63 public:
64
65 TestCase( ITestInvoker* testCase, TestCaseInfo&& info );
66
67 TestCase withName( std::string const& _newName ) const;
68
69 void invoke() const;
70
71 TestCaseInfo const& getTestCaseInfo() const;
72
73 bool operator == ( TestCase const& other ) const;
74 bool operator < ( TestCase const& other ) const;
75
76 private:
77 std::shared_ptr<ITestInvoker> test;
78 };
79
80 TestCase makeTestCase( ITestInvoker* testCase,
81 std::string const& className,
82 NameAndTags const& nameAndTags,
83 SourceLineInfo const& lineInfo );
84}
85
86#ifdef __clang__
87#pragma clang diagnostic pop
88#endif
89
90#endif // TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
bool operator<(TestCase const &other) const
TestCase withName(std::string const &_newName) const
bool operator==(TestCase const &other) const
TestCaseInfo const & getTestCaseInfo() const
TestCase(ITestInvoker *testCase, TestCaseInfo &&info)
TestCase makeTestCase(ITestInvoker *_testCase, std::string const &_className, NameAndTags const &nameAndTags, SourceLineInfo const &_lineInfo)
friend void setTags(TestCaseInfo &testCaseInfo, std::vector< std::string > tags)
std::vector< std::string > lcaseTags
std::string tagsAsString() const
TestCaseInfo(std::string const &_name, std::string const &_className, std::string const &_description, std::vector< std::string > const &_tags, SourceLineInfo const &_lineInfo)
std::vector< std::string > tags
SpecialProperties properties