Skip to content

Commit

Permalink
start on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnps committed Feb 22, 2014
1 parent 932ba56 commit 16fc66a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kanjidic2.xml
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
before_script:
- setup.sh
17 changes: 17 additions & 0 deletions kanjidic2_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package kanjidic2

import (
"testing"
)

var numKanji = 13108

func TestParser(t *testing.T) {
got, err := ParseKanjiDic2("/Users/shawn/Downloads/kanjidic2.xml")
if err != nil {
t.Fatalf("ParseKanjiDic2: %v", err)
}
if len(got) != numKanji {
t.Fatalf("ParseKanjiDic2 length incorrect: got %d, want %d", got, numKanji)
}
}
4 changes: 4 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

wget http://www.csse.monash.edu.au/\~jwb/kanjidic2/kanjidic2.xml.gz
gunzip kanjidic2.xml.gz

0 comments on commit 16fc66a

Please sign in to comment.