lasso
test_status.cpp
Go to the documentation of this file.
00001 #include "iGeom.h"
00002 #include "iMesh.h"
00003 #include "iRel.h"
00004 
00005 #include "TestUtil.hpp"
00006 
00007 #include <cstdlib>
00008 
00009 iGeom_Instance geom;
00010 iMesh_Instance mesh;
00011 iRel_Instance rel;
00012 
00013 void test_initial_inactive()
00014 {
00015   int err;
00016   iRel_PairHandle pair;
00017 
00018   iRel_createPair(rel, geom, iRel_SET, iRel_IGEOM_IFACE, iRel_INACTIVE,
00019                        mesh, iRel_SET, iRel_IMESH_IFACE, iRel_ACTIVE,
00020                   &pair, &err);
00021   CHECK_ERR(err);
00022 
00023   iBase_EntitySetHandle geom_set;
00024   iGeom_createEntSet(geom, false, &geom_set, &err);
00025   CHECK_ERR(err);
00026 
00027   iBase_EntitySetHandle mesh_set;
00028   iMesh_createEntSet(mesh, false, &mesh_set, &err);
00029   CHECK_ERR(err);
00030 
00031   iRel_setSetSetRelation(rel, pair, geom_set, mesh_set, &err);
00032   CHECK_ERR(err);
00033 
00034   iBase_EntitySetHandle related_set;
00035   iRel_getSetSetRelation(rel, pair, mesh_set, 1, &related_set, &err);
00036   CHECK_ERR(err);
00037   CHECK_EQUAL(related_set, geom_set);
00038 
00039   iRel_getSetSetRelation(rel, pair, geom_set, 0, &related_set, &err);
00040   CHECK(err != iBase_SUCCESS);
00041 
00042   iRel_changePairStatus(rel, pair, iRel_ACTIVE, iRel_ACTIVE, &err);
00043   CHECK_ERR(err);
00044 
00045   iRel_getSetSetRelation(rel, pair, geom_set, 0, &related_set, &err);
00046   CHECK_ERR(err);
00047   CHECK_EQUAL(related_set, mesh_set);
00048 
00049 }
00050 
00051 void test_initial_notexist()
00052 {
00053   int err;
00054   iRel_PairHandle pair;
00055 
00056   iRel_createPair(rel, geom, iRel_SET, iRel_IGEOM_IFACE, iRel_NOTEXIST,
00057                        mesh, iRel_SET, iRel_IMESH_IFACE, iRel_ACTIVE,
00058                   &pair, &err);
00059   CHECK_ERR(err);
00060 
00061   iBase_EntitySetHandle geom_set;
00062   iGeom_createEntSet(geom, false, &geom_set, &err);
00063   CHECK_ERR(err);
00064 
00065   iBase_EntitySetHandle mesh_set;
00066   iMesh_createEntSet(mesh, false, &mesh_set, &err);
00067   CHECK_ERR(err);
00068 
00069   iRel_setSetSetRelation(rel, pair, geom_set, mesh_set, &err);
00070   CHECK_ERR(err);
00071 
00072   iBase_EntitySetHandle related_set;
00073   iRel_getSetSetRelation(rel, pair, mesh_set, 1, &related_set, &err);
00074   CHECK_ERR(err);
00075   CHECK_EQUAL(related_set, geom_set);
00076 
00077   iRel_getSetSetRelation(rel, pair, geom_set, 0, &related_set, &err);
00078   CHECK(err != iBase_SUCCESS);
00079 
00080   iRel_changePairStatus(rel, pair, iRel_ACTIVE, iRel_ACTIVE, &err);
00081   CHECK_ERR(err);
00082 
00083   iRel_getSetSetRelation(rel, pair, geom_set, 0, &related_set, &err);
00084   CHECK_ERR(err);
00085   CHECK_EQUAL(related_set, mesh_set);
00086 
00087 }
00088 
00089 int main()
00090 {
00091   int err;
00092   int num_fail = 0;
00093 
00094   iGeom_newGeom(0, &geom, &err, 0);
00095   iMesh_newMesh(0, &mesh, &err, 0);
00096   iRel_create(0, &rel, &err, 0);
00097 
00098   num_fail += RUN_TEST(test_initial_inactive);
00099   num_fail += RUN_TEST(test_initial_notexist);
00100 
00101   iRel_destroy(rel, &err);
00102   iMesh_dtor(mesh, &err);
00103   iGeom_dtor(geom, &err);
00104 
00105   return num_fail;
00106 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines