tests: added check_coverage script

trezor.crypto: update docu
pull/25/head
Pavol Rusnak 8 years ago
parent 955bd44684
commit 998fb9fce6
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -42,7 +42,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Blake2s_make_new(const mp_obj_type_t *type, siz
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Blake2s.update(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.blake2s.update(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -57,7 +57,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Blake2s_update(mp_obj_t self, mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Blake2s_update_obj, mod_TrezorCrypto_Blake2s_update);
/// def trezor.crypto.hashlib.Blake2s.digest(self) -> bytes:
/// def trezor.crypto.hashlib.blake2s.digest(self) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -62,7 +62,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Pbkdf2_make_new(const mp_obj_type_t *type, size
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.pbkdf2.Pbkdf2.update(self, iterations: int) -> None:
/// def trezor.crypto.pbkdf2.update(self, iterations: int) -> None:
/// '''
/// Update a PBKDF2 context
/// '''
@ -79,7 +79,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Pbkdf2_update(mp_obj_t self, mp_obj_t iteration
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Pbkdf2_update_obj, mod_TrezorCrypto_Pbkdf2_update);
/// def trezor.crypto.pbkdf2.Pbkdf2.key(self) -> bytes:
/// def trezor.crypto.pbkdf2.key(self) -> bytes:
/// '''
/// Retreive derived key
/// '''

@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Ripemd160_make_new(const mp_obj_type_t *type, s
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Ripemd160.update(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.ripemd160.update(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Ripemd160_update(mp_obj_t self, mp_obj_t data)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Ripemd160_update_obj, mod_TrezorCrypto_Ripemd160_update);
/// def trezor.crypto.hashlib.Ripemd160.digest(self) -> bytes:
/// def trezor.crypto.hashlib.ripemd160.digest(self) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha1_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Sha1.update(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.sha1.update(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha1_update(mp_obj_t self, mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha1_update_obj, mod_TrezorCrypto_Sha1_update);
/// def trezor.crypto.hashlib.Sha1.digest(self) -> bytes:
/// def trezor.crypto.hashlib.sha1.digest(self) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha256_make_new(const mp_obj_type_t *type, size
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Sha256.update(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.sha256.update(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha256_update(mp_obj_t self, mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha256_update_obj, mod_TrezorCrypto_Sha256_update);
/// def trezor.crypto.hashlib.Sha256.digest(self) -> bytes:
/// def trezor.crypto.hashlib.sha256.digest(self) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_256_make_new(const mp_obj_type_t *type, si
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Sha3_256.update(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.sha3_256.update(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_256_update(mp_obj_t self, mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha3_256_update_obj, mod_TrezorCrypto_Sha3_256_update);
/// def trezor.crypto.hashlib.Sha3_256.digest(self, keccak: bool=False) -> bytes:
/// def trezor.crypto.hashlib.sha3_256.digest(self, keccak: bool=False) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_512_make_new(const mp_obj_type_t *type, si
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Sha3_512.update(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.sha3_512.update(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_512_update(mp_obj_t self, mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha3_512_update_obj, mod_TrezorCrypto_Sha3_512_update);
/// def trezor.crypto.hashlib.Sha3_512.digest(self, keccak: bool=False) -> bytes:
/// def trezor.crypto.hashlib.sha3_512.digest(self, keccak: bool=False) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -34,7 +34,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha512_make_new(const mp_obj_type_t *type, size
return MP_OBJ_FROM_PTR(o);
}
/// def trezor.crypto.hashlib.Sha512.hash(self, data: bytes) -> None:
/// def trezor.crypto.hashlib.sha512.hash(self, data: bytes) -> None:
/// '''
/// Update the hash context with hashed data.
/// '''
@ -49,7 +49,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha512_update(mp_obj_t self, mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha512_update_obj, mod_TrezorCrypto_Sha512_update);
/// def trezor.crypto.hashlib.Sha512.digest(self) -> bytes:
/// def trezor.crypto.hashlib.sha512.digest(self) -> bytes:
/// '''
/// Returns the digest of hashed data.
/// '''

@ -6,7 +6,7 @@ def update(self, data: bytes) -> None:
'''
# ../extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h
def digest(self) -> bytes:
def digest(self, keccak: bool=False) -> bytes:
'''
Returns the digest of hashed data.
'''

@ -6,7 +6,7 @@ def update(self, data: bytes) -> None:
'''
# ../extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h
def digest(self) -> bytes:
def digest(self, keccak: bool=False) -> bytes:
'''
Returns the digest of hashed data.
'''

@ -0,0 +1,26 @@
#!/bin/bash
find ../../mocks -name '*.py' | sort | while read module; do
module=$(echo $module | sed 's:^\.\./\.\./mocks/::')
base=$(basename $module)
# skip __init__.py
if [[ $base == "__init__.py" ]]; then
continue
fi
# skip everything outside of trezor
if [[ $module != trezor* ]]; then
continue
fi
# skip classes (uppercase modules)
if [[ $base == [ABCDEFGHIJKLMNOPQRSTUVWXYZ]* ]]; then
continue
fi
module=$(echo $module | sed -e 's:\.py$::' -e 's:/:.:g')
if [ -r test_$module.py ]; then
echo "OK $module"
else
echo "MISS $module"
missing=$(expr $missing + 1)
fi
done
Loading…
Cancel
Save