File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -5524,7 +5524,8 @@ reduces them without incurring seq initialization"
5524
5524
5525
5525
IFind
5526
5526
(-find [coll n]
5527
- (when (<= end (+ start n))
5527
+ (when (and (not (neg? n))
5528
+ (< (+ start n) end))
5528
5529
(-find v (+ start n))))
5529
5530
5530
5531
IVector
Original file line number Diff line number Diff line change 39
39
(is (= (find [1 2 3 ] 0 ) [0 1 ]))
40
40
(is (= (find [1 2 3 ] -1 ) nil ))
41
41
(is (= (find [1 2 3 ] js/NaN) nil ))
42
- (is (= (find [1 2 3 ] 1.2 ) nil ))
43
42
(is (= (find [1 2 3 ] :a ) nil ))
44
43
(is (= (find [1 2 3 ] 10 ) nil )))
45
44
)
99
98
sv2 (subvec [0 1 2 3 ] 1 1 )]
100
99
(testing " rseq equality"
101
100
(is (= (rseq sv1) '(1 )))
102
- (is (nil? (rseq sv2))))))
101
+ (is (nil? (rseq sv2)))))
102
+ (let [s (subvec [0 1 2 3 ] 0 2 )]
103
+ (testing " IFind"
104
+ (is (= (find s 0 ) [0 0 ]))
105
+ (is (= (find s 1 ) [1 1 ]))
106
+ (is (= (find s 2 ) nil ))
107
+ (is (= (find s -1 ) nil ))))
108
+ )
103
109
))
104
110
105
111
(deftest test-sets
You can’t perform that action at this time.
0 commit comments