File: ByteConvertTest.java

package info (click to toggle)
libmetadata-extractor-java 2.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 6,416 kB
  • sloc: java: 35,343; xml: 200; sh: 11; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 662 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.drew.lang;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * @author Drew Noakes http://drewnoakes.com
 */
public class ByteConvertTest
{
    @Test
    public void toInt32BigEndian()
    {
        assertEquals(0x01020304, ByteConvert.toInt32BigEndian(new byte[]{1, 2, 3, 4}));
        assertEquals(0x01020304, ByteConvert.toInt32BigEndian(new byte[]{1, 2, 3, 4, 5}));
    }

    @Test
    public void toInt32LittleEndian()
    {
        assertEquals(0x04030201, ByteConvert.toInt32LittleEndian(new byte[]{1, 2, 3, 4}));
        assertEquals(0x04030201, ByteConvert.toInt32LittleEndian(new byte[]{1, 2, 3, 4, 5}));
    }
}