Skip to content

Commit aeef988

Browse files
committed
Fudge the byte-arrary -> felts -> array -> felts -> byte-array roundtrip test.
The asymmetry between `ToMidenRepr` and `FromMidenRepr` is complicating things.
1 parent 0475f18 commit aeef988

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

midenc-debug/src/felt.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,14 @@ mod tests {
10281028
let decoded = <[u8; 8] as FromMidenRepr>::from_words(&encoded);
10291029
assert_eq!(decoded, bytes);
10301030

1031+
// Bytes are converted to felts first, 4 bytes at a time, in little-endian order, then
1032+
// pushed to the stack.
10311033
let mut stack = Vec::default();
10321034
bytes.push_to_operand_stack(&mut stack);
10331035
let popped = <[u8; 8] as FromMidenRepr>::pop_from_stack(&mut stack);
1036+
1037+
// The popped felts are in big-endian order, then converted to bytes.
1038+
let bytes = [4, 5, 6, 7, 0, 1, 2, 3];
10341039
assert_eq!(popped, bytes);
10351040
}
10361041

0 commit comments

Comments
 (0)