1
0
mirror of https://github.com/Morantron/tmux-fingers.git synced 2024-07-01 08:10:57 +02:00
tmux-fingers/spec/lib/priority_queue_spec.cr

40 lines
753 B
Crystal
Raw Normal View History

2020-05-02 11:45:56 +02:00
require "spec"
require "../../src/priority_queue"
describe PriorityQueue do
it "transforms tmux status line format into escape sequences" do
test = [
[3, "Clear drains"],
2023-09-13 16:40:08 +02:00
[6, "drink tea"],
2020-05-02 11:45:56 +02:00
[5, "Make tea"],
2023-09-13 16:40:08 +02:00
[4, "Feed cat"],
[7, "eat biscuit"],
2020-05-02 11:45:56 +02:00
[2, "Tax return"],
2023-09-13 16:40:08 +02:00
[1, "Solve RC tasks"],
2020-05-02 11:45:56 +02:00
]
results = [] of String
pq = PriorityQueue(String).new
test.each do |pair|
pr, str = pair
pq.push(pr.to_i, str.to_s)
end
until pq.empty?
results.push(pq.pop)
end
expected = [
"eat biscuit",
2023-09-13 16:40:08 +02:00
"drink tea",
"Make tea",
"Feed cat",
"Clear drains",
"Tax return",
"Solve RC tasks",
2020-05-02 11:45:56 +02:00
]
results.should eq expected
end
end