Skip to content

chore: Add test values for other known v2 krist addresses #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Riley-3
Copy link

@Riley-3 Riley-3 commented Feb 2, 2025

These were all pulled from Krist's implementation of /v2
This probably needs to be an array but if someone would like to do that go for it, just throwing this in before I go to bed

These were all pulled from Krist's implementation of /v2
@Riley-3 Riley-3 changed the title Add test values for other known addresses Add test values for other known v2 krist addresses Feb 2, 2025
@bananasov
Copy link
Collaborator

Wow, that is a lot of asserts, maybe a bit too much? I don't think we need to test 500 different cases to ensure we have the same output as Krist.

@dimaguy
Copy link
Contributor

dimaguy commented Feb 2, 2025

Perhaps we could do fine with 50 of them?

@bananasov
Copy link
Collaborator

Perhaps we could do fine with 50 of them?

I'm feeling more like 10 is enough, we don't need to test that often. If the first one fails then the rest would too

@Riley-3 Riley-3 changed the title Add test values for other known v2 krist addresses chore: Add test values for other known v2 krist addresses Feb 14, 2025
@Riley-3
Copy link
Author

Riley-3 commented Feb 14, 2025

@bananasov is this amount satisfactory?

@ElonGaties
Copy link
Collaborator

ElonGaties commented Feb 14, 2025

I think this is a fine amount, threw this together, tell me what you think of it, I'll also await response from others

macro_rules! test_make_v2_address {
    ($second_arg:expr, $($first_arg:expr => $expected:expr),*) => {
        $(
            assert_eq!(make_v2_address($first_arg, $second_arg), $expected);
        )*
    };
}

fn main() {
    test_make_v2_address!(
        "k",
        "test123" => "krcgbmalxg",
        "0" => "kzbdy8rmok",
        "1" => "k4om3ewezk",
        "2" => "kd18lv0b6u",
        "3" => "krdfu99fep",
        "4" => "k8kl0fyol5",
        "5" => "kl996ygs97",
        "6" => "k926k4tgmh",
        "7" => "k6o8rgjqi2",
        "8" => "knvvk3kahp",
        "9" => "kv2k3ja3o9"
    );
}
macro_rules! test_make_v2_address {
    ($second_arg:expr, $test_cases:expr) => {
        for &(first_arg, expected) in $test_cases.iter() {
            assert_eq!(make_v2_address(first_arg, $second_arg), expected);
        }
    };
}

fn main() {
    let test_cases = [
        ("test123", "krcgbmalxg"),
        ("0", "kzbdy8rmok"),
        ("1", "k4om3ewezk"),
        ("2", "kd18lv0b6u"),
        ("3", "krdfu99fep"),
        ("4", "k8kl0fyol5"),
        ("5", "kl996ygs97"),
        ("6", "k926k4tgmh"),
        ("7", "k6o8rgjqi2"),
        ("8", "knvvk3kahp"),
        ("9", "kv2k3ja3o9")
    ];

    test_make_v2_address!("k", &test_cases);
}

@bananasov
Copy link
Collaborator

@bananasov is this amount satisfactory?

Yup 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants