From edca19393f74f803b2b5a970683d216ef41c05c3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 15:10:03 -0800 Subject: new QA code work-in-progress (forgot -a ...) --- gnuradio-core/src/guile/00_runtime_basics.test | 32 +++++++++++++--------- gnuradio-core/src/guile/Makefile.am | 18 ++++++------ .../src/guile/gnuradio/test-suite/guile-test | 8 +++--- .../src/guile/gnuradio/test-suite/lib.scm | 2 +- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/gnuradio-core/src/guile/00_runtime_basics.test b/gnuradio-core/src/guile/00_runtime_basics.test index 423a49478..a8fcf263b 100644 --- a/gnuradio-core/src/guile/00_runtime_basics.test +++ b/gnuradio-core/src/guile/00_runtime_basics.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,21 +18,27 @@ ;;; along with this program. If not, see . ;;; +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) +(use-modules (ice-9 syncase)) ;;(use-modules (ice-9 format)) ;;(use-modules (ice-9 pretty-print)) -(load-from-path "srfi/srfi-64") ; unit test library +;; (test-equal [name] expected test-expr) +(define-syntax test-equal + (syntax-rules () + ((_ expected test-expr) + (pass-if (equal? expected test-expr))) + ((_ name expected test-exprt) + (pass-if name (equal? expected test-expr))))) + (define (vector-map f v) (list->vector (map f (vector->list v)))) -;; Must precede all tests -(test-begin "qa_0000_basics") - -(test-group "test-connect-1" +(with-test-prefix "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 "QA top block")) @@ -44,10 +51,11 @@ (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) (gr:run tb) - (test-equal expected-result (gr:data dst)))) - + ;;(pass-if (equal? expected-result (gr:data dst))) + (test-equal expected-result (gr:data dst)) + )) -(test-group "test-connect-2" +(with-test-prefix "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 "QA top block")) @@ -63,7 +71,7 @@ (test-equal expected-result (gr:data dst)))) -(test-group "test-connect-3" +(with-test-prefix "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 "QA top block")) @@ -79,7 +87,7 @@ (test-equal expected-result (gr:data dst)))) -(test-group "test-connect-4" +(with-test-prefix "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 "QA top block")) @@ -94,7 +102,7 @@ (test-equal expected-result (gr:data dst)))) -(test-group "test-io-signature-1" +(with-test-prefix "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)) @@ -126,5 +134,3 @@ (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) )) -;; Must follow all tests -(test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 4db679cff..bbb36794e 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -38,14 +38,14 @@ nobase_guile_DATA = \ gnuradio/runtime-shim.scm \ srfi/srfi-64.scm -noinst_DATA = \ - qa_0000_basics.scm \ - qa_0010_ctor_filter.scm \ - qa_0010_ctor_general.scm \ - qa_0010_ctor_gengen.scm \ - qa_0010_ctor_hier.scm \ - qa_0010_ctor_io.scm \ - qa_0010_ctor_runtime.scm - +# noinst_DATA = \ +# qa_0000_basics.scm \ +# qa_0010_ctor_filter.scm \ +# qa_0010_ctor_general.scm \ +# qa_0010_ctor_gengen.scm \ +# qa_0010_ctor_hier.scm \ +# qa_0010_ctor_io.scm \ +# qa_0010_ctor_runtime.scm +# CLEANFILES = qa_*.log diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test index 1e1c70a77..6dc1a9658 100755 --- a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test +++ b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test @@ -1,4 +1,4 @@ -#!../libguile/guile \ +#!/usr/bin/guile \ -e main -s !# @@ -77,11 +77,11 @@ ;;;; the #! line at the top of this file, which is stupid. (define (main . args) - (let ((module (resolve-module '(test-suite guile-test)))) + (let ((module (resolve-module '(gnuradio test-suite guile-test)))) (apply (module-ref module 'main) args))) -(define-module (test-suite guile-test) - :use-module (test-suite lib) +(define-module (gnuradio test-suite guile-test) + :use-module (gnuradio test-suite lib) :use-module (ice-9 getopt-long) :use-module (ice-9 and-let-star) :use-module (ice-9 rdelim) diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm index c4ddf9e7c..272fe2f10 100644 --- a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm +++ b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm @@ -16,7 +16,7 @@ ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;;;; Boston, MA 02110-1301 USA -(define-module (test-suite lib) +(define-module (gnuradio test-suite lib) :use-module (ice-9 stack-catch) :use-module (ice-9 regex) :export ( -- cgit