This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (deftest sliding-sort-test | |
| (testing "Should sort all the given element incrementaly" | |
| (let [xf (sliding-sort 10 <) | |
| input [5 6 7 2 4 0 8 3 1 9] | |
| output (into [] xf input)] | |
| (is (= output [0 1 2 3 4 5 6 7 8 9])))) | |
| (testing "Should sort the given element decrementaly in a sliding window of 5" | |
| (let [xf (sliding-sort 5 >) | |
| input [5 6 7 2 4 0 8 3 1 9] | |
| output (into [] xf input)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (deftest partition-every-test | |
| (testing "Should partition based on elapsed time" | |
| (let [item-count 5 | |
| result (into [] | |
| (comp | |
| (map deref) | |
| (partition-every 100 :millis)) | |
| (repeatedly item-count #(future (Thread/sleep 50) 42))) | |
| flatten-result (flatten result) | |
| count-result (map count result)] |