1 // Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "TestUtils.hxx"
23 #include "GroupTest.hxx"
24 #include "../XAO_XaoUtils.hxx"
25 #include "../XAO_Xao.hxx"
26 #include "../XAO_Group.hxx"
30 void GroupTest::setUp()
34 void GroupTest::tearDown()
38 void GroupTest::cleanUp()
42 void GroupTest::testGroup()
44 Group* group = new Group(XAO::FACE, 20);
46 CPPUNIT_ASSERT_EQUAL(XAO::FACE, group->getDimension());
47 CPPUNIT_ASSERT_EQUAL(20, group->getNbElements());
49 CPPUNIT_ASSERT_EQUAL(std::string(""), group->getName());
50 group->setName("the Group");
51 CPPUNIT_ASSERT_EQUAL(std::string("the Group"), group->getName());
53 CPPUNIT_ASSERT_EQUAL(0, group->count());
55 CPPUNIT_ASSERT_EQUAL(1, group->count());
57 CPPUNIT_ASSERT_EQUAL(2, group->count());
59 CPPUNIT_ASSERT_EQUAL(2, group->count());
61 CPPUNIT_ASSERT_EQUAL(10, group->get(0));
62 CPPUNIT_ASSERT_EQUAL(12, group->get(1));
63 CPPUNIT_ASSERT_THROW(group->get(2), XAO_Exception);
66 CPPUNIT_ASSERT_EQUAL(2, group->count());
68 CPPUNIT_ASSERT_EQUAL(1, group->count());
69 CPPUNIT_ASSERT_EQUAL(12, group->get(0));
74 void GroupTest::testGroupErrors()
76 CPPUNIT_ASSERT_THROW(new Group(XAO::WHOLE, 20), XAO_Exception);