Home / Function/ testSearch() — netty Function Reference

testSearch() — netty Function Reference

Architecture documentation for the testSearch() function in SearchProcessorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5414cf3b_6b5e_6d68_57e9_fe5f4a309796["testSearch()"]
  77fd8c98_90ee_f735_3303_8eafc0856e0c["SearchProcessorTest"]
  5414cf3b_6b5e_6d68_57e9_fe5f4a309796 -->|defined in| 77fd8c98_90ee_f735_3303_8eafc0856e0c
  style 5414cf3b_6b5e_6d68_57e9_fe5f4a309796 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/search/SearchProcessorTest.java lines 52–86

    @ParameterizedTest
    @EnumSource(Algorithm.class)
    public void testSearch(Algorithm algorithm) {
        final ByteBuf haystack = Unpooled.copiedBuffer("abc☺", CharsetUtil.UTF_8);

        assertEquals(0, haystack.forEachByte(factory(algorithm, "a").newSearchProcessor()));
        assertEquals(1, haystack.forEachByte(factory(algorithm, "ab").newSearchProcessor()));
        assertEquals(2, haystack.forEachByte(factory(algorithm, "abc").newSearchProcessor()));
        assertEquals(5, haystack.forEachByte(factory(algorithm, "abc☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "abc☺☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "abc☺x").newSearchProcessor()));

        assertEquals(1, haystack.forEachByte(factory(algorithm, "b").newSearchProcessor()));
        assertEquals(2, haystack.forEachByte(factory(algorithm, "bc").newSearchProcessor()));
        assertEquals(5, haystack.forEachByte(factory(algorithm, "bc☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "bc☺☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "bc☺x").newSearchProcessor()));

        assertEquals(2, haystack.forEachByte(factory(algorithm, "c").newSearchProcessor()));
        assertEquals(5, haystack.forEachByte(factory(algorithm, "c☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "c☺☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "c☺x").newSearchProcessor()));

        assertEquals(5, haystack.forEachByte(factory(algorithm, "☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "☺☺").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "☺x").newSearchProcessor()));

        assertEquals(-1, haystack.forEachByte(factory(algorithm, "z").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "aa").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "ba").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "abcd").newSearchProcessor()));
        assertEquals(-1, haystack.forEachByte(factory(algorithm, "abcde").newSearchProcessor()));

        haystack.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testSearch() do?
testSearch() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/search/SearchProcessorTest.java.
Where is testSearch() defined?
testSearch() is defined in buffer/src/test/java/io/netty/buffer/search/SearchProcessorTest.java at line 52.

Analyze Your Own Codebase

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

Try Supermodel Free