|
Revision 6941, 2.4 kB
(checked in by robert, 6 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 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | #include "UnitTestFramework.h" |
|---|
| 20 | |
|---|
| 21 | #include <osg/Matrixd> |
|---|
| 22 | #include <osg/Vec3> |
|---|
| 23 | #include <sstream> |
|---|
| 24 | |
|---|
| 25 | namespace osg |
|---|
| 26 | { |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | class Vec3TestFixture |
|---|
| 34 | { |
|---|
| 35 | public: |
|---|
| 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 | |
|---|
| 44 | private: |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | Vec3 v1_, v2_, v3_; |
|---|
| 48 | |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | Vec3TestFixture::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 | |
|---|
| 58 | void Vec3TestFixture::testAddition(const osgUtx::TestContext&) |
|---|
| 59 | { |
|---|
| 60 | OSGUTX_TEST_F( v1_ + v2_ == v3_ ) |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | void Vec3TestFixture::testSubtraction(const osgUtx::TestContext&) |
|---|
| 64 | { |
|---|
| 65 | OSGUTX_TEST_F( v3_ - v1_ == v2_ ) |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | void Vec3TestFixture::testScalarMultiplication(const osgUtx::TestContext&) |
|---|
| 69 | { |
|---|
| 70 | OSGUTX_TEST_F( v1_ * 3 == v3_ ) |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | void Vec3TestFixture::testDotProduct(const osgUtx::TestContext&) |
|---|
| 74 | { |
|---|
| 75 | |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | OSGUTX_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) |
|---|
| 83 | OSGUTX_END_TESTSUITE |
|---|
| 84 | |
|---|
| 85 | OSGUTX_AUTOREGISTER_TESTSUITE_AT(Vec3, root.osg) |
|---|
| 86 | |
|---|
| 87 | } |
|---|