File: gp_test.cpp

package info (click to toggle)
oce 0.18.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 301,548 kB
  • sloc: cpp: 1,190,609; ansic: 67,225; sh: 11,630; tcl: 7,954; cs: 5,221; python: 2,867; java: 1,522; makefile: 342; xml: 292; perl: 37
file content (43 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (5)
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
#include <gp_Pnt.hxx>
#include <gtest/gtest.h>

TEST(gpTestSuite, testgp_PntConstruct)
{
    gp_Pnt P;
    ASSERT_EQ(0.0,P.X());
    ASSERT_EQ(0.0,P.Y());
    ASSERT_EQ(0.0,P.Z());
}

TEST(gpTestSuite, testgp_PntDistance)
{
    gp_Pnt P1(0.,0.,0.);
    gp_Pnt P2(0.,3.,4.);
    float D = (float)P1.Distance(P2);
    ASSERT_EQ(5.,D);
}

TEST(gpTestSuite, testBuildThousandsPoints)
{
    for (int i=1;i<10000;i++) {
        gp_Pnt(1,2,3);
    }
}

/*  This test fails with OCCT 6.5.1 and GCC 4.2 */
TEST(gpTestSuite, testGCC42gp_Trsf)
{
    gp_Trsf T;
    T.SetValues(
        1.0, 0.0, 0.0, 0.0,
        0.0, 1.0, 0.0, 0.0,
        0.0, 0.0, 1.0, 0.0);
    ASSERT_EQ(1.0,T.Value(1,1));
    ASSERT_EQ(1.0,T.Value(2,2));
    ASSERT_EQ(1.0,T.Value(3,3));
}

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