-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: main
Are you sure you want to change the base?
Conversation
These were all pulled from Krist's implementation of /v2
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. |
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 |
@bananasov is this amount satisfactory? |
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);
} |
Yup 👍 |
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