2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.codec.binfmt;
10 import java.util.Arrays;
11 import org.junit.Test;
12 import org.junit.runner.RunWith;
13 import org.junit.runners.Parameterized;
14 import org.junit.runners.Parameterized.Parameter;
15 import org.junit.runners.Parameterized.Parameters;
17 @RunWith(Parameterized.class)
18 public class IntSerializationTest extends AbstractSerializationTest {
19 @Parameters(name = "{0}")
20 public static Iterable<Object[]> data() {
22 new Object[] { NormalizedNodeStreamVersion.LITHIUM, 97, 97, 98, 98, 100, 100, 100, 104, 104, 104 },
23 new Object[] { NormalizedNodeStreamVersion.NEON_SR2, 99, 99, 100, 100, 102, 102, 102, 106, 106, 106 },
24 new Object[] { NormalizedNodeStreamVersion.SODIUM_SR1, 96, 97, 96, 98, 96, 98, 100, 96, 100, 104 },
25 new Object[] { NormalizedNodeStreamVersion.MAGNESIUM, 96, 97, 96, 98, 96, 98, 100, 96, 100, 104 });
29 public int expectedByte;
31 public int expectedByteOne;
33 public int expectedShort;
35 public int expectedShortOne;
37 public int expectedInt;
39 public int expectedIntOne;
41 public int expectedIntMax;
43 public int expectedLong;
45 public int expectedLongOne;
47 public int expectedLongMax;
50 public void testByte() {
51 assertSame((byte) 0, expectedByte);
52 assertSame((byte) 1, expectedByteOne);
53 assertSame(Byte.MAX_VALUE, expectedByteOne);
57 public void testShort() {
58 assertSame((short) 0, expectedShort);
59 assertSame((short) 1, expectedShortOne);
60 assertSame(Short.MAX_VALUE, expectedShortOne);
64 public void testInt() {
65 assertSame(0, expectedInt);
66 assertSame(1, expectedIntOne);
67 assertSame(Integer.MAX_VALUE, expectedIntMax);
71 public void testLong() {
72 assertSame(0L, expectedLong);
73 assertSame(1L, expectedLongOne);
74 assertSame(Long.MAX_VALUE, expectedLongMax);