type PageMeta struct {
WordCount int
FuzzyWordCount int
+ MinRead int
}
type Position struct {
func (p *Page) analyzePage() {
p.WordCount = TotalWords(p.Plain())
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
+ p.MinRead = int((p.WordCount + 212) / 213)
}
func (p *Page) permalink() (*url.URL, error) {
if p.FuzzyWordCount != 500 {
t.Fatalf("incorrect word count. expected %v, got %v", 500, p.WordCount)
}
+
+ if p.MinRead != 3 {
+ t.Fatalf("incorrect min read. expected %v, got %v", 3, p.MinRead)
+ }
}
func TestCreatePage(t *testing.T) {