summaryrefslogtreecommitdiff
path: root/test/STEPImport_test/STEPImport_test.cpp
blob: 48ae66ad20c789d9dcb106fd2d2ed38e7fc2bfce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <TopoDS_Shape.hxx>
#include <STEPControl_Reader.hxx>

#include <gtest/gtest.h>

#include "STEPImport_test_config.h"

TEST(STEPImportTestSuite, testImportAP203_1)
{
    Standard_CString aFileName = (Standard_CString) step_file_ap203_1;
    STEPControl_Reader aReader;
    IFSelect_ReturnStatus status = aReader.ReadFile(aFileName);
    ASSERT_EQ(status,IFSelect_RetDone);
    int nb_root = aReader.NbRootsForTransfer();
    int nb_shapes = 0;
    for ( Standard_Integer n = 1; n <= nb_root; n++ ) {
        Standard_Boolean result = aReader.TransferRoot( n );
        ASSERT_EQ(Standard_True,result);
        nb_shapes = aReader.NbShapes();
        if ( nb_shapes > 0 ) {
            TopoDS_Shape shape = aReader.Shape( n );
            ASSERT_EQ(Standard_False,shape.IsNull());
            }
        }
}

TEST(STEPImportTestSuite, testImportAP203_2)
{
    Standard_CString aFileName = (Standard_CString) step_file_ap203_2;
    STEPControl_Reader aReader;
    IFSelect_ReturnStatus status = aReader.ReadFile(aFileName);
    ASSERT_EQ(status,IFSelect_RetDone);
    int nb_root = aReader.NbRootsForTransfer();
    int nb_shapes = 0;
    for ( Standard_Integer n = 1; n <= nb_root; n++ ) {
        Standard_Boolean result = aReader.TransferRoot( n );
        ASSERT_EQ(Standard_True,result);
        nb_shapes = aReader.NbShapes();
        if ( nb_shapes > 0 ) {
            TopoDS_Shape shape = aReader.Shape( n );
            ASSERT_EQ(Standard_False,shape.IsNull());
            }
        }
}

TEST(STEPImportTestSuite, testImportAP214_1)
{
    Standard_CString aFileName = (Standard_CString) step_file_ap214_1;
    STEPControl_Reader aReader;
    IFSelect_ReturnStatus status = aReader.ReadFile(aFileName);
    ASSERT_EQ(status,IFSelect_RetDone);
    int nb_root = aReader.NbRootsForTransfer();
    int nb_shapes = 0;
    for ( Standard_Integer n = 1; n <= nb_root; n++ ) {
        Standard_Boolean result = aReader.TransferRoot( n );
        ASSERT_EQ(Standard_True,result);
        nb_shapes = aReader.NbShapes();
        if ( nb_shapes > 0 ) {
            TopoDS_Shape shape = aReader.Shape( n );
            ASSERT_EQ(Standard_False,shape.IsNull());
            }
        }
}

TEST(STEPImportTestSuite, testImportAP214_2)
{
    Standard_CString aFileName = (Standard_CString) step_file_ap214_2;
    STEPControl_Reader aReader;
    IFSelect_ReturnStatus status = aReader.ReadFile(aFileName);
    ASSERT_EQ(status,IFSelect_RetDone);
    int nb_root = aReader.NbRootsForTransfer();
    int nb_shapes = 0;
    for ( Standard_Integer n = 1; n <= nb_root; n++ ) {
        Standard_Boolean result = aReader.TransferRoot( n );
        ASSERT_EQ(Standard_True,result);
        nb_shapes = aReader.NbShapes();
        if ( nb_shapes > 0 ) {
            TopoDS_Shape shape = aReader.Shape( n );
            ASSERT_EQ(Standard_False,shape.IsNull());
            }
        }
}

TEST(STEPImportTestSuite, testImportAP214_3)
{
    Standard_CString aFileName = (Standard_CString) step_file_ap214_3;
    STEPControl_Reader aReader;
    IFSelect_ReturnStatus status = aReader.ReadFile(aFileName);
    ASSERT_EQ(status,IFSelect_RetDone);
    int nb_root = aReader.NbRootsForTransfer();
    int nb_shapes = 0;
    for ( Standard_Integer n = 1; n <= nb_root; n++ ) {
        Standard_Boolean result = aReader.TransferRoot( n );
        ASSERT_EQ(Standard_True,result);
        nb_shapes = aReader.NbShapes();
        if ( nb_shapes > 0 ) {
            TopoDS_Shape shape = aReader.Shape( n );
            ASSERT_EQ(Standard_False,shape.IsNull());
            }
        }
}

int main(int argc, char **argv){
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}