libvorbis: add test
This commit is contained in:
parent
23d09e4f84
commit
6fb85c586f
1 changed files with 26 additions and 0 deletions
|
@ -23,10 +23,36 @@ class Libvorbis < Formula
|
|||
depends_on "pkg-config" => :build
|
||||
depends_on "libogg"
|
||||
|
||||
resource("oggfile") do
|
||||
url "https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg"
|
||||
sha256 "379071af4fa77bc7dacf892ad81d3f92040a628367d34a451a2cdcc997ef27b0"
|
||||
end
|
||||
|
||||
def install
|
||||
system "./autogen.sh" if build.head?
|
||||
system "./configure", "--disable-dependency-tracking",
|
||||
"--prefix=#{prefix}"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<-EOS.undent
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "vorbis/vorbisfile.h"
|
||||
int main (void) {
|
||||
OggVorbis_File vf;
|
||||
assert (ov_open_callbacks (stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) >= 0);
|
||||
vorbis_info *vi = ov_info (&vf, -1);
|
||||
printf("Bitstream is %d channel, %ldHz\\n", vi->channels, vi->rate);
|
||||
printf("Encoded by: %s\\n", ov_comment(&vf,-1)->vendor);
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
testpath.install resource("oggfile")
|
||||
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lvorbisfile",
|
||||
"-o", "test"
|
||||
assert_match "2 channel, 44100Hz\nEncoded by: Xiph.Org libVorbis",
|
||||
shell_output("./test < Example.ogg")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue