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 static org.junit.Assume.assumeTrue;
12 import java.util.Arrays;
13 import org.junit.Test;
14 import org.junit.runner.RunWith;
15 import org.junit.runners.Parameterized;
16 import org.junit.runners.Parameterized.Parameter;
17 import org.junit.runners.Parameterized.Parameters;
19 @RunWith(Parameterized.class)
20 public class StringSerializationTest extends AbstractSerializationTest {
21 private static final String STR_MEDIUM = "a".repeat(32767);
22 private static final String STR_HUGE = "©".repeat(16777216);
24 @Parameters(name = "{0}")
25 public static Iterable<Object[]> data() {
27 new Object[] { NormalizedNodeStreamVersion.LITHIUM, 98, 99, 32867, 33554532 },
28 new Object[] { NormalizedNodeStreamVersion.NEON_SR2, 100, 101, 32869, 33554534 },
29 new Object[] { NormalizedNodeStreamVersion.SODIUM_SR1, 96, 99, 32865, 33554532 },
30 new Object[] { NormalizedNodeStreamVersion.MAGNESIUM, 96, 99, 32865, 33554532 });
38 public int mediumSize;
43 public void testEmptyString() {
44 assertEquals("", emptySize);
48 public void testEmptySame() {
49 assumeTrue(version.compareTo(NormalizedNodeStreamVersion.SODIUM_SR1) >= 0);
50 assertSame("", emptySize);
54 public void testOne() {
55 assertEquals("a", oneSize);
59 public void testMedium() {
60 assertEquals(STR_MEDIUM, mediumSize);
64 public void testHuge() {
65 assertEquals(STR_HUGE, hugeSize);