This repository was archived by the owner on Aug 27, 2025. It is now read-only.
chore: Add test values for other known v2 krist addresses#22
Open
Riley-3 wants to merge 2 commits intoReconnectedCC:mainfrom
Open
chore: Add test values for other known v2 krist addresses#22Riley-3 wants to merge 2 commits intoReconnectedCC:mainfrom
Riley-3 wants to merge 2 commits intoReconnectedCC:mainfrom
Conversation
These were all pulled from Krist's implementation of /v2
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. |
Contributor
|
Perhaps we could do fine with 50 of them? |
Collaborator
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 |
Author
|
@bananasov is this amount satisfactory? |
Collaborator
|
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);
} |
Collaborator
Yup 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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