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

Revision 6941, 2.4 kB (checked in by robert, 8 years ago)

From Martin Lavery and Robert Osfield, Updated examples to use a variation of the MIT License

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* OpenSceneGraph example, osgunittests.
2*
3*  Permission is hereby granted, free of charge, to any person obtaining a copy
4*  of this software and associated documentation files (the "Software"), to deal
5*  in the Software without restriction, including without limitation the rights
6*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7*  copies of the Software, and to permit persons to whom the Software is
8*  furnished to do so, subject to the following conditions:
9*
10*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16*  THE SOFTWARE.
17*/
18
19#include "UnitTestFramework.h"
20
21#include <osg/Matrixd>
22#include <osg/Vec3>
23#include <sstream>
24
25namespace osg
26{
27
28
29///////////////////////////////////////////////////////////////////////////////
30//
31//  Vec3 Tests
32//
33class Vec3TestFixture
34{
35public:
36
37    Vec3TestFixture();
38
39    void testAddition(const osgUtx::TestContext& ctx);
40    void testSubtraction(const osgUtx::TestContext& ctx);
41    void testScalarMultiplication(const osgUtx::TestContext& ctx);
42    void testDotProduct(const osgUtx::TestContext& ctx);
43
44private:
45
46    // Some convenience variables for use in the tests
47    Vec3 v1_, v2_, v3_;
48
49};
50
51Vec3TestFixture::Vec3TestFixture():
52    v1_(1.0f, 1.0f, 1.0f),
53    v2_(2.0f, 2.0f, 2.0f),
54    v3_(3.0f, 3.0f, 3.0f)
55{
56}
57
58void Vec3TestFixture::testAddition(const osgUtx::TestContext&)
59{
60    OSGUTX_TEST_F( v1_ + v2_ == v3_ )
61}
62
63void Vec3TestFixture::testSubtraction(const osgUtx::TestContext&)
64{
65    OSGUTX_TEST_F( v3_ - v1_ == v2_ )
66}
67
68void Vec3TestFixture::testScalarMultiplication(const osgUtx::TestContext&)
69{
70    OSGUTX_TEST_F( v1_ * 3 == v3_ )
71}
72
73void Vec3TestFixture::testDotProduct(const osgUtx::TestContext&)
74{
75   
76}
77
78OSGUTX_BEGIN_TESTSUITE(Vec3)
79    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testAddition)
80    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testSubtraction)
81    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testScalarMultiplication)
82    OSGUTX_ADD_TESTCASE(Vec3TestFixture, testDotProduct)
83OSGUTX_END_TESTSUITE
84
85OSGUTX_AUTOREGISTER_TESTSUITE_AT(Vec3, root.osg)
86
87}
Note: See TracBrowser for help on using the browser.