1
0
treerack/results_test.go

53 lines
946 B
Go
Raw Normal View History

2017-11-05 03:28:36 +01:00
package treerack
2026-06-10 00:43:27 +02:00
/*
2017-11-05 03:28:36 +01:00
import "testing"
func TestResults(t *testing.T) {
t.Run("set no match when already has match", func(t *testing.T) {
2026-06-10 00:43:27 +02:00
r := newResults()
2017-11-05 03:28:36 +01:00
r.setMatch(0, 0, 1)
r.setNoMatch(0, 0)
if !r.hasMatchTo(0, 0, 1) {
t.Error("set no match for an existing match")
}
})
t.Run("check match for a non-existing offset", func(t *testing.T) {
2026-06-10 00:43:27 +02:00
r := newResults()
2017-11-05 03:28:36 +01:00
if r.hasMatchTo(1, 0, 1) {
t.Error("found a non-existing match")
}
})
}
2017-11-06 11:41:00 +01:00
func TestPendingWithinCap(t *testing.T) {
2026-06-10 00:43:27 +02:00
r := newResults()
2017-11-06 11:41:00 +01:00
t.Run("parse", func(t *testing.T) {
for i := 0; i < 16; i++ {
r.markPending(0, i)
}
for i := 0; i < 16; i++ {
if !r.pending(0, i) {
t.Error("failed to mark pending")
}
}
})
r.resetPending()
t.Run("parse", func(t *testing.T) {
for i := 0; i < 16; i++ {
r.markPending(0, i)
}
for i := 0; i < 16; i++ {
if !r.pending(0, i) {
t.Error("failed to mark build pending")
}
}
})
}
2026-06-10 00:43:27 +02:00
*/