~ubuntu-branches/ubuntu/wily/bombono-dvd/wily

« back to all changes in this revision

Viewing changes to src/mlib/tests/test_ptr.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-04 11:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101104114625-8xfdhvhpsm51i0nu
Tags: upstream-0.8.0
Import upstream version 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// mlib/tests/test_ptr.cpp
3
3
// This file is part of Bombono DVD project.
4
4
//
5
 
// Copyright (c) 2007-2008 Ilya Murav'jov
 
5
// Copyright (c) 2007-2008, 2010 Ilya Murav'jov
6
6
//
7
7
// This program is free software; you can redistribute it and/or modify
8
8
// it under the terms of the GNU General Public License as published by
37
37
        Ptr<set_bool> ptr1;
38
38
        Ptr<set_bool> ptr2((set_bool*)0);
39
39
 
40
 
        Ptr<set_bool> ptr3 = new set_bool(b);
 
40
        Ptr<set_bool> ptr3(new set_bool(b));
41
41
        BOOST_CHECK( b );
42
42
    }
43
43
    BOOST_CHECK( !b );
61
61
 
62
62
    // reset()
63
63
    {
64
 
        Ptr<set_bool> ptr = new set_bool(b); 
 
64
        Ptr<set_bool> ptr(new set_bool(b)); 
65
65
 
66
66
        ptr.reset((set_bool*)0);
67
67
        BOOST_CHECK( !b );
88
88
    // operator ->
89
89
    {
90
90
        typedef std::pair<int, int> iint;
91
 
        Ptr<iint> pair_ptr = new iint(1,2);
 
91
        Ptr<iint> pair_ptr(new iint(1,2));
92
92
        BOOST_CHECK( pair_ptr->first  == 1 );
93
93
        BOOST_CHECK( pair_ptr->second == 2 );
94
94
    }
104
104
    // конструктор ptr::one(ptr::one&)
105
105
    {
106
106
        set_bool* p_sb = new set_bool(b);
107
 
        ptr::one<set_bool> ptr = p_sb;
 
107
        ptr::one<set_bool> ptr(p_sb);
108
108
 
109
109
        ptr::one<set_bool> new_ptr(ptr);
110
110
        BOOST_CHECK( !ptr.get() );
114
114
 
115
115
    // release()
116
116
    {
117
 
        ptr::one<set_bool> ptr = new set_bool(b);
 
117
        ptr::one<set_bool> ptr(new set_bool(b));
118
118
 
119
119
        set_bool* p_sb = ptr.release();
120
120
        BOOST_CHECK( p_sb && !ptr.get() );