Test from XTO merge failed. Commented out XTO test and swithc case

This commit is contained in:
Manfred Karrer 2017-01-17 12:25:56 +01:00
parent e06932895e
commit 1bd73afa55
3 changed files with 18 additions and 81 deletions

View File

@ -93,7 +93,9 @@ public final class AltCoinAddressValidator extends InputValidator {
return validationResult;
else
return new ValidationResult(false, "ZEC address need to start with t. Addresses starting with z are not supported.");
case "XTO":
// TODO test not successful
/*case "XTO":
if (input.matches("^[T2][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
if (verifyChecksum(input))
try {
@ -106,7 +108,7 @@ public final class AltCoinAddressValidator extends InputValidator {
return wrongChecksum;
} else {
return regexTestFailed;
}
}*/
case "GBYTE":
return ByteballAddressValidator.validate(input);
default:

View File

@ -1,79 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.util.validation;
import org.junit.Test;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertTrue;
public class AltCoinAddressValidatorTest {
@Test
public void testBTC() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("BTC");
assertTrue(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
assertTrue(validator.validate("3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX").isValid);
assertTrue(validator.validate("1111111111111111111114oLvT2").isValid);
assertTrue(validator.validate("1BitcoinEaterAddressDontSendf59kuE").isValid);
assertFalse(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq").isValid);
assertFalse(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO").isValid);
assertFalse(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#").isValid);
}
@Test
public void testXTO() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("XTO");
assertTrue(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaRT").isValid);
assertTrue(validator.validate("2USHRW8UcSAAnHxWnPe4yX2BV5K3dbWss9").isValid);
assertFalse(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaRTT").isValid);
assertFalse(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaTo").isValid);
assertFalse(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaRt#").isValid);
}
@Test
public void testIOP() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("IOP");
assertTrue(validator.validate("pKbz7iRUSiUaTgh4UuwQCnc6pWZnyCGWxM").isValid);
assertTrue(validator.validate("pAubDQFjUMaR93V4RjHYFh1YW1dzJ9YPW1").isValid);
assertFalse(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
}
@Test
public void testGBYTE() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("GBYTE");
assertTrue(validator.validate("BN7JXKXWEG4BVJ7NW6Q3Z7SMJNZJYM3G").isValid);
assertTrue(validator.validate("XGKZODTTTRXIUA75TKONWHFDCU6634DE").isValid);
assertFalse(validator.validate("XGKZODTGTRXIUA75TKONWHFDCU6634DE").isValid);
assertFalse(validator.validate("XGKZODTTTRXIUA75TKONWHFDCU6634D").isValid);
assertFalse(validator.validate("XGKZODTTTRXIUA75TKONWHFDCU6634DZ").isValid);
}
}

View File

@ -39,6 +39,20 @@ public class AltCoinAddressValidatorTest {
assertFalse(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#").isValid);
}
// TODO test not successful
/* @Test
public void testXTO() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("XTO");
assertTrue(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaRT").isValid);
assertTrue(validator.validate("2USHRW8UcSAAnHxWnPe4yX2BV5K3dbWss9").isValid);
assertFalse(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaRTT").isValid);
assertFalse(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaTo").isValid);
assertFalse(validator.validate("TddV2k4mbm6tkUYbv3zoEoiB3kDUFBdaRt#").isValid);
}*/
@Test
public void testIOP() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();