-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace parse_hex with boost::unhex (#944)
* replace parse_hex with boost::unhex * Add android test
- Loading branch information
1 parent
cb6e57f
commit b76214d
Showing
7 changed files
with
60 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...src/androidTest/java/com/trustwallet/core/app/blockchains/ethereum/TestEthereumAddress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.trustwallet.core.app.blockchains.ethereum | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import wallet.core.jni.AnyAddress | ||
import wallet.core.jni.CoinType | ||
import org.junit.Assert.assertFalse | ||
|
||
class TestEthereumAddress { | ||
|
||
init { | ||
System.loadLibrary("TrustWalletCore") | ||
} | ||
|
||
@Test | ||
fun testEthereumAddresses() { | ||
val any = AnyAddress("0x7d8bf18c7ce84b3e175b339c4ca93aed1dd166f1", CoinType.ETHEREUM) | ||
assertEquals(any.coin(), CoinType.ETHEREUM) | ||
assertEquals(any.description(), "0x7d8bf18C7cE84b3E175b339c4Ca93aEd1dD166F1") | ||
|
||
assertFalse(AnyAddress.isValid("0xMQqpqMQgCBuiPkoXfgZZsJvuzCeI1zc00z6vHJj4", CoinType.ETHEREUM)) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright © 2017-2020 Trust Wallet. | ||
// | ||
// This file is part of Trust. The full Trust copyright notice, including | ||
// terms governing use, modification, and redistribution, is contained in the | ||
// file LICENSE at the root of the source code distribution tree. | ||
|
||
#include "HexCoding.h" | ||
#include "Data.h" | ||
#include <gtest/gtest.h> | ||
|
||
namespace TW { | ||
|
||
TEST(HexCoding, validation) { | ||
const std::string valid = "0x7d8bf18c7ce84b3e175b339c4ca93aed1dd166f1"; | ||
const std::string invalid = "0xMQqpqMQgCBuiPkoXfgZZsJvuzCeI1zc00z6vHJj4"; | ||
const auto bytes = parse_hex(invalid); | ||
const auto bytes2 = parse_hex(valid); | ||
|
||
ASSERT_TRUE(bytes.empty()); | ||
ASSERT_EQ("0x" + hex(bytes2), valid); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters