1 /*---------------------------------------------------------------------------*\
5 * Copyright 2009 by OpenSG Forum *
7 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
13 * This library is free software; you can redistribute it and/or modify it *
14 * under the terms of the GNU Library General Public License as published *
15 * by the Free Software Foundation, version 2. *
17 * This library is distributed in the hope that it will be useful, but *
18 * WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
20 * Library General Public License for more details. *
22 * You should have received a copy of the GNU Library General Public *
23 * License along with this library; if not, write to the Free Software *
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
35 \*---------------------------------------------------------------------------*/
37 #include <UnitTest++.h>
39 #include "OSGFieldContainer.h"
41 #include "OSGNodeCore.h"
45 OSG_GEN_CONTAINERPTR(FieldContainer
);
48 SUITE(MTRefCountPtrTests
)
53 OSG::NodeMTRefPtr n0
= OSG::Node ::create();
54 OSG::GroupMTRefPtr g0
= OSG::Group::create();
63 CHECK(n0
->getCore() != NULL
);
67 CHECK_EQUAL(static_cast<OSG::FieldContainer
*>(NULL
), n0
);
68 CHECK_EQUAL(static_cast<OSG::FieldContainer
*>(NULL
), g0
);
74 OSG::NodeMTRefPtr n0
= OSG::Node::create();
75 OSG::NodeMTRefPtr n1
= OSG::Node::create();
76 OSG::NodeMTRefPtr n2
= OSG::Node::create();
78 OSG::GroupMTRefPtr g0
= OSG::Group::create();
79 OSG::GroupMTRefPtr g1
= OSG::Group::create();
80 OSG::GroupMTRefPtr g2
= OSG::Group::create();
82 OSG::FieldContainer
*fc
= g1
;
84 typedef std::vector
<OSG::FieldContainerMTRefPtr
> FCMTStore
;
87 fcStore
.push_back(n0
);
88 fcStore
.push_back(n1
);
89 fcStore
.push_back(n2
);
91 fcStore
.push_back(g0
);
92 fcStore
.push_back(g1
);
93 fcStore
.push_back(g2
);
95 FCMTStore::iterator fcIt
;
97 fcIt
= std::find(fcStore
.begin(), fcStore
.end(), fc
);
99 CHECK(fcIt
!= fcStore
.end());
102 CHECK(std::distance(fcStore
.begin(), fcIt
) == 4);
106 } // SUITE(MTRefCountPtrTests)