Skip to content

Tests for convertRadix and convertRadix2 #25

@mahnunchik

Description

@mahnunchik

I've used convertRadix function on the cashaddr implementation #24 and it converts 5-bit number correctly according to the checksum tests.

But I've faced with that simple test gives incorrect result:

const data = [1];

console.log(convertRadix2(data, 8, 5, true));
// [ 0, 4 ] - correct
console.log(convertRadix(data, 2 ** 8, 2 ** 5));
// [ 1 ] - incorrect

I thought that I could understand the behavior from tests, but there are no tests for these methods.

Is this my mistake in use or is the method not implemented correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions