Updated on 2026-08-14

This commit is contained in:
Tangem 2020-04-15 14:38:55 +03:00
parent 230ef64f37
commit 9580b97747
11 changed files with 127 additions and 117 deletions

View file

@ -82,8 +82,8 @@ class TlvDecoderTest {
@Test
fun `map SigningMethods single value returns correct value`() {
val signingMethods: SigningMethod = tlvMapper.decode(TlvTag.SigningMethod)
assertThat(signingMethods.contains(SigningMethod.signHash))
val signingMethods: SigningMethodMask = tlvMapper.decode(TlvTag.SigningMethod)
assertThat(signingMethods.contains(SigningMethod.SIGN_HASH))
.isTrue()
}
@ -91,20 +91,20 @@ class TlvDecoderTest {
fun `map SigningMethods set of methods returns correct value`() {
val localMapper = TlvDecoder(Tlv.deserialize("070195".hexToBytes())!!)
val signingMethod: SigningMethod = localMapper.decode(TlvTag.SigningMethod)
assertThat(signingMethod.contains(SigningMethod.signHash))
val signingMethods: SigningMethodMask = localMapper.decode(TlvTag.SigningMethod)
assertThat(signingMethods.contains(SigningMethod.SIGN_HASH))
.isTrue()
assertThat(signingMethod.contains(SigningMethod.signHashValidatedByIssuer))
assertThat(signingMethods.contains(SigningMethod.SIGN_HASH_VALIDATE_BY_ISSUER))
.isTrue()
assertThat(signingMethod.contains(SigningMethod.signHashValidatedByIssuerAndWriteIssuerData))
assertThat(signingMethods.contains(SigningMethod.SIGN_HASH_VALIDATE_BY_ISSUER_WRITE_ISSUER_DATA))
.isTrue()
assertThat(signingMethod.contains(SigningMethod.signRaw))
assertThat(signingMethods.contains(SigningMethod.SIGN_RAW))
.isFalse()
assertThat(signingMethod.contains(SigningMethod.signRawValidatedByIssuer))
assertThat(signingMethods.contains(SigningMethod.SIGN_RAW_VALIDATE_BY_ISSUER))
.isFalse()
assertThat(signingMethod.contains(SigningMethod.signRawValidatedByIssuerAndWriteIssuerData))
assertThat(signingMethods.contains(SigningMethod.SIGN_RAW_VALIDATE_BY_ISSUER_WRITE_ISSUER_DATA))
.isFalse()
assertThat(signingMethod.contains(SigningMethod.signPos))
assertThat(signingMethods.contains(SigningMethod.SIGN_POS))
.isFalse()
}
@ -119,7 +119,7 @@ class TlvDecoderTest {
fun `map ProductMask with raw value 5 returns correct value`() {
val localMapper = TlvDecoder(listOf(Tlv(TlvTag.ProductMask, byteArrayOf(5))))
val productMask: ProductMask = localMapper.decode(TlvTag.ProductMask)
assertThat(productMask.contains(ProductMask.note) && productMask.contains(ProductMask.idCard))
assertThat(productMask.contains(Product.NOTE) && productMask.contains(Product.ID_CARD))
.isTrue()
}
@ -127,7 +127,7 @@ class TlvDecoderTest {
fun `map ProductMask with raw value 1 returns correct value`() {
val localMapper = TlvDecoder(listOf(Tlv(TlvTag.ProductMask, byteArrayOf(1))))
val productMask: ProductMask = localMapper.decode(TlvTag.ProductMask)
assertThat(productMask.contains(ProductMask.note))
assertThat(productMask.contains(Product.NOTE))
.isTrue()
}