nostrdb/bech32: add some initial tests

since we modified this recently, let's add some tests to make sure
we didn't break anything

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2023-12-27 14:54:43 -08:00
committed by Daniel D’Aquino
parent 1b09e9458c
commit c3b06d281e
2 changed files with 42 additions and 22 deletions

View File

@@ -73,16 +73,20 @@ struct nostr_bech32 {
struct bech32_nprofile nprofile;
struct bech32_naddr naddr;
struct bech32_nrelay nrelay;
} data;
};
};
int parse_nostr_bech32_str(struct cursor *bech32);
int parse_nostr_bech32_str(struct cursor *bech32, enum nostr_bech32_type *type);
int parse_nostr_bech32_type(const char *prefix, enum nostr_bech32_type *type);
int parse_nostr_bech32_buffer(struct cursor *cur, enum nostr_bech32_type type,
struct nostr_bech32 *obj);
int parse_nostr_bech32(unsigned char *buf, int buflen,
const char *bech32_str, size_t bech32_len,
struct nostr_bech32 *obj);
/*
int parse_nostr_bech32(const char *bech32, size_t input_len,
unsigned char *outbuf, size_t outlen,