* More unit tests * Fixed water height in sceneviewer and brought it up to speed with the latest libsecondlife API git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@553 52acb1d6-8a22-11de-b505-999d5b087335
82 lines
3.1 KiB
C#
82 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using libsecondlife;
|
|
using libsecondlife.Packets;
|
|
using NUnit.Framework;
|
|
|
|
namespace libsecondlife.Tests
|
|
{
|
|
[TestFixture]
|
|
public class TypeTests : Assert
|
|
{
|
|
[Test]
|
|
public void LLUUIDs()
|
|
{
|
|
// Comparison
|
|
LLUUID a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
|
0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
|
|
LLUUID b = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
|
0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
|
|
|
|
Assert.IsTrue(a == b, "LLUUID comparison operator failed, " + a.ToString() + " should equal " +
|
|
b.ToString());
|
|
|
|
// From string
|
|
a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
|
0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
|
|
b = new LLUUID("00010203-0405-0607-0809-0a0b0c0d0e0f");
|
|
|
|
Assert.IsTrue(a == b, "LLUUID hyphenated string constructor failed, should have " + a.ToString() +
|
|
" but we got " + b.ToString());
|
|
|
|
// CRC
|
|
// FIXME:
|
|
}
|
|
|
|
[Test]
|
|
public void Quaternions()
|
|
{
|
|
LLQuaternion a = new LLQuaternion(1, 0, 0, 0);
|
|
LLQuaternion b = new LLQuaternion(1, 0, 0, 0);
|
|
|
|
Assert.IsTrue(a == b, "LLQuaternion comparison operator failed");
|
|
|
|
LLQuaternion expected = new LLQuaternion(0, 0, 0, -1);
|
|
LLQuaternion result = a * b;
|
|
|
|
Assert.IsTrue(result == expected, a.ToString() + " * " + b.ToString() + " produced " + result.ToString() +
|
|
" instead of " + expected.ToString());
|
|
|
|
a = new LLQuaternion(1, 0, 0, 0);
|
|
b = new LLQuaternion(0, 1, 0, 0);
|
|
expected = new LLQuaternion(0, 0, 1, 0);
|
|
result = a * b;
|
|
|
|
Assert.IsTrue(result == expected, a.ToString() + " * " + b.ToString() + " produced " + result.ToString() +
|
|
" instead of " + expected.ToString());
|
|
|
|
a = new LLQuaternion(0, 0, 1, 0);
|
|
b = new LLQuaternion(0, 1, 0, 0);
|
|
expected = new LLQuaternion(-1, 0, 0, 0);
|
|
result = a * b;
|
|
|
|
Assert.IsTrue(result == expected, a.ToString() + " * " + b.ToString() + " produced " + result.ToString() +
|
|
" instead of " + expected.ToString());
|
|
|
|
//a = new LLQuaternion(0.19134f, -0.46194f, 0.19134f, 0.84462f);
|
|
//b = new LLQuaternion(-0.54861f, 1.00000f, 0.75000f, 0.10000f);
|
|
//expected = new LLQuaternion(-0.9820279f, 0.5499499f, 0.5905141f, 0.5078681f);
|
|
//result = a * b;
|
|
|
|
//Assert.IsTrue(result == expected, a.ToString() + " * " + b.ToString() + " produced " + result.ToString() +
|
|
// " instead of " + expected.ToString());
|
|
}
|
|
[Test]
|
|
public void VectorQuaternionMath()
|
|
{
|
|
;
|
|
}
|
|
}
|
|
}
|