1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-23 20:50:27 +08:00

updated all tests to use Fatal/Fatalf to fail tests ealier

This commit is contained in:
Wang Bin
2015-03-30 18:01:21 +08:00
parent c397cafe8a
commit 7cf16072e6
7 changed files with 53 additions and 53 deletions

View File

@@ -260,11 +260,11 @@ func TestExtractTags(t *testing.T) {
for index, sentence := range test_contents {
result := et.ExtractTags(sentence, 20)
if len(result) != len(Tags[index]) {
t.Errorf("%s = %v", sentence, result)
t.Fatalf("%s = %v", sentence, result)
}
for i, tag := range result {
if tag.Word != Tags[index][i] {
t.Errorf("%s != %s", tag, Tags[index][i])
t.Fatalf("%s != %s", tag, Tags[index][i])
}
}
}
@@ -276,7 +276,7 @@ func TestExtratTagsWithWeight(t *testing.T) {
for index, tag := range result {
if LyciWeight[index].Word != tag.Word ||
math.Abs(LyciWeight[index].Weight-tag.Weight) > 1e-6 {
t.Errorf("%v != %v", tag, LyciWeight[index])
t.Fatalf("%v != %v", tag, LyciWeight[index])
}
}
}
@@ -288,7 +288,7 @@ func TestExtractTagsWithStopWordsFile(t *testing.T) {
for index, tag := range result {
if LyciWeight2[index].Word != tag.Word ||
math.Abs(LyciWeight2[index].Weight-tag.Weight) > 1e-6 {
t.Errorf("%v != %v", tag, LyciWeight2[index])
t.Fatalf("%v != %v", tag, LyciWeight2[index])
}
}
}

View File

@@ -27,7 +27,7 @@ func TestTextRank(t *testing.T) {
results := tr.TextRank(sentence, 10)
for index, tw := range results {
if tw.Word != tagRanks[index].Word || math.Abs(tw.Weight-tagRanks[index].Weight) > 1e-6 {
t.Errorf("%v != %v", tw, tagRanks[index])
t.Fatalf("%v != %v", tw, tagRanks[index])
}
}
}