This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from micbakos-rdx/kotlin-tests
- Loading branch information
Showing
25 changed files
with
535 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,7 @@ | |
/Cargo.lock | ||
tarpaulin-report.html | ||
.vscode | ||
.idea | ||
build_rs_cov.profraw | ||
cobertura.xml | ||
cobertura.xml | ||
jna-*.jar |
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
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
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
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,25 @@ | ||
import radix.wallet.kit.* | ||
|
||
fun testAddress() { | ||
val bech32 = "account_rdx129qdd2yp9vs8jkkn2uwn6sw0ejwmcwr3r4c3usr2hp0nau67m2kzdm" | ||
val key = newEd25519PublicKeyFromHex( | ||
hex = "3e9b96a2a863f1be4658ea66aa0584d2a8847d4c0f658b20e62e3594d994d73d" | ||
) | ||
|
||
val address0 = newAccountAddressFrom( | ||
publicKey = PublicKey.Ed25519(value = key), | ||
networkId = NetworkId.MAINNET | ||
) | ||
assert(address0.address == bech32) | ||
|
||
val address1 = newAccountAddress(bech32 = bech32) | ||
assert(address1.address == bech32) | ||
assert(accountAddressToShort(address = address1) == "acco...m2kzdm") | ||
assert(address1.networkId == NetworkId.MAINNET) | ||
} | ||
|
||
fun test() { | ||
testAddress() | ||
} | ||
|
||
test() |
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,32 @@ | ||
import radix.wallet.kit.* | ||
|
||
val AppPreferences.Companion.placeholder | ||
get() = newAppPreferencesPlaceholder() | ||
|
||
val AppPreferences.Companion.placeholderOther | ||
get() = newAppPreferencesPlaceholderOther() | ||
|
||
fun test_equals() { | ||
val a = AppPreferences.placeholder | ||
val b = AppPreferences.placeholderOther | ||
|
||
// TODO will change these when HexCoded32Bytes is represented with a list of bytes | ||
//assert(a == AppPreferences.placeholder) | ||
assert(a != b) | ||
//assert(b == AppPreferences.placeholderOther) | ||
} | ||
|
||
fun test_hashCode() { | ||
val a = AppPreferences.placeholder | ||
val b = AppPreferences.placeholderOther | ||
assert(setOf(a, a).size == 1) | ||
assert(setOf(b, b).size == 1) | ||
assert(setOf(a, b, b, a).size == 2) | ||
} | ||
|
||
fun test() { | ||
test_equals() | ||
test_hashCode() | ||
} | ||
|
||
test() |
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,32 @@ | ||
import radix.wallet.kit.* | ||
|
||
val placeholder: List<FactorSource> | ||
get() = newFactorSourcesPlaceholder() | ||
|
||
val placeholderOther: List<FactorSource> | ||
get() = newFactorSourcesPlaceholderOther() | ||
|
||
fun test_equals() { | ||
val a = placeholder | ||
val b = placeholderOther | ||
|
||
// TODO will change these when HexCoded32Bytes is represented with a list of bytes | ||
//assert(a == placeholder) | ||
assert(a != b) | ||
//assert(b == placeholderOther) | ||
} | ||
|
||
fun test_hashCode() { | ||
val a = placeholder | ||
val b = placeholderOther | ||
assert(setOf(a, a).size == 1) | ||
assert(setOf(b, b).size == 1) | ||
assert(setOf(a, b, b, a).size == 2) | ||
} | ||
|
||
fun test() { | ||
test_equals() | ||
test_hashCode() | ||
} | ||
|
||
test() |
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,39 @@ | ||
import radix.wallet.kit.* | ||
|
||
val Gateways.Companion.placeholder | ||
get() = newGatewaysPlaceholder() | ||
|
||
val Gateways.Companion.placeholderOther | ||
get() = newGatewaysPlaceholderOther() | ||
|
||
fun test_equals() { | ||
val a = Gateways.placeholder | ||
val b = Gateways.placeholderOther | ||
|
||
assert(a == Gateways.placeholder) | ||
assert(a != b) | ||
assert(b == Gateways.placeholderOther) | ||
} | ||
|
||
fun test_hashCode() { | ||
val a = Gateways.placeholder | ||
val b = Gateways.placeholderOther | ||
assert(setOf(a, a).size == 1) | ||
assert(setOf(b, b).size == 1) | ||
assert(setOf(a, b, b, a).size == 2) | ||
} | ||
|
||
fun test_new() { | ||
val mainnet = gatewayMainnet() | ||
assert(mainnet == gatewayMainnet()) | ||
val gateways = newGateways(current = mainnet) | ||
assert(gateways.current.network.id == NetworkId.MAINNET) | ||
} | ||
|
||
fun test() { | ||
test_equals() | ||
test_hashCode() | ||
test_new() | ||
} | ||
|
||
test() |
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,32 @@ | ||
import radix.wallet.kit.* | ||
|
||
val Header.Companion.placeholder | ||
get() = newHeaderPlaceholder() | ||
|
||
val Header.Companion.placeholderOther | ||
get() = newHeaderPlaceholderOther() | ||
|
||
fun test_equals() { | ||
val a = Header.placeholder | ||
val b = Header.placeholderOther | ||
|
||
assert(a == Header.placeholder) | ||
assert(a != b) | ||
assert(b == Header.placeholderOther) | ||
} | ||
|
||
fun test_hashCode() { | ||
val a = Header.placeholder | ||
val b = Header.placeholderOther | ||
|
||
assert(setOf(a, a).size == 1) | ||
assert(setOf(b, b).size == 1) | ||
assert(setOf(a, b, b, a).size == 2) | ||
} | ||
|
||
fun test() { | ||
test_equals() | ||
test_hashCode() | ||
} | ||
|
||
test() |
Oops, something went wrong.