예제 #1
0
func TestFindMissingMessages(t *testing.T) {
	RegisterTestingT(t)
	overviews := []nntp.MessageOverview{}
	missed := findMissingMessages(1, 10, overviews)
	Expect(missed).To(HaveLen(10))
	Expect(missed.Contains(types.MessageNumber(1))).To(BeTrue())
	Expect(missed.Contains(types.MessageNumber(10))).To(BeTrue())
}
예제 #2
0
파일: client.go 프로젝트: hobeone/gonab
// Given a start and end message number find the
func findMissingMessages(begin, end int64, overviews []nntp.MessageOverview) types.MessageNumberSet {
	fullset := types.NewMessageNumberSet()
	messages := types.NewMessageNumberSet()
	for _, o := range overviews {
		messages.Add(types.MessageNumber(o.MessageNumber))
	}
	for i := begin; i <= end; i++ {
		fullset.Add(types.MessageNumber(i))
	}
	missed := fullset.Difference(messages)
	return missed
}