aoc2023/day-17/pqueue_test.go

28 lines
547 B
Go
Raw Normal View History

2023-12-22 21:56:07 +00:00
package main
import (
"container/heap"
"testing"
"github.com/go-playground/assert/v2"
)
func TestPriorityQueue(t *testing.T) {
//t.Skip("skipping test")
pq := newPriorityQueue()
heap.Push(pq, newNode(30, 0, 0, 0, 0, 0))
heap.Push(pq, newNode(10, 0, 0, 0, 8, 0))
heap.Push(pq, newNode(20, 0, 0, 0, 13, 0))
t.Run("Should create a queue size 3", func(t *testing.T) {
assert.Equal(t, 3, pq.Len())
})
item := heap.Pop(pq).(*node)
t.Run("Should return item with cost 10", func(t *testing.T) {
assert.Equal(t, 10, item.cost)
})
}