@@ -754,99 +754,97 @@ def to.to_int() -2 end
754
754
a . send ( @method , ( ...-9 ) ) . should == [ ]
755
755
end
756
756
757
- ruby_version_is "3.2" do
758
- describe "can be sliced with Enumerator::ArithmeticSequence" do
759
- it "with infinite/inverted ranges and negative steps" do
760
- @array = [ 0 , 1 , 2 , 3 , 4 , 5 ]
761
- @array . send ( @method , ( 2 ..) . step ( -1 ) ) . should == [ 2 , 1 , 0 ]
762
- @array . send ( @method , ( 2 ..) . step ( -2 ) ) . should == [ 2 , 0 ]
763
- @array . send ( @method , ( 2 ..) . step ( -3 ) ) . should == [ 2 ]
764
- @array . send ( @method , ( 2 ..) . step ( -4 ) ) . should == [ 2 ]
765
-
766
- @array . send ( @method , ( -3 ..) . step ( -1 ) ) . should == [ 3 , 2 , 1 , 0 ]
767
- @array . send ( @method , ( -3 ..) . step ( -2 ) ) . should == [ 3 , 1 ]
768
- @array . send ( @method , ( -3 ..) . step ( -3 ) ) . should == [ 3 , 0 ]
769
- @array . send ( @method , ( -3 ..) . step ( -4 ) ) . should == [ 3 ]
770
- @array . send ( @method , ( -3 ..) . step ( -5 ) ) . should == [ 3 ]
771
-
772
- @array . send ( @method , ( ..0 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 , 1 , 0 ]
773
- @array . send ( @method , ( ..0 ) . step ( -2 ) ) . should == [ 5 , 3 , 1 ]
774
- @array . send ( @method , ( ..0 ) . step ( -3 ) ) . should == [ 5 , 2 ]
775
- @array . send ( @method , ( ..0 ) . step ( -4 ) ) . should == [ 5 , 1 ]
776
- @array . send ( @method , ( ..0 ) . step ( -5 ) ) . should == [ 5 , 0 ]
777
- @array . send ( @method , ( ..0 ) . step ( -6 ) ) . should == [ 5 ]
778
- @array . send ( @method , ( ..0 ) . step ( -7 ) ) . should == [ 5 ]
779
-
780
- @array . send ( @method , ( ...0 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 , 1 ]
781
- @array . send ( @method , ( ...0 ) . step ( -2 ) ) . should == [ 5 , 3 , 1 ]
782
- @array . send ( @method , ( ...0 ) . step ( -3 ) ) . should == [ 5 , 2 ]
783
- @array . send ( @method , ( ...0 ) . step ( -4 ) ) . should == [ 5 , 1 ]
784
- @array . send ( @method , ( ...0 ) . step ( -5 ) ) . should == [ 5 ]
785
- @array . send ( @method , ( ...0 ) . step ( -6 ) ) . should == [ 5 ]
786
-
787
- @array . send ( @method , ( ...1 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 ]
788
- @array . send ( @method , ( ...1 ) . step ( -2 ) ) . should == [ 5 , 3 ]
789
- @array . send ( @method , ( ...1 ) . step ( -3 ) ) . should == [ 5 , 2 ]
790
- @array . send ( @method , ( ...1 ) . step ( -4 ) ) . should == [ 5 ]
791
- @array . send ( @method , ( ...1 ) . step ( -5 ) ) . should == [ 5 ]
792
-
793
- @array . send ( @method , ( ..-5 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 , 1 ]
794
- @array . send ( @method , ( ..-5 ) . step ( -2 ) ) . should == [ 5 , 3 , 1 ]
795
- @array . send ( @method , ( ..-5 ) . step ( -3 ) ) . should == [ 5 , 2 ]
796
- @array . send ( @method , ( ..-5 ) . step ( -4 ) ) . should == [ 5 , 1 ]
797
- @array . send ( @method , ( ..-5 ) . step ( -5 ) ) . should == [ 5 ]
798
- @array . send ( @method , ( ..-5 ) . step ( -6 ) ) . should == [ 5 ]
799
-
800
- @array . send ( @method , ( ...-5 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 ]
801
- @array . send ( @method , ( ...-5 ) . step ( -2 ) ) . should == [ 5 , 3 ]
802
- @array . send ( @method , ( ...-5 ) . step ( -3 ) ) . should == [ 5 , 2 ]
803
- @array . send ( @method , ( ...-5 ) . step ( -4 ) ) . should == [ 5 ]
804
- @array . send ( @method , ( ...-5 ) . step ( -5 ) ) . should == [ 5 ]
805
-
806
- @array . send ( @method , ( 4 ..1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
807
- @array . send ( @method , ( 4 ..1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
808
- @array . send ( @method , ( 4 ..1 ) . step ( -3 ) ) . should == [ 4 , 1 ]
809
- @array . send ( @method , ( 4 ..1 ) . step ( -4 ) ) . should == [ 4 ]
810
- @array . send ( @method , ( 4 ..1 ) . step ( -5 ) ) . should == [ 4 ]
811
-
812
- @array . send ( @method , ( 4 ...1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
813
- @array . send ( @method , ( 4 ...1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
814
- @array . send ( @method , ( 4 ...1 ) . step ( -3 ) ) . should == [ 4 ]
815
- @array . send ( @method , ( 4 ...1 ) . step ( -4 ) ) . should == [ 4 ]
816
-
817
- @array . send ( @method , ( -2 ..1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
818
- @array . send ( @method , ( -2 ..1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
819
- @array . send ( @method , ( -2 ..1 ) . step ( -3 ) ) . should == [ 4 , 1 ]
820
- @array . send ( @method , ( -2 ..1 ) . step ( -4 ) ) . should == [ 4 ]
821
- @array . send ( @method , ( -2 ..1 ) . step ( -5 ) ) . should == [ 4 ]
822
-
823
- @array . send ( @method , ( -2 ...1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
824
- @array . send ( @method , ( -2 ...1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
825
- @array . send ( @method , ( -2 ...1 ) . step ( -3 ) ) . should == [ 4 ]
826
- @array . send ( @method , ( -2 ...1 ) . step ( -4 ) ) . should == [ 4 ]
827
-
828
- @array . send ( @method , ( 4 ..-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
829
- @array . send ( @method , ( 4 ..-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
830
- @array . send ( @method , ( 4 ..-5 ) . step ( -3 ) ) . should == [ 4 , 1 ]
831
- @array . send ( @method , ( 4 ..-5 ) . step ( -4 ) ) . should == [ 4 ]
832
- @array . send ( @method , ( 4 ..-5 ) . step ( -5 ) ) . should == [ 4 ]
833
-
834
- @array . send ( @method , ( 4 ...-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
835
- @array . send ( @method , ( 4 ...-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
836
- @array . send ( @method , ( 4 ...-5 ) . step ( -3 ) ) . should == [ 4 ]
837
- @array . send ( @method , ( 4 ...-5 ) . step ( -4 ) ) . should == [ 4 ]
838
-
839
- @array . send ( @method , ( -2 ..-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
840
- @array . send ( @method , ( -2 ..-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
841
- @array . send ( @method , ( -2 ..-5 ) . step ( -3 ) ) . should == [ 4 , 1 ]
842
- @array . send ( @method , ( -2 ..-5 ) . step ( -4 ) ) . should == [ 4 ]
843
- @array . send ( @method , ( -2 ..-5 ) . step ( -5 ) ) . should == [ 4 ]
844
-
845
- @array . send ( @method , ( -2 ...-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
846
- @array . send ( @method , ( -2 ...-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
847
- @array . send ( @method , ( -2 ...-5 ) . step ( -3 ) ) . should == [ 4 ]
848
- @array . send ( @method , ( -2 ...-5 ) . step ( -4 ) ) . should == [ 4 ]
849
- end
757
+ describe "can be sliced with Enumerator::ArithmeticSequence" do
758
+ it "with infinite/inverted ranges and negative steps" do
759
+ @array = [ 0 , 1 , 2 , 3 , 4 , 5 ]
760
+ @array . send ( @method , ( 2 ..) . step ( -1 ) ) . should == [ 2 , 1 , 0 ]
761
+ @array . send ( @method , ( 2 ..) . step ( -2 ) ) . should == [ 2 , 0 ]
762
+ @array . send ( @method , ( 2 ..) . step ( -3 ) ) . should == [ 2 ]
763
+ @array . send ( @method , ( 2 ..) . step ( -4 ) ) . should == [ 2 ]
764
+
765
+ @array . send ( @method , ( -3 ..) . step ( -1 ) ) . should == [ 3 , 2 , 1 , 0 ]
766
+ @array . send ( @method , ( -3 ..) . step ( -2 ) ) . should == [ 3 , 1 ]
767
+ @array . send ( @method , ( -3 ..) . step ( -3 ) ) . should == [ 3 , 0 ]
768
+ @array . send ( @method , ( -3 ..) . step ( -4 ) ) . should == [ 3 ]
769
+ @array . send ( @method , ( -3 ..) . step ( -5 ) ) . should == [ 3 ]
770
+
771
+ @array . send ( @method , ( ..0 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 , 1 , 0 ]
772
+ @array . send ( @method , ( ..0 ) . step ( -2 ) ) . should == [ 5 , 3 , 1 ]
773
+ @array . send ( @method , ( ..0 ) . step ( -3 ) ) . should == [ 5 , 2 ]
774
+ @array . send ( @method , ( ..0 ) . step ( -4 ) ) . should == [ 5 , 1 ]
775
+ @array . send ( @method , ( ..0 ) . step ( -5 ) ) . should == [ 5 , 0 ]
776
+ @array . send ( @method , ( ..0 ) . step ( -6 ) ) . should == [ 5 ]
777
+ @array . send ( @method , ( ..0 ) . step ( -7 ) ) . should == [ 5 ]
778
+
779
+ @array . send ( @method , ( ...0 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 , 1 ]
780
+ @array . send ( @method , ( ...0 ) . step ( -2 ) ) . should == [ 5 , 3 , 1 ]
781
+ @array . send ( @method , ( ...0 ) . step ( -3 ) ) . should == [ 5 , 2 ]
782
+ @array . send ( @method , ( ...0 ) . step ( -4 ) ) . should == [ 5 , 1 ]
783
+ @array . send ( @method , ( ...0 ) . step ( -5 ) ) . should == [ 5 ]
784
+ @array . send ( @method , ( ...0 ) . step ( -6 ) ) . should == [ 5 ]
785
+
786
+ @array . send ( @method , ( ...1 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 ]
787
+ @array . send ( @method , ( ...1 ) . step ( -2 ) ) . should == [ 5 , 3 ]
788
+ @array . send ( @method , ( ...1 ) . step ( -3 ) ) . should == [ 5 , 2 ]
789
+ @array . send ( @method , ( ...1 ) . step ( -4 ) ) . should == [ 5 ]
790
+ @array . send ( @method , ( ...1 ) . step ( -5 ) ) . should == [ 5 ]
791
+
792
+ @array . send ( @method , ( ..-5 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 , 1 ]
793
+ @array . send ( @method , ( ..-5 ) . step ( -2 ) ) . should == [ 5 , 3 , 1 ]
794
+ @array . send ( @method , ( ..-5 ) . step ( -3 ) ) . should == [ 5 , 2 ]
795
+ @array . send ( @method , ( ..-5 ) . step ( -4 ) ) . should == [ 5 , 1 ]
796
+ @array . send ( @method , ( ..-5 ) . step ( -5 ) ) . should == [ 5 ]
797
+ @array . send ( @method , ( ..-5 ) . step ( -6 ) ) . should == [ 5 ]
798
+
799
+ @array . send ( @method , ( ...-5 ) . step ( -1 ) ) . should == [ 5 , 4 , 3 , 2 ]
800
+ @array . send ( @method , ( ...-5 ) . step ( -2 ) ) . should == [ 5 , 3 ]
801
+ @array . send ( @method , ( ...-5 ) . step ( -3 ) ) . should == [ 5 , 2 ]
802
+ @array . send ( @method , ( ...-5 ) . step ( -4 ) ) . should == [ 5 ]
803
+ @array . send ( @method , ( ...-5 ) . step ( -5 ) ) . should == [ 5 ]
804
+
805
+ @array . send ( @method , ( 4 ..1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
806
+ @array . send ( @method , ( 4 ..1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
807
+ @array . send ( @method , ( 4 ..1 ) . step ( -3 ) ) . should == [ 4 , 1 ]
808
+ @array . send ( @method , ( 4 ..1 ) . step ( -4 ) ) . should == [ 4 ]
809
+ @array . send ( @method , ( 4 ..1 ) . step ( -5 ) ) . should == [ 4 ]
810
+
811
+ @array . send ( @method , ( 4 ...1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
812
+ @array . send ( @method , ( 4 ...1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
813
+ @array . send ( @method , ( 4 ...1 ) . step ( -3 ) ) . should == [ 4 ]
814
+ @array . send ( @method , ( 4 ...1 ) . step ( -4 ) ) . should == [ 4 ]
815
+
816
+ @array . send ( @method , ( -2 ..1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
817
+ @array . send ( @method , ( -2 ..1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
818
+ @array . send ( @method , ( -2 ..1 ) . step ( -3 ) ) . should == [ 4 , 1 ]
819
+ @array . send ( @method , ( -2 ..1 ) . step ( -4 ) ) . should == [ 4 ]
820
+ @array . send ( @method , ( -2 ..1 ) . step ( -5 ) ) . should == [ 4 ]
821
+
822
+ @array . send ( @method , ( -2 ...1 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
823
+ @array . send ( @method , ( -2 ...1 ) . step ( -2 ) ) . should == [ 4 , 2 ]
824
+ @array . send ( @method , ( -2 ...1 ) . step ( -3 ) ) . should == [ 4 ]
825
+ @array . send ( @method , ( -2 ...1 ) . step ( -4 ) ) . should == [ 4 ]
826
+
827
+ @array . send ( @method , ( 4 ..-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
828
+ @array . send ( @method , ( 4 ..-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
829
+ @array . send ( @method , ( 4 ..-5 ) . step ( -3 ) ) . should == [ 4 , 1 ]
830
+ @array . send ( @method , ( 4 ..-5 ) . step ( -4 ) ) . should == [ 4 ]
831
+ @array . send ( @method , ( 4 ..-5 ) . step ( -5 ) ) . should == [ 4 ]
832
+
833
+ @array . send ( @method , ( 4 ...-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
834
+ @array . send ( @method , ( 4 ...-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
835
+ @array . send ( @method , ( 4 ...-5 ) . step ( -3 ) ) . should == [ 4 ]
836
+ @array . send ( @method , ( 4 ...-5 ) . step ( -4 ) ) . should == [ 4 ]
837
+
838
+ @array . send ( @method , ( -2 ..-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 , 1 ]
839
+ @array . send ( @method , ( -2 ..-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
840
+ @array . send ( @method , ( -2 ..-5 ) . step ( -3 ) ) . should == [ 4 , 1 ]
841
+ @array . send ( @method , ( -2 ..-5 ) . step ( -4 ) ) . should == [ 4 ]
842
+ @array . send ( @method , ( -2 ..-5 ) . step ( -5 ) ) . should == [ 4 ]
843
+
844
+ @array . send ( @method , ( -2 ...-5 ) . step ( -1 ) ) . should == [ 4 , 3 , 2 ]
845
+ @array . send ( @method , ( -2 ...-5 ) . step ( -2 ) ) . should == [ 4 , 2 ]
846
+ @array . send ( @method , ( -2 ...-5 ) . step ( -3 ) ) . should == [ 4 ]
847
+ @array . send ( @method , ( -2 ...-5 ) . step ( -4 ) ) . should == [ 4 ]
850
848
end
851
849
end
852
850
0 commit comments