*/
@Test
public void testOidItuT()
{
Oid oid = new Oid();
try
{
// itu-t(0), recommendation(0), series a-z (0..26)
for ( int i = 1; i < 27; i++ )
{
oid.setOid( new byte[]
{ 0x00, ( byte ) i } );
assertEquals( "0.0." + i, oid.toString() );
}
// itu-t(0), question(1)
oid.setOid( new byte[]
{ 0x01 } );
assertEquals( "0.1", oid.toString() );
// itu-t(0), administration(2), country(202 .. 748)
for ( int i = 202; i < 748; i++ )
{
oid.setOid( new byte[]
{ 0x02, ( byte ) ( ( i / 128 ) | 0x0080 ), ( byte ) ( i % 128 ) } );
assertEquals( "0.2." + i, oid.toString() );
}
// itu-t(0), network-operator(3), operator(2023 .. 41363)
for ( int i = 2023; i < 41363; i++ )
{
if ( i < ( 128 * 128 ) )
{
oid.setOid( new byte[]
{ 0x03, ( byte ) ( ( i / 128 ) | 0x0080 ), ( byte ) ( i % 128 ) } );
assertEquals( "0.3." + i, oid.toString() );
}
else
{
oid.setOid( new byte[]
{ 0x03, ( byte ) ( ( i / ( 128 * 128 ) ) | 0x0080 ),
( byte ) ( ( ( i / 128 ) % 128 ) | 0x0080 ), ( byte ) ( i % 128 ) } );
assertEquals( "0.3." + i, oid.toString() );
}
}
}
catch ( DecoderException de )