@@ -491,62 +491,8 @@ impl From<ID> for IdSpan {
491491
492492#[ cfg( test) ]
493493mod test_id_span {
494- use rle:: RleVecWithIndex ;
495-
496494 use super :: * ;
497495
498- macro_rules! id_spans {
499- ( $( [ $peer: expr, $from: expr, $to: expr] ) ,* ) => {
500- {
501- let mut id_spans = RleVecWithIndex :: new( ) ;
502- $(
503- id_spans. push( IdSpan {
504- peer: $peer,
505- counter: CounterSpan :: new( $from, $to) ,
506- } ) ;
507- ) *
508- id_spans
509- }
510- } ;
511- }
512-
513- #[ test]
514- fn test_id_span_rle_vec ( ) {
515- let mut id_span_vec = RleVecWithIndex :: new ( ) ;
516- id_span_vec. push ( IdSpan {
517- peer : 0 ,
518- counter : CounterSpan :: new ( 0 , 2 ) ,
519- } ) ;
520- assert_eq ! ( id_span_vec. merged_len( ) , 1 ) ;
521- assert_eq ! ( id_span_vec. atom_len( ) , 2 ) ;
522- id_span_vec. push ( IdSpan {
523- peer : 0 ,
524- counter : CounterSpan :: new ( 2 , 4 ) ,
525- } ) ;
526- assert_eq ! ( id_span_vec. merged_len( ) , 1 ) ;
527- assert_eq ! ( id_span_vec. atom_len( ) , 4 ) ;
528- id_span_vec. push ( IdSpan {
529- peer : 2 ,
530- counter : CounterSpan :: new ( 2 , 4 ) ,
531- } ) ;
532- assert_eq ! ( id_span_vec. merged_len( ) , 2 ) ;
533- assert_eq ! ( id_span_vec. atom_len( ) , 6 ) ;
534- }
535-
536- #[ test]
537- fn slice ( ) {
538- let id_span_vec = id_spans ! ( [ 0 , 0 , 2 ] , [ 0 , 2 , 4 ] , [ 2 , 2 , 4 ] ) ;
539- let slice: Vec < IdSpan > = id_span_vec. slice_iter ( 2 , 5 ) . map ( |x| x. into ( ) ) . collect ( ) ;
540- assert_eq ! ( slice, id_spans!( [ 0 , 2 , 4 ] , [ 2 , 2 , 3 ] ) . to_vec( ) ) ;
541- }
542-
543- #[ test]
544- fn backward ( ) {
545- let id_span_vec = id_spans ! ( [ 0 , 100 , 98 ] , [ 0 , 98 , 90 ] , [ 2 , 2 , 4 ] , [ 2 , 8 , 4 ] ) ;
546- let slice: Vec < IdSpan > = id_span_vec. slice_iter ( 5 , 14 ) . map ( |x| x. into ( ) ) . collect ( ) ;
547- assert_eq ! ( slice, id_spans!( [ 0 , 95 , 90 ] , [ 2 , 2 , 4 ] , [ 2 , 8 , 6 ] ) . to_vec( ) ) ;
548- }
549-
550496 #[ test]
551497 fn merge ( ) {
552498 let mut a = CounterSpan :: new ( 0 , 2 ) ;
0 commit comments