File: laserror_test.cpp

package info (click to toggle)
liblas 1.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,672 kB
  • sloc: cpp: 10,473; sh: 9,594; ansic: 3,427; makefile: 130
file content (77 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// $Id$
//
// (C) Copyright Mateusz Loskot 2008, mateusz@loskot.net
// Distributed under the BSD License
// (See accompanying file LICENSE.txt or copy at
// http://www.opensource.org/licenses/bsd-license.php)
//
#include <liblas/laserror.hpp>
#include <tut/tut.hpp>
#include <string>

namespace tut
{ 
    struct laserror_data
    {
        int const code;
        std::string const msg;
        std::string const method;

        laserror_data()
            : code(101), msg("Test message"), method("foo")
        {}

        private:
            // non-copyable type
            laserror_data(laserror_data const&);
            laserror_data& operator=(laserror_data const&);
    };

    typedef test_group<laserror_data> tg;
    typedef tg::object to;

    tg test_group_laserror("liblas::LASError");

    // Test constructor
    template<>
    template<>
    void to::test<1>()
    {
        liblas::LASError err(code, msg, method);

        ensure_equals(err.GetCode(), code);
        ensure_equals(err.GetMessage(), msg);
        ensure_equals(err.GetMethod(), method);
    }

    // Test copy constructor
    template<>
    template<>
    void to::test<2>()
    {
        liblas::LASError err(code, msg, method);
        liblas::LASError copy(err);

        ensure_equals(copy.GetCode(), code);
        ensure_equals(copy.GetMessage(), msg);
        ensure_equals(copy.GetMethod(), method);
    }

    // Test assignment operator
    template<>
    template<>
    void to::test<3>()
    {
        liblas::LASError copy(0, "", "");;

        {
            liblas::LASError err(code, msg, method);
            copy = err;
        }

        ensure_equals(copy.GetCode(), code);
        ensure_equals(copy.GetMessage(), msg);
        ensure_equals(copy.GetMethod(), method);
    }
}