diff options
| author | Joshua Peek <josh@joshpeek.com> | 2012-06-08 14:13:26 -0500 |
|---|---|---|
| committer | Joshua Peek <josh@joshpeek.com> | 2012-06-08 14:13:26 -0500 |
| commit | 9ecab364d1f04fbe7875e92bbcf1c06ee3b9a4e1 (patch) | |
| tree | 52ba10d401b2681e384dd6cb50b6cd94e6e43b0c /test/test_classifier.rb | |
| parent | 0172623061f45d92da66438a31e0a532c2223d35 (diff) | |
Dump classifier results
Diffstat (limited to 'test/test_classifier.rb')
| -rw-r--r-- | test/test_classifier.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test_classifier.rb b/test/test_classifier.rb index 3572604..2425466 100644 --- a/test/test_classifier.rb +++ b/test/test_classifier.rb @@ -1,5 +1,6 @@ require 'linguist/classifier' require 'linguist/language' +require 'linguist/sample' require 'test/unit' @@ -14,7 +15,7 @@ class TestClassifier < Test::Unit::TestCase File.read(File.join(fixtures_path, name)) end - def test_classify + def test_train_and_classify classifier = Classifier.new classifier.train Language["Ruby"], fixture("ruby/foo.rb") classifier.train Language["Objective-C"], fixture("objective-c/Foo.h") @@ -23,4 +24,16 @@ class TestClassifier < Test::Unit::TestCase results = classifier.classify(fixture("objective-c/hello.m")) assert_equal Language["Objective-C"], results.first[0] end + + def test_instance_classify_empty + results = Classifier.instance.classify("") + assert results.first[1] < 0.5, results.first.inspect + end + + # def test_instance_classify + # Sample.each do |sample| + # results = Classifier.instance.classify(sample.data) + # assert_equal sample.language, results.first[0], sample.path + # end + # end end |
