blob: f52352c7f4e4cd926f3862035d8a7577360b9892 [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2021 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.jcommons.string;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
@NonNullByDefault
public class StringUtilsTest {
@Test
public void formatCodePoint() {
assertEquals("U+0000", StringUtils.formatCodePoint(0)); // MIN
assertEquals("U+0001", StringUtils.formatCodePoint(1));
assertEquals("U+0041", StringUtils.formatCodePoint('A'));
assertEquals("U+FFFF", StringUtils.formatCodePoint(0xFFFF));
assertEquals("U+010000", StringUtils.formatCodePoint(0x10000));
assertEquals("U+10FFFF", StringUtils.formatCodePoint(0x10FFFF)); // MAX
assertEquals("U+FFFFFFFF", StringUtils.formatCodePoint(0xFFFFFFFF)); // <invalid>
}
}