~ubuntu-branches/ubuntu/wily/libspiff/wily

« back to all changes in this revision

Viewing changes to test/CppTest/source.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adeodato Simó
  • Date: 2007-10-11 14:44:38 UTC
  • Revision ID: james.westby@ubuntu.com-20071011144438-zpl4gtvl3bf2ocnx
Tags: upstream-0.8.2
Import upstream version 0.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ---
 
2
//
 
3
// $Id: source.cpp,v 1.2 2004/02/04 21:08:23 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