diff options
author | Jon Bratseth <bratseth@oath.com> | 2021-09-28 21:51:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-28 21:51:45 +0200 |
commit | 12a415efca5749433fd22424592ddc18f04160f6 (patch) | |
tree | 9324cb3aa2aabfa4fb8f0dc5fc0f7639869db7b1 /container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java | |
parent | b57543dc1a1e3d32bcd03afb7af972490d691bf1 (diff) | |
parent | e7e659e9d26401c8c36300d4760d4e34acd26d0a (diff) |
Merge pull request #19337 from vespa-engine/bratseth/encoder-to-embedderv7.474.25
encode -> embed
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java new file mode 100644 index 00000000000..18a9f11e15e --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java @@ -0,0 +1,35 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.search.grouping.vespa; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * @author Simon Thoresen Hult + */ +public class IntegerEmbedderTestCase { + + @Test + public void requireThatIntEncoderWorksAsExpected() { + assertEncode("A", 0); + assertEncode("BC", 1); + assertEncode("CBI", 12); + assertEncode("CPG", 123); + assertEncode("DJKE", 1234); + assertEncode("EGAHC", 12345); + assertEncode("FDMEIA", 123456); + assertEncode("GCFKNAO", 1234567); + assertEncode("HBHIMCJM", 12345678); + assertEncode("HOLHJKCK", 123456789); + assertEncode("IJDCMAFKE", 1234567890); + assertEncode("IIKKEBPOF", -1163005939); + assertEncode("IECKEIKID", -559039810); + } + + private static void assertEncode(String expected, int toEncode) { + IntegerEncoder actual = new IntegerEncoder(); + actual.append(toEncode); + assertEquals(expected, actual.toString()); + } +} |