Skip to content

Commit 0ecba37

Browse files
Gilad Chasegiladchase
authored andcommitted
refactor(test): remove compare_spans util
It was pre-PartialEq legacy code
1 parent 1b44322 commit 0ecba37

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

corelib/src/test/byte_array_test.cairo

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,12 @@ fn test_serde() {
442442
let mut serialized = array![];
443443
let ba: ByteArray = "";
444444
ba.serialize(ref serialized);
445-
compare_spans(serialized.span(), [0, 0, 0].span());
445+
assert_eq!(serialized.span(), [0, 0, 0].span());
446446

447447
let mut serialized = array![];
448448
let ba: ByteArray = "hello";
449449
ba.serialize(ref serialized);
450-
compare_spans(
450+
assert_eq!(
451451
serialized.span(),
452452
[0, // data len
453453
0x68656c6c6f, // pending_word
@@ -458,7 +458,7 @@ fn test_serde() {
458458
let mut serialized = array![];
459459
let ba: ByteArray = "Long string, more than 31 characters.";
460460
ba.serialize(ref serialized);
461-
compare_spans(
461+
assert_eq!(
462462
serialized.span(),
463463
[
464464
1, // data len
@@ -495,23 +495,6 @@ fn test_from_collect() {
495495

496496
// ========= Test helper functions =========
497497

498-
fn compare_spans<T, +crate::fmt::Debug<T>, +PartialEq<T>, +Copy<T>, +Drop<T>>(
499-
mut a: Span<T>, mut b: Span<T>,
500-
) {
501-
assert_eq!(a.len(), b.len());
502-
let mut index = 0;
503-
loop {
504-
match a.pop_front() {
505-
Some(current_a) => {
506-
let current_b = b.pop_front().unwrap();
507-
assert_eq!(*current_a, *current_b, "wrong data for index: {index}");
508-
},
509-
None(_) => { break; },
510-
}
511-
index += 1;
512-
}
513-
}
514-
515498
fn test_byte_array_1() -> ByteArray {
516499
let mut ba1 = Default::default();
517500
ba1.append_word(0x01, 1);

0 commit comments

Comments
 (0)