mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-05 16:44:17 +05:00
add XaoTest
This commit is contained in:
parent
a24956bf0a
commit
23adb0a6eb
70
src/XAO/tests/XaoTest.cxx
Normal file
70
src/XAO/tests/XaoTest.cxx
Normal file
@ -0,0 +1,70 @@
|
||||
#include <vector>
|
||||
#include <Utils_SALOME_Exception.hxx>
|
||||
|
||||
#include "TestUtils.hxx"
|
||||
#include "XaoTest.hxx"
|
||||
#include "../XAO_Xao.hxx"
|
||||
#include "../XAO_BrepGeometry.hxx"
|
||||
#include "../XAO_Group.hxx"
|
||||
#include "../XAO_Field.hxx"
|
||||
|
||||
using namespace XAO;
|
||||
|
||||
void XaoTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
void XaoTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
void XaoTest::cleanUp()
|
||||
{
|
||||
}
|
||||
|
||||
void XaoTest::testGroups()
|
||||
{
|
||||
Xao obj;
|
||||
CPPUNIT_ASSERT_THROW(obj.addGroup(XAO::FACE), SALOME_Exception);
|
||||
|
||||
BrepGeometry* geom = new BrepGeometry("test");
|
||||
obj.setGeometry(geom);
|
||||
Group* gr = obj.addGroup(XAO::FACE);
|
||||
CPPUNIT_ASSERT_EQUAL(XAO::FACE, gr->getDimension());
|
||||
CPPUNIT_ASSERT_EQUAL(1, obj.countGroups());
|
||||
Group* gr2 = obj.addGroup(XAO::FACE);
|
||||
|
||||
Group* agr = obj.getGroup(0);
|
||||
CPPUNIT_ASSERT(gr == agr);
|
||||
CPPUNIT_ASSERT_THROW(obj.getGroup(10), SALOME_Exception);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(true, obj.removeGroup(gr2));
|
||||
CPPUNIT_ASSERT(gr2 != NULL);
|
||||
CPPUNIT_ASSERT_EQUAL(1, obj.countGroups());
|
||||
CPPUNIT_ASSERT_EQUAL(false, obj.removeGroup(gr2)); // remove again
|
||||
}
|
||||
|
||||
void XaoTest::testFields()
|
||||
{
|
||||
Xao obj;
|
||||
CPPUNIT_ASSERT_THROW(obj.addField(XAO::INTEGER, XAO::FACE, 3), SALOME_Exception);
|
||||
|
||||
BrepGeometry* geom = new BrepGeometry("test");
|
||||
obj.setGeometry(geom);
|
||||
Field* fi = obj.addField(XAO::INTEGER, XAO::FACE, 3);
|
||||
CPPUNIT_ASSERT_EQUAL(1, obj.countFields());
|
||||
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, fi->getType());
|
||||
CPPUNIT_ASSERT_EQUAL(XAO::FACE, fi->getDimension());
|
||||
CPPUNIT_ASSERT_EQUAL(3, fi->countComponents());
|
||||
|
||||
Field* fb = obj.addField(XAO::BOOLEAN, XAO::FACE, 3);
|
||||
Field* fd = obj.addField(XAO::DOUBLE, XAO::FACE, 3);
|
||||
Field* fs = obj.addField(XAO::STRING, XAO::FACE, 3);
|
||||
CPPUNIT_ASSERT_EQUAL(4, obj.countFields());
|
||||
CPPUNIT_ASSERT_THROW(obj.getField(10), SALOME_Exception);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(true, obj.removeField(fb));
|
||||
CPPUNIT_ASSERT(fb != NULL);
|
||||
CPPUNIT_ASSERT_EQUAL(3, obj.countFields());
|
||||
CPPUNIT_ASSERT_EQUAL(false, obj.removeField(fb)); // remove again
|
||||
}
|
25
src/XAO/tests/XaoTest.hxx
Normal file
25
src/XAO/tests/XaoTest.hxx
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef __XAO_XAO_TEST_HXX__
|
||||
#define __XAO_XAO_TEST_HXX__
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
namespace XAO
|
||||
{
|
||||
class XaoTest: public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(XaoTest);
|
||||
CPPUNIT_TEST(testGroups);
|
||||
CPPUNIT_TEST(testFields);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
void setUp();
|
||||
void tearDown();
|
||||
void cleanUp();
|
||||
|
||||
void testGroups();
|
||||
void testFields();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __XAO_GROUP_TEST_HXX__
|
Loading…
Reference in New Issue
Block a user