diff --git a/core/src/test/java/com/google/bitcoin/crypto/hd/BIP32Test.java b/core/src/test/java/com/google/bitcoin/crypto/BIP32Test.java similarity index 99% rename from core/src/test/java/com/google/bitcoin/crypto/hd/BIP32Test.java rename to core/src/test/java/com/google/bitcoin/crypto/BIP32Test.java index 162fac7a..dcca899d 100644 --- a/core/src/test/java/com/google/bitcoin/crypto/hd/BIP32Test.java +++ b/core/src/test/java/com/google/bitcoin/crypto/BIP32Test.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.bitcoin.crypto.hd; +package com.google.bitcoin.crypto; import com.google.bitcoin.core.AddressFormatException; import com.google.bitcoin.core.Base58; diff --git a/core/src/test/java/com/google/bitcoin/crypto/hd/ChildKeyDerivationTest.java b/core/src/test/java/com/google/bitcoin/crypto/ChildKeyDerivationTest.java similarity index 97% rename from core/src/test/java/com/google/bitcoin/crypto/hd/ChildKeyDerivationTest.java rename to core/src/test/java/com/google/bitcoin/crypto/ChildKeyDerivationTest.java index 825e3acc..5cd7de65 100644 --- a/core/src/test/java/com/google/bitcoin/crypto/hd/ChildKeyDerivationTest.java +++ b/core/src/test/java/com/google/bitcoin/crypto/ChildKeyDerivationTest.java @@ -14,11 +14,8 @@ * limitations under the License. */ -package com.google.bitcoin.crypto.hd; +package com.google.bitcoin.crypto; -import com.google.bitcoin.crypto.DeterministicKey; -import com.google.bitcoin.crypto.HDKeyDerivation; -import com.google.bitcoin.crypto.HDUtils; import org.junit.Test; import org.spongycastle.util.encoders.Hex; diff --git a/core/src/test/java/com/google/bitcoin/crypto/hd/HDUtilsTest.java b/core/src/test/java/com/google/bitcoin/crypto/HDUtilsTest.java similarity index 99% rename from core/src/test/java/com/google/bitcoin/crypto/hd/HDUtilsTest.java rename to core/src/test/java/com/google/bitcoin/crypto/HDUtilsTest.java index d5bd8823..09c73954 100644 --- a/core/src/test/java/com/google/bitcoin/crypto/hd/HDUtilsTest.java +++ b/core/src/test/java/com/google/bitcoin/crypto/HDUtilsTest.java @@ -1,4 +1,4 @@ -package com.google.bitcoin.crypto.hd; +package com.google.bitcoin.crypto; import com.google.bitcoin.crypto.HDUtils; import org.junit.Assert; diff --git a/core/src/test/java/com/google/bitcoin/crypto/hd/DeterministicHierarchyTest.java b/core/src/test/java/com/google/bitcoin/crypto/hd/DeterministicHierarchyTest.java deleted file mode 100644 index 4ddafe90..00000000 --- a/core/src/test/java/com/google/bitcoin/crypto/hd/DeterministicHierarchyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright 2013 Matija Mazi. - * - * Licensed 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 - * - * http://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 com.google.bitcoin.crypto.hd; - -import com.google.bitcoin.crypto.DeterministicKey; -import com.google.bitcoin.crypto.HDKeyDerivation; -import com.google.bitcoin.crypto.hd.wallet.DeterministicKeyGenerator; -import org.junit.Test; - -import java.security.SecureRandom; - -import static org.junit.Assert.assertEquals; - -public class DeterministicHierarchyTest { - - /** - * Test creating a sequence of derived keys using the internal and external chain. - */ - @Test - public void testHierarchy() throws Exception { - DeterministicKey m = HDKeyDerivation.createMasterPrivateKey(new SecureRandom().generateSeed(32)); - - for (int iWallet = 0; iWallet < 3; iWallet++) { - DeterministicKey walletRootKey = HDKeyDerivation.deriveChildKey(m, iWallet); - DeterministicKeyGenerator hdWalletKeyGen = new DeterministicKeyGenerator(walletRootKey); - assertEquals(walletRootKey.getChildNumber().getChildNumber(), iWallet); - - assertEquals(0L, hdWalletKeyGen.nextInternal().getChildNumber().getChildNumber()); - assertEquals(1L, hdWalletKeyGen.nextInternal().getChildNumber().getChildNumber()); - assertEquals(2L, hdWalletKeyGen.nextInternal().getChildNumber().getChildNumber()); - - assertEquals(0L, hdWalletKeyGen.nextExternal().getChildNumber().getChildNumber()); - assertEquals(1L, hdWalletKeyGen.nextExternal().getChildNumber().getChildNumber()); - assertEquals(2L, hdWalletKeyGen.nextExternal().getChildNumber().getChildNumber()); - - assertEquals(3L, hdWalletKeyGen.nextInternal().getChildNumber().getChildNumber()); - - assertEquals(3L, hdWalletKeyGen.nextExternal().getChildNumber().getChildNumber()); - } - } -}