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.Parameters;
15 import org.opendaylight.yangtools.yang.common.Uint16;
16 import org.opendaylight.yangtools.yang.common.Uint32;
17 import org.opendaylight.yangtools.yang.common.Uint64;
18 import org.opendaylight.yangtools.yang.common.Uint8;
20 @RunWith(Parameterized.class)
21 public class UintSerializationTest extends AbstractSerializationTest {
22 @Parameters(name = "{0}")
23 public static Iterable<Object[]> data() {
25 new Object[] { NormalizedNodeStreamVersion.SODIUM_SR1 },
26 new Object[] { NormalizedNodeStreamVersion.MAGNESIUM });
30 public void testUint8() {
31 assertSame(Uint8.ZERO, 96);
32 assertSame(Uint8.ONE, 97);
36 public void testUint16() {
37 assertSame(Uint16.ZERO, 96);
38 assertSame(Uint16.ONE, 98);
42 public void testUint32() {
43 assertSame(Uint32.ZERO, 96);
44 assertSame(Uint32.ONE, 98);
45 assertEquals(Uint32.MAX_VALUE, 100);
49 public void testUint64() {
50 assertSame(Uint64.ZERO, 96);
51 assertSame(Uint64.ONE, 100);
52 assertEquals(Uint64.MAX_VALUE, 104);