aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-01-07 14:22:24 +0100
committerJack Nagel2015-01-12 21:01:35 -0500
commitae269796a2d732ecdbabab76a598aecc1511102d (patch)
treed66b09dc584993e4ae3f756c16ccc6d6baca2629 /Library
parent3452bdd004efe97ef0739875c08ca4a5639ce75a (diff)
downloadhomebrew-ae269796a2d732ecdbabab76a598aecc1511102d.tar.bz2
tinysvm: real test added
Closes #35629. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/tinysvm.rb36
1 files changed, 25 insertions, 11 deletions
diff --git a/Library/Formula/tinysvm.rb b/Library/Formula/tinysvm.rb
index c421d394f..fa5f0e0c1 100644
--- a/Library/Formula/tinysvm.rb
+++ b/Library/Formula/tinysvm.rb
@@ -1,9 +1,7 @@
-require 'formula'
-
class Tinysvm < Formula
- homepage 'http://chasen.org/~taku/software/TinySVM/'
- url 'http://chasen.org/~taku/software/TinySVM/src/TinySVM-0.09.tar.gz'
- sha1 '9c3c36454c475180ef6646d059376f35549cad08'
+ homepage "http://chasen.org/~taku/software/TinySVM/"
+ url "http://chasen.org/~taku/software/TinySVM/src/TinySVM-0.09.tar.gz"
+ sha1 "9c3c36454c475180ef6646d059376f35549cad08"
# Use correct compilation flag
patch :p0 do
@@ -13,21 +11,37 @@ class Tinysvm < Formula
def install
# Needed to select proper getopt, per MacPorts
- ENV.append_to_cflags '-D__GNU_LIBRARY__'
+ ENV.append_to_cflags "-D__GNU_LIBRARY__"
- inreplace 'configure', '-O9', '' # clang barfs on -O9
+ inreplace "configure", "-O9", "" # clang barfs on -O9
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}",
"--disable-shared"
- system "make install"
+ system "make", "install"
end
test do
- system "#{bin}/svm_learn", "--help"
- system "#{bin}/svm_classify", "--help"
- system "#{bin}/svm_model", "--help"
+ (testpath/"train.svmdata").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.svrdata").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_learn", "-t", "1", "-d", "2", "-c", "train.svmdata", "test"
+ system "#{bin}/svm_classify", "-V", "train.svmdata", "test"
+ system "#{bin}/svm_model", "test"
+
+ assert File.exist? "test"
end
end