2858 |
28 Sep 12 |
peter |
// $Id$ |
2858 |
28 Sep 12 |
peter |
2 |
|
2858 |
28 Sep 12 |
peter |
3 |
/* |
4089 |
07 Sep 21 |
peter |
Copyright (C) 2012, 2021 Peter Johansson |
2858 |
28 Sep 12 |
peter |
5 |
|
2858 |
28 Sep 12 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
2858 |
28 Sep 12 |
peter |
7 |
|
2858 |
28 Sep 12 |
peter |
The yat library is free software; you can redistribute it and/or |
2858 |
28 Sep 12 |
peter |
modify it under the terms of the GNU General Public License as |
2858 |
28 Sep 12 |
peter |
published by the Free Software Foundation; either version 3 of the |
2858 |
28 Sep 12 |
peter |
License, or (at your option) any later version. |
2858 |
28 Sep 12 |
peter |
12 |
|
2858 |
28 Sep 12 |
peter |
The yat library is distributed in the hope that it will be useful, |
2858 |
28 Sep 12 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2858 |
28 Sep 12 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2858 |
28 Sep 12 |
peter |
General Public License for more details. |
2858 |
28 Sep 12 |
peter |
17 |
|
2858 |
28 Sep 12 |
peter |
You should have received a copy of the GNU General Public License |
2858 |
28 Sep 12 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
2858 |
28 Sep 12 |
peter |
20 |
*/ |
2858 |
28 Sep 12 |
peter |
21 |
|
2881 |
18 Nov 12 |
peter |
22 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
23 |
|
2858 |
28 Sep 12 |
peter |
24 |
#include "Suite.h" |
2858 |
28 Sep 12 |
peter |
25 |
|
2858 |
28 Sep 12 |
peter |
26 |
#include "yat/utility/Deleter.h" |
2858 |
28 Sep 12 |
peter |
27 |
|
4022 |
04 Jan 21 |
peter |
28 |
#include <memory> |
2858 |
28 Sep 12 |
peter |
29 |
|
2858 |
28 Sep 12 |
peter |
30 |
using namespace theplu::yat; |
2858 |
28 Sep 12 |
peter |
31 |
using utility::Deleter; |
2858 |
28 Sep 12 |
peter |
32 |
|
2858 |
28 Sep 12 |
peter |
33 |
int main(int argc,char* argv[]) |
2858 |
28 Sep 12 |
peter |
34 |
{ |
2858 |
28 Sep 12 |
peter |
35 |
test::Suite suite(argc, argv); |
2858 |
28 Sep 12 |
peter |
36 |
|
2858 |
28 Sep 12 |
peter |
37 |
|
2858 |
28 Sep 12 |
peter |
38 |
Deleter del; |
2858 |
28 Sep 12 |
peter |
39 |
|
2858 |
28 Sep 12 |
peter |
40 |
suite.add(del.active()==true); |
2858 |
28 Sep 12 |
peter |
41 |
|
2858 |
28 Sep 12 |
peter |
42 |
int* p0 = new int(2); |
4022 |
04 Jan 21 |
peter |
43 |
std::shared_ptr<int> smartp(p0, del); |
2858 |
28 Sep 12 |
peter |
44 |
|
2858 |
28 Sep 12 |
peter |
45 |
Deleter del2(false); |
2858 |
28 Sep 12 |
peter |
46 |
int* p = new int(3); |
2858 |
28 Sep 12 |
peter |
47 |
if (true) { |
4022 |
04 Jan 21 |
peter |
48 |
std::shared_ptr<int> sp(p, del2); |
2858 |
28 Sep 12 |
peter |
49 |
suite.out() << *sp << "\n"; |
2858 |
28 Sep 12 |
peter |
50 |
} |
2858 |
28 Sep 12 |
peter |
51 |
suite.out() << *p << "\n"; |
2858 |
28 Sep 12 |
peter |
52 |
delete p; |
2858 |
28 Sep 12 |
peter |
53 |
|
2858 |
28 Sep 12 |
peter |
54 |
|
2858 |
28 Sep 12 |
peter |
55 |
return suite.return_value(); |
2858 |
28 Sep 12 |
peter |
56 |
|
2858 |
28 Sep 12 |
peter |
57 |
} |