Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_CppTest / SRC / core / source.cpp
1 // ---
2 //
3 // $Id: source.cpp,v 1.4 2005/06/08 09:25:09 nilu Exp $
4 //
5 // CppTest - A C++ Unit Testing Framework
6 // Copyright (c) 2003 Niklas Lundell
7 //
8 // ---
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the
22 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 // Boston, MA 02111-1307, USA.
24 //
25 // ---
26
27 #include "cpptest-source.h"
28
29 using namespace std;
30
31 namespace Test
32 {
33 /// Constructs an invalid source object, which filename and message are
34 /// empty strings and the line equals zero.
35 ///
36 Source::Source()
37 : _line(0)
38 {}
39
40 /// Constructs a source object.
41 ///
42 /// \param file Name of the file containing the failing function.
43 /// \param line Line where the function starts.
44 /// \param msg Expression (or message) that caused the failure.
45 ///
46 Source::Source(const char* file, unsigned int line, const char* msg)
47 : _line(line),
48 _file(file ? file : ""),
49 _msg(msg ? msg : "")
50 {}
51
52 /// \return Name of the file containing the failing function.
53 ///
54 const string&
55 Source::file() const
56 {
57 return _file;
58 }
59
60 /// \return Line where the function starts.
61 ///
62 unsigned int
63 Source::line() const
64 {
65 return _line;
66 }
67
68 /// \return Descriptive message.
69 ///
70 const string&
71 Source::message() const
72 {
73 return _msg;
74 }
75
76 /// \return Name of the suite, which the test belongs to.
77 ///
78 const string&
79 Source::suite() const
80 {
81 return _suite;
82 }
83
84 /// \return Name of failing test.
85 ///
86 const string&
87 Source::test() const
88 {
89 return _test;
90 }
91
92 } // namespace Test
93