mirror of
https://github.com/apache/activemq.git
synced 2025-03-01 21:59:10 +00:00
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@380620 13f79535-47bb-0310-9956-ffa450edef68
61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using NUnit.Framework;
|
|
using OpenWire.Client.Core;
|
|
using System;
|
|
|
|
namespace openwire_dotnet
|
|
{
|
|
[TestFixture]
|
|
public class EndianTest
|
|
{
|
|
|
|
[Test]
|
|
public void TestLongEndian()
|
|
{
|
|
long value = 0x0102030405060708L;
|
|
|
|
long newValue = DataStreamMarshaller.SwitchEndian(value);
|
|
|
|
Console.WriteLine("New value: " + newValue);
|
|
|
|
Assert.AreEqual(0x0807060504030201L, newValue);
|
|
|
|
long actual = DataStreamMarshaller.SwitchEndian(newValue);
|
|
|
|
Assert.AreEqual(value, actual);
|
|
}
|
|
|
|
[Test]
|
|
public void TestIntEndian()
|
|
{
|
|
int value = 0x12345678;
|
|
|
|
int newValue = DataStreamMarshaller.SwitchEndian(value);
|
|
|
|
Console.WriteLine("New value: " + newValue);
|
|
|
|
Assert.AreEqual(0x78563412, newValue);
|
|
|
|
int actual = DataStreamMarshaller.SwitchEndian(newValue);
|
|
|
|
Assert.AreEqual(value, actual);
|
|
}
|
|
[Test]
|
|
public void TestShortEndian()
|
|
{
|
|
short value = 0x1234;
|
|
|
|
short newValue = DataStreamMarshaller.SwitchEndian(value);
|
|
|
|
Console.WriteLine("New value: " + newValue);
|
|
|
|
Assert.AreEqual(0x3412, newValue);
|
|
|
|
short actual = DataStreamMarshaller.SwitchEndian(newValue);
|
|
|
|
Assert.AreEqual(value, actual);
|
|
}
|
|
}
|
|
}
|
|
|
|
|