create ordered sequence of the given ranges' start and end values
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
start)
|
||||
(end [_this]
|
||||
end)
|
||||
(range-type [_this]
|
||||
:int-range-inclusive)
|
||||
|
||||
Object
|
||||
(toString [_this]
|
||||
@@ -51,3 +53,21 @@
|
||||
(is (= 1 (range/start (int-range-inclusive 1 8)))))
|
||||
(testing "end"
|
||||
(is (= 8 (range/end (int-range-inclusive 1 8))))))
|
||||
|
||||
(deftest ordered-range-values
|
||||
(testing "ordered range values are sorted by value and then the range's start boundary before any end boundary"
|
||||
(is (= [{:value 4 :boundary-type :start :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :start :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :start :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :end :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :end :type :int-range-inclusive}
|
||||
{:value 8 :boundary-type :end :type :int-range-inclusive}]
|
||||
(#'range/ordered-range-values [(int-range-inclusive 4 5)
|
||||
(int-range-inclusive 5 8)
|
||||
(int-range-inclusive 5 5)])))
|
||||
(is (= [{:value 5 :boundary-type :start :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :start :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :end :type :int-range-inclusive}
|
||||
{:value 5 :boundary-type :end :type :int-range-inclusive}]
|
||||
(#'range/ordered-range-values [(int-range-inclusive 5 5)
|
||||
(int-range-inclusive 5 5)])))))
|
||||
|
||||
Reference in New Issue
Block a user