diff options
author | Eric Blossom | 2010-11-05 22:32:35 -0700 |
---|---|---|
committer | Eric Blossom | 2010-11-10 12:17:57 -0800 |
commit | b316cb06d0c6aa7be9942e48c71324fb8d637de8 (patch) | |
tree | 9f0ed01a38a1d44dc7618e1956b1e2eb202f0dc8 /gnuradio-core/src | |
parent | a79986e0a88632029daf2dad5d05518d33bb1866 (diff) | |
download | gnuradio-b316cb06d0c6aa7be9942e48c71324fb8d637de8.tar.gz gnuradio-b316cb06d0c6aa7be9942e48c71324fb8d637de8.tar.bz2 gnuradio-b316cb06d0c6aa7be9942e48c71324fb8d637de8.zip |
More guile QA code
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/guile/.gitignore | 1 | ||||
-rw-r--r-- | gnuradio-core/src/guile/Makefile.am | 2 | ||||
-rw-r--r-- | gnuradio-core/src/guile/qa_0000_basics.scm | 66 | ||||
-rw-r--r-- | gnuradio-core/src/guile/srfi/srfi-64.scm | 2 |
4 files changed, 53 insertions, 18 deletions
diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore index 6a0410b79..c76800aac 100644 --- a/gnuradio-core/src/guile/.gitignore +++ b/gnuradio-core/src/guile/.gitignore @@ -1,3 +1,4 @@ /Makefile /Makefile.in /run_guile_tests +/qa_*.log diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index ef6ab0b7e..5a9721b64 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -36,3 +36,5 @@ nobase_guile_DATA = \ gnuradio/export-safely.scm \ gnuradio/runtime-shim.scm \ srfi/srfi-64.scm + +CLEANFILES = qa_*.log diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm index 19bde0589..5d3a53d24 100644 --- a/gnuradio-core/src/guile/qa_0000_basics.scm +++ b/gnuradio-core/src/guile/qa_0000_basics.scm @@ -1,19 +1,17 @@ (use-modules (gnuradio core)) (use-modules (oop goops)) +;;(use-modules (ice-9 format)) +;;(use-modules (ice-9 pretty-print)) -(load-from-path "srfi/srfi-64") -(use-modules (ice-9 format)) -(use-modules (ice-9 pretty-print)) - -;; (write "Hello QA world!\n") +(load-from-path "srfi/srfi-64") ; unit test library (define (vector-map f v) (list->vector (map f (vector->list v)))) -(define (test-1) +(define (test-connect-1) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -26,10 +24,10 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) -(define (test-2) +(define (test-connect-2) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -42,10 +40,10 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) -(define (test-3) +(define (test-connect-3) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -58,10 +56,10 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) -(define (test-4) +(define (test-connect-4) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -73,10 +71,44 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) +(define (test-io-signature-1) + (let ((ios1 (gr:io-signature 1 2 8)) + (ios2 (gr:io-signature2 1 2 16 32)) + (ios3 (gr:io-signature3 1 -1 14 32 48)) + (iosv (gr:io-signaturev 1 4 '(1 2 3)))) + + (test-equal 1 (gr:min-streams ios1)) + (test-equal 2 (gr:max-streams ios1)) + (test-equal 8 (gr:sizeof-stream-item ios1 0)) + (test-equal 8 (gr:sizeof-stream-item ios1 1)) + + (test-equal 1 (gr:min-streams ios2)) + (test-equal 2 (gr:max-streams ios2)) + (test-equal 16 (gr:sizeof-stream-item ios2 0)) + (test-equal 32 (gr:sizeof-stream-item ios2 1)) + + (test-equal 1 (gr:min-streams ios3)) + (test-equal -1 (gr:max-streams ios3)) + (test-equal 14 (gr:sizeof-stream-item ios3 0)) + (test-equal 32 (gr:sizeof-stream-item ios3 1)) + (test-equal 48 (gr:sizeof-stream-item ios3 2)) + (test-equal '#(14 32 48) (gr:sizeof-stream-items ios3)) + + (test-equal 1 (gr:min-streams iosv)) + (test-equal 4 (gr:max-streams iosv)) + (test-equal 1 (gr:sizeof-stream-item iosv 0)) + (test-equal 2 (gr:sizeof-stream-item iosv 1)) + (test-equal 3 (gr:sizeof-stream-item iosv 2)) + (test-equal 3 (gr:sizeof-stream-item iosv 3)) + (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) + )) + + (test-begin "qa_0000_basics") -(test-1) -(test-2) -(test-3) -(test-4) +(test-connect-1) +(test-connect-2) +(test-connect-3) +(test-connect-4) +(test-io-signature-1) (test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/srfi/srfi-64.scm b/gnuradio-core/src/guile/srfi/srfi-64.scm index 25833b3f7..4ad9ccbab 100644 --- a/gnuradio-core/src/guile/srfi/srfi-64.scm +++ b/gnuradio-core/src/guile/srfi/srfi-64.scm @@ -189,7 +189,7 @@ ;; Not part of the specification. FIXME ;; Controls whether a log file is generated. -(define test-log-to-file #f) +(define test-log-to-file #t) (define (test-runner-simple) (let ((runner (%test-runner-alloc))) |