@@ -488,15 +488,13 @@ impl<T: Copy> DList<T> {
488
488
489
489
#[ cfg( test) ]
490
490
mod tests {
491
- #[ legacy_exports] ;
492
-
493
491
use dlist:: { DList , concat, from_vec, new_dlist_node} ;
494
492
use iter;
495
493
use option:: { None , Some } ;
496
494
use vec;
497
495
498
496
#[ test]
499
- fn test_dlist_concat( ) {
497
+ pub fn test_dlist_concat( ) {
500
498
let a = from_vec( ~[ 1 , 2 ] ) ;
501
499
let b = from_vec( ~[ 3 , 4 ] ) ;
502
500
let c = from_vec( ~[ 5 , 6 ] ) ;
@@ -516,7 +514,7 @@ mod tests {
516
514
abcd. assert_consistent( ) ; assert abcd. is_empty( ) ;
517
515
}
518
516
#[ test]
519
- fn test_dlist_append( ) {
517
+ pub fn test_dlist_append( ) {
520
518
let a = from_vec( ~[ 1 , 2 , 3 ] ) ;
521
519
let b = from_vec( ~[ 4 , 5 , 6 ] ) ;
522
520
a. append( b) ;
@@ -532,7 +530,7 @@ mod tests {
532
530
a. assert_consistent( ) ; assert a. is_empty( ) ;
533
531
}
534
532
#[ test]
535
- fn test_dlist_append_empty( ) {
533
+ pub fn test_dlist_append_empty( ) {
536
534
let a = from_vec( ~[ 1 , 2 , 3 ] ) ;
537
535
let b = DList :: <int>( ) ;
538
536
a. append( b) ;
@@ -545,7 +543,7 @@ mod tests {
545
543
a. assert_consistent( ) ; assert a. is_empty( ) ;
546
544
}
547
545
#[ test]
548
- fn test_dlist_append_to_empty( ) {
546
+ pub fn test_dlist_append_to_empty( ) {
549
547
let a = DList :: <int>( ) ;
550
548
let b = from_vec( ~[ 4 , 5 , 6 ] ) ;
551
549
a. append( b) ;
@@ -558,7 +556,7 @@ mod tests {
558
556
a. assert_consistent( ) ; assert a. is_empty( ) ;
559
557
}
560
558
#[ test]
561
- fn test_dlist_append_two_empty( ) {
559
+ pub fn test_dlist_append_two_empty( ) {
562
560
let a = DList :: <int>( ) ;
563
561
let b = DList :: <int>( ) ;
564
562
a. append( b) ;
@@ -570,19 +568,19 @@ mod tests {
570
568
#[ test]
571
569
#[ ignore( cfg( windows) ) ]
572
570
#[ should_fail]
573
- fn test_dlist_append_self( ) {
571
+ pub fn test_dlist_append_self( ) {
574
572
let a = DList :: <int>( ) ;
575
573
a. append( a) ;
576
574
}
577
575
#[ test]
578
576
#[ ignore( cfg( windows) ) ]
579
577
#[ should_fail]
580
- fn test_dlist_prepend_self( ) {
578
+ pub fn test_dlist_prepend_self( ) {
581
579
let a = DList :: <int>( ) ;
582
580
a. prepend( a) ;
583
581
}
584
582
#[ test]
585
- fn test_dlist_prepend( ) {
583
+ pub fn test_dlist_prepend( ) {
586
584
let a = from_vec( ~[ 1 , 2 , 3 ] ) ;
587
585
let b = from_vec( ~[ 4 , 5 , 6 ] ) ;
588
586
b. prepend( a) ;
@@ -598,7 +596,7 @@ mod tests {
598
596
b. assert_consistent( ) ; assert b. is_empty( ) ;
599
597
}
600
598
#[ test]
601
- fn test_dlist_reverse( ) {
599
+ pub fn test_dlist_reverse( ) {
602
600
let a = from_vec( ~[ 5 , 4 , 3 , 2 , 1 ] ) ;
603
601
a. reverse( ) ;
604
602
assert a. len( ) == 5 ;
@@ -610,14 +608,14 @@ mod tests {
610
608
a. assert_consistent( ) ; assert a. is_empty( ) ;
611
609
}
612
610
#[ test]
613
- fn test_dlist_reverse_empty( ) {
611
+ pub fn test_dlist_reverse_empty( ) {
614
612
let a = DList :: <int>( ) ;
615
613
a. reverse( ) ;
616
614
assert a. len( ) == 0 ;
617
615
a. assert_consistent( ) ;
618
616
}
619
617
#[ test]
620
- fn test_dlist_each_node( ) {
618
+ pub fn test_dlist_each_node( ) {
621
619
let a = from_vec( ~[ 1 , 2 , 4 , 5 ] ) ;
622
620
for a. each_node |nobe| {
623
621
if nobe. data > 3 {
@@ -634,28 +632,28 @@ mod tests {
634
632
a. assert_consistent( ) ; assert a. is_empty( ) ;
635
633
}
636
634
#[ test]
637
- fn test_dlist_clear( ) {
635
+ pub fn test_dlist_clear( ) {
638
636
let a = from_vec( ~[ 5 , 4 , 3 , 2 , 1 ] ) ;
639
637
a. clear( ) ;
640
638
assert a. len( ) == 0 ;
641
639
a. assert_consistent( ) ;
642
640
}
643
641
#[ test]
644
- fn test_dlist_is_empty( ) {
642
+ pub fn test_dlist_is_empty( ) {
645
643
let empty = DList :: <int>( ) ;
646
644
let full1 = from_vec( ~[ 1 , 2 , 3 ] ) ;
647
645
assert empty. is_empty( ) ;
648
646
assert !full1. is_empty( ) ;
649
647
}
650
648
#[ test]
651
- fn test_dlist_head_tail( ) {
649
+ pub fn test_dlist_head_tail( ) {
652
650
let l = from_vec( ~[ 1 , 2 , 3 ] ) ;
653
651
assert l. head( ) == 1 ;
654
652
assert l. tail( ) == 3 ;
655
653
assert l. len( ) == 3 ;
656
654
}
657
655
#[ test]
658
- fn test_dlist_pop( ) {
656
+ pub fn test_dlist_pop( ) {
659
657
let l = from_vec( ~[ 1 , 2 , 3 ] ) ;
660
658
assert l. pop( ) . get( ) == 1 ;
661
659
assert l. tail( ) == 3 ;
@@ -668,7 +666,7 @@ mod tests {
668
666
assert l. pop( ) . is_none( ) ;
669
667
}
670
668
#[ test]
671
- fn test_dlist_pop_tail( ) {
669
+ pub fn test_dlist_pop_tail( ) {
672
670
let l = from_vec( ~[ 1 , 2 , 3 ] ) ;
673
671
assert l. pop_tail( ) . get( ) == 3 ;
674
672
assert l. tail( ) == 2 ;
@@ -681,7 +679,7 @@ mod tests {
681
679
assert l. pop_tail( ) . is_none( ) ;
682
680
}
683
681
#[ test]
684
- fn test_dlist_push( ) {
682
+ pub fn test_dlist_push( ) {
685
683
let l = DList :: <int>( ) ;
686
684
l. push( 1 ) ;
687
685
assert l. head( ) == 1 ;
@@ -695,7 +693,7 @@ mod tests {
695
693
assert l. len( ) == 3 ;
696
694
}
697
695
#[ test]
698
- fn test_dlist_push_head( ) {
696
+ pub fn test_dlist_push_head( ) {
699
697
let l = DList :: <int>( ) ;
700
698
l. push_head( 3 ) ;
701
699
assert l. head( ) == 3 ;
@@ -709,12 +707,12 @@ mod tests {
709
707
assert l. len( ) == 3 ;
710
708
}
711
709
#[ test]
712
- fn test_dlist_foldl( ) {
710
+ pub fn test_dlist_foldl( ) {
713
711
let l = from_vec( vec:: from_fn( 101 , |x|x) ) ;
714
712
assert iter:: foldl( & l, 0 , |accum, elem| * accum+* elem) == 5050 ;
715
713
}
716
714
#[ test]
717
- fn test_dlist_break_early( ) {
715
+ pub fn test_dlist_break_early( ) {
718
716
let l = from_vec( ~[ 1 , 2 , 3 , 4 , 5 ] ) ;
719
717
let mut x = 0 ;
720
718
for l. each |i| {
@@ -724,7 +722,7 @@ mod tests {
724
722
assert x == 3 ;
725
723
}
726
724
#[ test]
727
- fn test_dlist_remove_head( ) {
725
+ pub fn test_dlist_remove_head( ) {
728
726
let l = DList :: <int>( ) ;
729
727
l. assert_consistent( ) ; let one = l. push_n( 1 ) ;
730
728
l. assert_consistent( ) ; let _two = l. push_n( 2 ) ;
@@ -739,7 +737,7 @@ mod tests {
739
737
l. assert_consistent( ) ; assert l. is_empty( ) ;
740
738
}
741
739
#[ test]
742
- fn test_dlist_remove_mid( ) {
740
+ pub fn test_dlist_remove_mid( ) {
743
741
let l = DList :: <int>( ) ;
744
742
l. assert_consistent( ) ; let _one = l. push_n( 1 ) ;
745
743
l. assert_consistent( ) ; let two = l. push_n( 2 ) ;
@@ -754,7 +752,7 @@ mod tests {
754
752
l. assert_consistent( ) ; assert l. is_empty( ) ;
755
753
}
756
754
#[ test]
757
- fn test_dlist_remove_tail( ) {
755
+ pub fn test_dlist_remove_tail( ) {
758
756
let l = DList :: <int>( ) ;
759
757
l. assert_consistent( ) ; let _one = l. push_n( 1 ) ;
760
758
l. assert_consistent( ) ; let _two = l. push_n( 2 ) ;
@@ -769,7 +767,7 @@ mod tests {
769
767
l. assert_consistent( ) ; assert l. is_empty( ) ;
770
768
}
771
769
#[ test]
772
- fn test_dlist_remove_one_two( ) {
770
+ pub fn test_dlist_remove_one_two( ) {
773
771
let l = DList :: <int>( ) ;
774
772
l. assert_consistent( ) ; let one = l. push_n( 1 ) ;
775
773
l. assert_consistent( ) ; let two = l. push_n( 2 ) ;
@@ -785,7 +783,7 @@ mod tests {
785
783
l. assert_consistent( ) ; assert l. is_empty( ) ;
786
784
}
787
785
#[ test]
788
- fn test_dlist_remove_one_three( ) {
786
+ pub fn test_dlist_remove_one_three( ) {
789
787
let l = DList :: <int>( ) ;
790
788
l. assert_consistent( ) ; let one = l. push_n( 1 ) ;
791
789
l. assert_consistent( ) ; let _two = l. push_n( 2 ) ;
@@ -800,7 +798,7 @@ mod tests {
800
798
l. assert_consistent( ) ; assert l. is_empty( ) ;
801
799
}
802
800
#[ test]
803
- fn test_dlist_remove_two_three( ) {
801
+ pub fn test_dlist_remove_two_three( ) {
804
802
let l = DList :: <int>( ) ;
805
803
l. assert_consistent( ) ; let _one = l. push_n( 1 ) ;
806
804
l. assert_consistent( ) ; let two = l. push_n( 2 ) ;
@@ -815,7 +813,7 @@ mod tests {
815
813
l. assert_consistent( ) ; assert l. is_empty( ) ;
816
814
}
817
815
#[ test]
818
- fn test_dlist_remove_all( ) {
816
+ pub fn test_dlist_remove_all( ) {
819
817
let l = DList :: <int>( ) ;
820
818
l. assert_consistent( ) ; let one = l. push_n( 1 ) ;
821
819
l. assert_consistent( ) ; let two = l. push_n( 2 ) ;
@@ -828,7 +826,7 @@ mod tests {
828
826
l. assert_consistent( ) ; assert l. is_empty( ) ;
829
827
}
830
828
#[ test]
831
- fn test_dlist_insert_n_before( ) {
829
+ pub fn test_dlist_insert_n_before( ) {
832
830
let l = DList :: <int>( ) ;
833
831
l. assert_consistent( ) ; let _one = l. push_n( 1 ) ;
834
832
l. assert_consistent( ) ; let two = l. push_n( 2 ) ;
@@ -844,7 +842,7 @@ mod tests {
844
842
l. assert_consistent( ) ; assert l. is_empty( ) ;
845
843
}
846
844
#[ test]
847
- fn test_dlist_insert_n_after( ) {
845
+ pub fn test_dlist_insert_n_after( ) {
848
846
let l = DList :: <int>( ) ;
849
847
l. assert_consistent( ) ; let one = l. push_n( 1 ) ;
850
848
l. assert_consistent( ) ; let _two = l. push_n( 2 ) ;
@@ -860,7 +858,7 @@ mod tests {
860
858
l. assert_consistent( ) ; assert l. is_empty( ) ;
861
859
}
862
860
#[ test]
863
- fn test_dlist_insert_before_head( ) {
861
+ pub fn test_dlist_insert_before_head( ) {
864
862
let l = DList :: <int>( ) ;
865
863
l. assert_consistent( ) ; let one = l. push_n( 1 ) ;
866
864
l. assert_consistent( ) ; let _two = l. push_n( 2 ) ;
@@ -875,7 +873,7 @@ mod tests {
875
873
l. assert_consistent( ) ; assert l. is_empty( ) ;
876
874
}
877
875
#[ test]
878
- fn test_dlist_insert_after_tail( ) {
876
+ pub fn test_dlist_insert_after_tail( ) {
879
877
let l = DList :: <int>( ) ;
880
878
l. assert_consistent( ) ; let _one = l. push_n( 1 ) ;
881
879
l. assert_consistent( ) ; let two = l. push_n( 2 ) ;
@@ -890,15 +888,15 @@ mod tests {
890
888
l. assert_consistent( ) ; assert l. is_empty( ) ;
891
889
}
892
890
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
893
- fn test_dlist_asymmetric_link( ) {
891
+ pub fn test_dlist_asymmetric_link( ) {
894
892
let l = DList :: <int>( ) ;
895
893
let _one = l. push_n( 1 ) ;
896
894
let two = l. push_n( 2 ) ;
897
895
two. prev = None ;
898
896
l. assert_consistent( ) ;
899
897
}
900
898
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
901
- fn test_dlist_cyclic_list( ) {
899
+ pub fn test_dlist_cyclic_list( ) {
902
900
let l = DList :: <int>( ) ;
903
901
let one = l. push_n( 1 ) ;
904
902
let _two = l. push_n( 2 ) ;
@@ -908,32 +906,32 @@ mod tests {
908
906
l. assert_consistent( ) ;
909
907
}
910
908
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
911
- fn test_dlist_headless( ) {
909
+ pub fn test_dlist_headless( ) {
912
910
DList :: <int>( ) . head( ) ;
913
911
}
914
912
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
915
- fn test_dlist_insert_already_present_before( ) {
913
+ pub fn test_dlist_insert_already_present_before( ) {
916
914
let l = DList :: <int>( ) ;
917
915
let one = l. push_n( 1 ) ;
918
916
let two = l. push_n( 2 ) ;
919
917
l. insert_n_before( two, one) ;
920
918
}
921
919
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
922
- fn test_dlist_insert_already_present_after( ) {
920
+ pub fn test_dlist_insert_already_present_after( ) {
923
921
let l = DList :: <int>( ) ;
924
922
let one = l. push_n( 1 ) ;
925
923
let two = l. push_n( 2 ) ;
926
924
l. insert_n_after( one, two) ;
927
925
}
928
926
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
929
- fn test_dlist_insert_before_orphan( ) {
927
+ pub fn test_dlist_insert_before_orphan( ) {
930
928
let l = DList :: <int>( ) ;
931
929
let one = new_dlist_node( 1 ) ;
932
930
let two = new_dlist_node( 2 ) ;
933
931
l. insert_n_before( one, two) ;
934
932
}
935
933
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
936
- fn test_dlist_insert_after_orphan( ) {
934
+ pub fn test_dlist_insert_after_orphan( ) {
937
935
let l = DList :: <int>( ) ;
938
936
let one = new_dlist_node( 1 ) ;
939
937
let two = new_dlist_node( 2 ) ;
0 commit comments