diff options
author | Roberto Tyley <roberto.tyley@gmail.com> | 2014-07-15 01:38:01 +0400 |
---|---|---|
committer | Roberto Tyley <roberto.tyley@gmail.com> | 2014-07-26 11:23:17 +0400 |
commit | 7cb752aaf746dc0b473afeb9e892b7fbc12666c5 (patch) | |
tree | cc4f91ddc18332b5adbe82e3fcb040d976c90105 /core/src/test/java/org/bouncycastle/util/encoders/test/HexTest.java | |
parent | 551830f8ea5177042af2c7dd1fc90888bc67387d (diff) |
Execute become-spongy.sh
https://github.com/rtyley/spongycastle/blob/3040af/become-spongy.sh
Diffstat (limited to 'core/src/test/java/org/bouncycastle/util/encoders/test/HexTest.java')
-rw-r--r-- | core/src/test/java/org/bouncycastle/util/encoders/test/HexTest.java | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/core/src/test/java/org/bouncycastle/util/encoders/test/HexTest.java b/core/src/test/java/org/bouncycastle/util/encoders/test/HexTest.java deleted file mode 100644 index 34af71f0..00000000 --- a/core/src/test/java/org/bouncycastle/util/encoders/test/HexTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.bouncycastle.util.encoders.test; - -import java.io.IOException; - -import org.bouncycastle.util.Strings; -import org.bouncycastle.util.encoders.DecoderException; -import org.bouncycastle.util.encoders.Hex; -import org.bouncycastle.util.encoders.HexEncoder; - -public class HexTest extends AbstractCoderTest -{ - private static final String invalid1 = "%O4T"; - private static final String invalid2 = "FZI4"; - private static final String invalid3 = "ae%E"; - private static final String invalid4 = "fO4%"; - private static final String invalid5 = "beefe"; - private static final String invalid6 = "beefs"; - - public HexTest( - String name) - { - super(name); - } - - protected void setUp() - { - super.setUp(); - enc = new HexEncoder(); - } - - protected char paddingChar() - { - return 0; - } - - protected boolean isEncodedChar(char c) - { - if ('A' <= c && c <= 'F') - { - return true; - } - if ('a' <= c && c <= 'f') - { - return true; - } - if ('0' <= c && c <= '9') - { - return true; - } - return false; - } - - public void testInvalidInput() - throws IOException - { - String[] invalid = new String[] { invalid1, invalid2, invalid3, invalid4, invalid5, invalid6 }; - - for (int i = 0; i != invalid.length; i++) - { - invalidTest(invalid[i]); - invalidTest(Strings.toByteArray(invalid[i])); - } - } - - private void invalidTest(String data) - { - try - { - Hex.decode(data); - } - catch (DecoderException e) - { - return; - } - - fail("invalid String data parsed"); - } - - private void invalidTest(byte[] data) - { - try - { - Hex.decode(data); - } - catch (DecoderException e) - { - return; - } - - fail("invalid byte data parsed"); - } -} |