Home / File/ SWARUtilTest.java — netty Source File

SWARUtilTest.java — netty Source File

Architecture documentation for SWARUtilTest.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2024 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.util.internal;

import org.junit.jupiter.api.Test;

import java.util.Random;

import static org.junit.jupiter.api.Assertions.assertEquals;

class SWARUtilTest {

    private final Random random = new Random();

    @Test
    void containsUpperCaseLong() {
        // given
        final byte[] asciiTable = getExtendedAsciiTable();
        shuffleArray(asciiTable, random);

        // when
        for (int idx = 0; idx < asciiTable.length; idx += Long.BYTES) {
            final long value = getLong(asciiTable, idx);
            final boolean actual = SWARUtil.containsUpperCase(value);
            boolean expected = false;
            for (int i = 0; i < Long.BYTES; i++) {
                expected |= Character.isUpperCase(asciiTable[idx + i]);
            }
            // then
            assertEquals(expected, actual);
        }
    }

    @Test
    void containsUpperCaseInt() {
        // given
        final byte[] asciiTable = getExtendedAsciiTable();
        shuffleArray(asciiTable, random);

        // when
        for (int idx = 0; idx < asciiTable.length; idx += Integer.BYTES) {
            final int value = getInt(asciiTable, idx);
            final boolean containsUpperCase = SWARUtil.containsUpperCase(value);
            boolean expectedContainsUpperCase = false;
            for (int i = 0; i < Integer.BYTES; i++) {
                expectedContainsUpperCase |= Character.isUpperCase(asciiTable[idx + i]);
            }
// ... (161 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does SWARUtilTest.java do?
SWARUtilTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Telemetry subdomain.
Where is SWARUtilTest.java in the architecture?
SWARUtilTest.java is located at common/src/test/java/io/netty/util/internal/SWARUtilTest.java (domain: Buffer, subdomain: Telemetry, directory: common/src/test/java/io/netty/util/internal).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free