|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ITK_TESTEVENT_H_ |
|
19 #define ITK_TESTEVENT_H_ |
|
20 |
|
21 #include <iosfwd> |
|
22 #include <string> |
|
23 |
|
24 namespace Itk |
|
25 { |
|
26 |
|
27 /** |
|
28 * POV class to store test event related information, like |
|
29 * expression that failed (or asserted), source file, line and |
|
30 * possible custom message. |
|
31 */ |
|
32 class TestEvent |
|
33 { |
|
34 private: |
|
35 // |
|
36 // private members |
|
37 // |
|
38 std::string expr_; |
|
39 std::string file_; |
|
40 size_t line_; |
|
41 std::string msg_; |
|
42 |
|
43 public: |
|
44 // |
|
45 // public operators |
|
46 // |
|
47 |
|
48 /** |
|
49 * TODO |
|
50 * |
|
51 * To report failed expects and asserts |
|
52 * |
|
53 * @param msg - may be NULL |
|
54 */ |
|
55 TestEvent(const char * expr, |
|
56 const char * file, |
|
57 size_t line, |
|
58 const char * msg); |
|
59 |
|
60 /** |
|
61 * TODO |
|
62 * |
|
63 * To report io capture related messages |
|
64 */ |
|
65 TestEvent(const char * file, |
|
66 const char * msg); |
|
67 |
|
68 |
|
69 /** |
|
70 * TODO |
|
71 * |
|
72 * To report unknown failures |
|
73 */ |
|
74 TestEvent(const char * contextName); |
|
75 |
|
76 |
|
77 const std::string & expr() const; |
|
78 |
|
79 const std::string & file() const; |
|
80 |
|
81 size_t line() const; |
|
82 |
|
83 const std::string & msg() const; |
|
84 }; |
|
85 } |
|
86 |
|
87 |
|
88 namespace std |
|
89 { |
|
90 std::ostream & operator<<(std::ostream & os, |
|
91 const Itk::TestEvent & e); |
|
92 } |
|
93 |
|
94 #endif // ITK_TESTEVENT_H_ |