Skip to content

Commit

Permalink
rename fn
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Sep 5, 2023
1 parent 174f643 commit 6db1232
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/utils/src/helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl ArrayExtension of ArrayExtensionTrait {

#[generate_trait]
impl SpanExtension of SpanExtensionTrait {
fn clone_pad_end_zeroes(ref self: Span<u8>, n_zeroes: usize) -> Array<u8> {
fn pad_right(ref self: Span<u8>, n_zeroes: usize) -> Span<u8> {
let mut res: Array<u8> = array![];
let mut i = 0;
loop {
Expand All @@ -225,7 +225,7 @@ impl SpanExtension of SpanExtensionTrait {
res.append(0);
i += 1;
};
res
res.span()
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/utils/src/tests/test_helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@ fn test_split_word() {
#[available_gas(2000000000)]
fn test_clone_pad_zeroes() {
let mut original: Span<u8> = array![1, 2, 3, 4].span();
let res = original.clone_pad_end_zeroes(3);
assert(res == array![1, 2, 3, 4, 0, 0, 0], 'padding mismatch');
let res = original.pad_right(3);
assert(res == array![1, 2, 3, 4, 0, 0, 0].span(), 'padding mismatch');
}

0 comments on commit 6db1232

Please sign in to comment.