Implement hash derivation for tuple

This commit is contained in:
Ayaz Hafiz 2023-03-22 10:28:13 -05:00
parent 66fb2f476e
commit 8f7b6aaeaa
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 90 additions and 3 deletions

View file

@ -209,6 +209,23 @@ fn two_field_record() {
})
}
#[test]
fn two_element_tuple() {
derive_test(Hash, v!((v!(U8), v!(STR),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( U8, Str )*
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# Specialization lambda sets:
# @<1>: [[hash_(arity:2)(0)]]
#Derived.hash_(arity:2) =
\#Derived.hasher, #Derived.tup ->
hash (hash #Derived.hasher #Derived.tup.0) #Derived.tup.1
"###
)
})
}
#[test]
fn tag_one_label_no_payloads() {
derive_test(Hash, v!([A]), |golden| {