diff options
| author | Misty De Meo | 2013-06-02 16:03:36 -0500 |
|---|---|---|
| committer | Misty De Meo | 2013-06-02 16:03:36 -0500 |
| commit | 06ca615fb553c375cca02ed57eb67e8d326f351a (patch) | |
| tree | 292dea7eaf53f13867b49d64a3597052c215836f /Library | |
| parent | b1a636c649591f67b34b890ec9c1f7ad16908e38 (diff) | |
| download | homebrew-06ca615fb553c375cca02ed57eb67e8d326f351a.tar.bz2 | |
fftw: add test
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/fftw.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Formula/fftw.rb b/Library/Formula/fftw.rb index cf419ec80..82553456f 100644 --- a/Library/Formula/fftw.rb +++ b/Library/Formula/fftw.rb @@ -43,4 +43,28 @@ class Fftw < Formula system "./configure", "--enable-long-double", *args system "make install" end + + test do + # Adapted from the sample usage provided in the documentation: + # http://www.fftw.org/fftw3_doc/Complex-One_002dDimensional-DFTs.html + (testpath/'fftw.c').write <<-TEST_SCRIPT.undent + #include <fftw3.h> + + int main(int argc, char* *argv) + { + fftw_complex *in, *out; + fftw_plan p; + long N = 1; + in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N); + out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N); + p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE); + fftw_execute(p); /* repeat as needed */ + fftw_destroy_plan(p); + fftw_free(in); fftw_free(out); + } + TEST_SCRIPT + + system ENV.cc, '-o', 'fftw', 'fftw.c', '-lfftw3', *ENV.cflags.split + system './fftw' + end end |
