1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

fix cashaddr test

This commit is contained in:
Pavol Rusnak 2018-04-05 11:52:49 +02:00
parent e65adcf5ca
commit e81fb38ab4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 5 additions and 4 deletions

View File

@ -63,7 +63,7 @@ all: test_check test_openssl test_speed aes/aestst tools libtrezor-crypto.so
%.o: %.c %.h options.h %.o: %.c %.h options.h
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<
test_check.o: test_segwit.c test_cashaddr.c test_check.o: test_check_segwit.h test_check_cashaddr.h
aes/aestst: aes/aestst.o aes/aescrypt.o aes/aeskey.o aes/aestab.o aes/aestst: aes/aestst.o aes/aescrypt.o aes/aeskey.o aes/aestab.o
$(CC) $^ -o $@ $(CC) $^ -o $@

View File

@ -4403,8 +4403,9 @@ START_TEST(test_rc4_rfc6229)
} }
END_TEST END_TEST
#include "test_segwit.c" #include "test_check_segwit.h"
#include "test_cashaddr.c"
#include "test_check_cashaddr.h"
// define test suite and cases // define test suite and cases
Suite *test_suite(void) Suite *test_suite(void)

View File

@ -71,7 +71,7 @@ START_TEST(test_cashaddr)
int ret = cash_addr_decode(prog, &prog_len, hrp, valid_cashaddr[i].cashaddress); int ret = cash_addr_decode(prog, &prog_len, hrp, valid_cashaddr[i].cashaddress);
ck_assert_int_eq(ret, 1); ck_assert_int_eq(ret, 1);
ck_assert_int_eq(prog_len, 21); ck_assert_int_eq(prog_len, 21);
rawdata_len = base58_decode_check(valid_cashaddr[i].legacy, HASHER_SHA2, rawdata, sizeof(rawdata)); rawdata_len = base58_decode_check(valid_cashaddr[i].legacy, HASHER_SHA2D, rawdata, sizeof(rawdata));
ck_assert_int_eq(rawdata_len, 21); ck_assert_int_eq(rawdata_len, 21);
ck_assert_int_eq(prog[0], rawdata[0] == 0 ? 0x00 : rawdata[0] == 5 ? 0x08 : -1); ck_assert_int_eq(prog[0], rawdata[0] == 0 ? 0x00 : rawdata[0] == 5 ? 0x08 : -1);
ck_assert_int_eq(memcmp(rawdata + 1, prog + 1, 20), 0); ck_assert_int_eq(memcmp(rawdata + 1, prog + 1, 20), 0);