~ubuntu-branches/ubuntu/trusty/liblas/trusty-proposed

« back to all changes in this revision

Viewing changes to test/unit/error_test.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2014-01-05 17:00:29 UTC
  • mfrom: (7.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140105170029-ddtp0j63x5jvck2u
Tags: 1.7.0+dfsg-2
Fixed missing linking of system boost component.
(closes: #733282)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $Id$
 
2
//
 
3
// (C) Copyright Mateusz Loskot 2008, mateusz@loskot.net
 
4
// Distributed under the BSD License
 
5
// (See accompanying file LICENSE.txt or copy at
 
6
// http://www.opensource.org/licenses/bsd-license.php)
 
7
//
 
8
#include <liblas/error.hpp>
 
9
#include <tut/tut.hpp>
 
10
#include <string>
 
11
 
 
12
namespace tut
 
13
 
14
    struct laserror_data
 
15
    {
 
16
        int const code;
 
17
        std::string const msg;
 
18
        std::string const method;
 
19
 
 
20
        laserror_data()
 
21
            : code(101), msg("Test message"), method("foo")
 
22
        {}
 
23
 
 
24
        private:
 
25
            // non-copyable type
 
26
            laserror_data(laserror_data const&);
 
27
            laserror_data& operator=(laserror_data const&);
 
28
    };
 
29
 
 
30
    typedef test_group<laserror_data> tg;
 
31
    typedef tg::object to;
 
32
 
 
33
    tg test_group_laserror("liblas::Error");
 
34
 
 
35
    // Test constructor
 
36
    template<>
 
37
    template<>
 
38
    void to::test<1>()
 
39
    {
 
40
        liblas::Error err(code, msg, method);
 
41
 
 
42
        ensure_equals(err.GetCode(), code);
 
43
        ensure_equals(err.GetMessage(), msg);
 
44
        ensure_equals(err.GetMethod(), method);
 
45
    }
 
46
 
 
47
    // Test copy constructor
 
48
    template<>
 
49
    template<>
 
50
    void to::test<2>()
 
51
    {
 
52
        liblas::Error err(code, msg, method);
 
53
        liblas::Error copy(err);
 
54
 
 
55
        ensure_equals(copy.GetCode(), code);
 
56
        ensure_equals(copy.GetMessage(), msg);
 
57
        ensure_equals(copy.GetMethod(), method);
 
58
    }
 
59
 
 
60
    // Test assignment operator
 
61
    template<>
 
62
    template<>
 
63
    void to::test<3>()
 
64
    {
 
65
        liblas::Error copy(0, "", "");;
 
66
 
 
67
        {
 
68
            liblas::Error err(code, msg, method);
 
69
            copy = err;
 
70
        }
 
71
 
 
72
        ensure_equals(copy.GetCode(), code);
 
73
        ensure_equals(copy.GetMessage(), msg);
 
74
        ensure_equals(copy.GetMethod(), method);
 
75
    }
 
76
}
 
77