diff options
| author | David Larson | 2015-04-24 17:49:49 -0700 |
|---|---|---|
| committer | Mike McQuaid | 2015-04-25 10:54:53 +0100 |
| commit | 2a603fc9014a330c0d0c823690fc5d3a2969726f (patch) | |
| tree | 77719fdb7875acb12246a1adffb4809ad096933a | |
| parent | 1cb8880092eef724ba6a5a324113dbb99910be31 (diff) | |
| download | homebrew-2a603fc9014a330c0d0c823690fc5d3a2969726f.tar.bz2 | |
libsvm: add test
Add simple test (adapated from the test in the tinysvm formula). Also
modernize the formula:
- remove `require 'formula'`
- use sha256
- use double quotes
Closes #39019.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
| -rw-r--r-- | Library/Formula/libsvm.rb | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Library/Formula/libsvm.rb b/Library/Formula/libsvm.rb index 8f3ec3888..6738c385c 100644 --- a/Library/Formula/libsvm.rb +++ b/Library/Formula/libsvm.rb @@ -1,9 +1,7 @@ -require 'formula' - class Libsvm < Formula - homepage 'http://www.csie.ntu.edu.tw/~cjlin/libsvm/' - url 'http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.20.tar.gz' - sha1 '6902c22afadc70034c0d1c0e25455df10fb01eaf' + homepage "http://www.csie.ntu.edu.tw/~cjlin/libsvm/" + url "http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.20.tar.gz" + sha256 "0f122480bef44dec4df6dae056f468c208e4e08c00771ec1b6dae2707fd945be" bottle do cellar :any @@ -21,4 +19,23 @@ class Libsvm < Formula system "install_name_tool", "-id", "#{lib}/libsvm.2.dylib", "#{lib}/libsvm.2.dylib" include.install "svm.h" end + + test do + (testpath/"train_classification.txt").write <<-EOS.undent + +1 201:1.2 3148:1.8 3983:1 4882:1 + -1 874:0.3 3652:1.1 3963:1 6179:1 + +1 1168:1.2 3318:1.2 3938:1.8 4481:1 + +1 350:1 3082:1.5 3965:1 6122:0.2 + -1 99:1 3057:1 3957:1 5838:0.3 + EOS + + (testpath/"train_regression.txt").write <<-EOS.undent + 0.23 201:1.2 3148:1.8 3983:1 4882:1 + 0.33 874:0.3 3652:1.1 3963:1 6179:1 + -0.12 1168:1.2 3318:1.2 3938:1.8 4481:1 + EOS + + system "#{bin}/svm-train", "-s", "0", "train_classification.txt" + system "#{bin}/svm-train", "-s", "3", "train_regression.txt" + end end |
