root/OpenSceneGraph/trunk/examples/osgunittests/UnitTests_osg.cpp @ 6879

Revision 6879, 1.4 kB (checked in by robert, 8 years ago)

Added support for using quat_scaled sx sy sz for testing getting quats from scaled
matrices. Removed broken Matrixd/quat test

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#include "UnitTestFramework.h"
2
3#include <osg/Matrixd>
4#include <osg/Vec3>
5#include <sstream>
6
7namespace osg
8{
9
10
11///////////////////////////////////////////////////////////////////////////////
12//
13//  Vec3 Tests
14//
15class Vec3TestFixture
16{
17public:
18
19    Vec3TestFixture();
20
21    void testAddition(const osgUtx::TestContext& ctx);
22    void testSubtraction(const osgUtx::TestContext& ctx);
23    void testScalarMultiplication(const osgUtx::TestContext& ctx);
24    void testDotProduct(const osgUtx::TestContext& ctx);
25
26private:
27
28    // Some convenience variables for use in the tests
29    Vec3 v1_, v2_, v3_;
30
31};
32
33Vec3TestFixture::Vec3TestFixture():
34    v1_(1.0f, 1.0f, 1.0f),
35    v2_(2.0f, 2.0f, 2.0f),
36    v3_(3.0f, 3.0f, 3.0f)
37{
38}
39
40void Vec3TestFixture::testAddition(const osgUtx::TestContext&)
41{
42    OSGUTX_TEST_F( v1_ + v2_ == v3_ )
43}
44
45void Vec3TestFixture::testSubtraction(const osgUtx::TestContext&)
46{
47    OSGUTX_TEST_F( v3_ - v1_ == v2_ )
48}
49
50void Vec3TestFixture::testScalarMultiplication(const osgUtx::TestContext&)
51{
52    OSGUTX_TEST_F( v1_ * 3 == v3_ )
53}
54
55void Vec3TestFixture::testDotProduct(const osgUtx::TestContext&)
56{
57   
58}
59
60OSGUTX_BEGIN_TESTSUITE(Vec3)
61    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testAddition)
62    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testSubtraction)
63    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testScalarMultiplication)
64    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testDotProduct)
65OSGUTX_END_TESTSUITE
66
67OSGUTX_AUTOREGISTER_TESTSUITE_AT(Vec3, root.osg)
68
69}
Note: See TracBrowser for help on using the browser.