LCOV - code coverage report
Current view: top level - itaps/irel - test_status.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 38 38 100.0 %
Date: 2020-12-16 07:07:30 Functions: 5 5 100.0 %
Branches: 46 92 50.0 %

           Branch data     Line data    Source code
       1                 :            : #include "iGeom.h"
       2                 :            : #include "iMesh.h"
       3                 :            : #include "iRel.h"
       4                 :            : 
       5                 :            : #include "TestUtil.hpp"
       6                 :            : 
       7                 :            : #include <cstdlib>
       8                 :            : 
       9                 :            : iGeom_Instance geom;
      10                 :            : iMesh_Instance mesh;
      11                 :            : iRel_Instance rel;
      12                 :            : using namespace moab;
      13                 :            : 
      14                 :          1 : void test_initial_inactive()
      15                 :            : {
      16                 :            :     int err;
      17                 :            :     iRel_PairHandle pair;
      18                 :            : 
      19                 :            :     iRel_createPair( rel, geom, iRel_SET, iRel_IGEOM_IFACE, iRel_INACTIVE, mesh, iRel_SET, iRel_IMESH_IFACE,
      20 [ +  - ][ +  - ]:          1 :                      iRel_ACTIVE, &pair, &err );CHECK_ERR( err );
      21                 :            : 
      22                 :            :     iBase_EntitySetHandle geom_set;
      23 [ +  - ][ +  - ]:          1 :     iGeom_createEntSet( geom, false, &geom_set, &err );CHECK_ERR( err );
      24                 :            : 
      25                 :            :     iBase_EntitySetHandle mesh_set;
      26 [ +  - ][ +  - ]:          1 :     iMesh_createEntSet( mesh, false, &mesh_set, &err );CHECK_ERR( err );
      27                 :            : 
      28 [ +  - ][ +  - ]:          1 :     iRel_setSetSetRelation( rel, pair, geom_set, mesh_set, &err );CHECK_ERR( err );
      29                 :            : 
      30                 :            :     iBase_EntitySetHandle related_set;
      31 [ +  - ][ +  - ]:          1 :     iRel_getSetSetRelation( rel, pair, mesh_set, 1, &related_set, &err );CHECK_ERR( err );
      32         [ +  - ]:          1 :     CHECK_EQUAL( related_set, geom_set );
      33                 :            : 
      34         [ +  - ]:          1 :     iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err );
      35         [ +  - ]:          1 :     CHECK( err != iBase_SUCCESS );
      36                 :            : 
      37 [ +  - ][ +  - ]:          1 :     iRel_changePairStatus( rel, pair, iRel_ACTIVE, iRel_ACTIVE, &err );CHECK_ERR( err );
      38                 :            : 
      39 [ +  - ][ +  - ]:          1 :     iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err );CHECK_ERR( err );
      40         [ +  - ]:          1 :     CHECK_EQUAL( related_set, mesh_set );
      41                 :          1 : }
      42                 :            : 
      43                 :          1 : void test_initial_notexist()
      44                 :            : {
      45                 :            :     int err;
      46                 :            :     iRel_PairHandle pair;
      47                 :            : 
      48                 :            :     iRel_createPair( rel, geom, iRel_SET, iRel_IGEOM_IFACE, iRel_NOTEXIST, mesh, iRel_SET, iRel_IMESH_IFACE,
      49 [ +  - ][ +  - ]:          1 :                      iRel_ACTIVE, &pair, &err );CHECK_ERR( err );
      50                 :            : 
      51                 :            :     iBase_EntitySetHandle geom_set;
      52 [ +  - ][ +  - ]:          1 :     iGeom_createEntSet( geom, false, &geom_set, &err );CHECK_ERR( err );
      53                 :            : 
      54                 :            :     iBase_EntitySetHandle mesh_set;
      55 [ +  - ][ +  - ]:          1 :     iMesh_createEntSet( mesh, false, &mesh_set, &err );CHECK_ERR( err );
      56                 :            : 
      57 [ +  - ][ +  - ]:          1 :     iRel_setSetSetRelation( rel, pair, geom_set, mesh_set, &err );CHECK_ERR( err );
      58                 :            : 
      59                 :            :     iBase_EntitySetHandle related_set;
      60 [ +  - ][ +  - ]:          1 :     iRel_getSetSetRelation( rel, pair, mesh_set, 1, &related_set, &err );CHECK_ERR( err );
      61         [ +  - ]:          1 :     CHECK_EQUAL( related_set, geom_set );
      62                 :            : 
      63         [ +  - ]:          1 :     iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err );
      64         [ +  - ]:          1 :     CHECK( err != iBase_SUCCESS );
      65                 :            : 
      66 [ +  - ][ +  - ]:          1 :     iRel_changePairStatus( rel, pair, iRel_ACTIVE, iRel_ACTIVE, &err );CHECK_ERR( err );
      67                 :            : 
      68 [ +  - ][ +  - ]:          1 :     iRel_getSetSetRelation( rel, pair, geom_set, 0, &related_set, &err );CHECK_ERR( err );
      69         [ +  - ]:          1 :     CHECK_EQUAL( related_set, mesh_set );
      70                 :          1 : }
      71                 :            : 
      72                 :          1 : int main()
      73                 :            : {
      74                 :            :     int err;
      75                 :          1 :     int num_fail = 0;
      76                 :            : 
      77         [ +  - ]:          1 :     iGeom_newGeom( 0, &geom, &err, 0 );
      78         [ +  - ]:          1 :     iMesh_newMesh( 0, &mesh, &err, 0 );
      79         [ +  - ]:          1 :     iRel_create( 0, &rel, &err, 0 );
      80                 :            : 
      81         [ +  - ]:          1 :     num_fail += RUN_TEST( test_initial_inactive );
      82         [ +  - ]:          1 :     num_fail += RUN_TEST( test_initial_notexist );
      83                 :            : 
      84         [ +  - ]:          1 :     iRel_destroy( rel, &err );
      85         [ +  - ]:          1 :     iMesh_dtor( mesh, &err );
      86         [ +  - ]:          1 :     iGeom_dtor( geom, &err );
      87                 :            : 
      88                 :          1 :     return num_fail;
      89 [ +  - ][ +  - ]:          4 : }

Generated by: LCOV version 1.11