diff options
author | Rob Savoye | 2010-11-29 10:54:54 -0700 |
---|---|---|
committer | Rob Savoye | 2010-11-29 10:54:54 -0700 |
commit | 81e4bc16b1ce173e7dbdd2c532b45aacc37d09cb (patch) | |
tree | b7382ffa9ef474670eec452599304ff5f713a580 | |
parent | 47c2db981d40efc79b88dba94e29b25b50a45923 (diff) | |
download | gnuradio-81e4bc16b1ce173e7dbdd2c532b45aacc37d09cb.tar.gz gnuradio-81e4bc16b1ce173e7dbdd2c532b45aacc37d09cb.tar.bz2 gnuradio-81e4bc16b1ce173e7dbdd2c532b45aacc37d09cb.zip |
add more tests for the port
-rw-r--r-- | gr-run-waveform/test_xyzzy.cc | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/gr-run-waveform/test_xyzzy.cc b/gr-run-waveform/test_xyzzy.cc index c8c91a7a5..fd4c49a38 100644 --- a/gr-run-waveform/test_xyzzy.cc +++ b/gr-run-waveform/test_xyzzy.cc @@ -89,16 +89,42 @@ inner_main (void *data, int argc, char **argv) fprintf(stderr, "FAILED: xyzzy-search-path path-with-xyzzy\n" ); } - + // This test loads a scheme test case that defines a 'cat' function to + // spew the contents of the file from our fake file system. file = srcdir; file += "/guile/cat.scm"; if (scm_is_true(scm_c_primitive_load (file.c_str()))) { fprintf(stderr, "PASSED: loading cat.scm\n"); } else { fprintf(stderr, "FAILED: loading cat.scm\n" ); - } + } + // It tacky, but the test case defines the name of this input + // port as 'foo'. So make sure that's what we got... s_symbol = scm_c_lookup("foo"); - SCM result = scm_input_port_p (s_symbol); + s_value = scm_variable_ref(s_symbol); + SCM result = scm_input_port_p (s_value); + if (scm_is_true(result)) { + fprintf(stderr, "PASSED: make-gnuradio-port()\n"); + } else { + fprintf(stderr, "FAILED: make-gnuradio-port()\n" ); + } + + if (scm_char_ready_p (s_value)) { + fprintf(stderr, "PASSED: scm_char_ready_p()\n"); + } else { + fprintf(stderr, "FAILED: scm_char_ready_p()\n" ); + } + + char *bar[20]; + int ret = scm_c_read(s_value, bar, 10); + + if (ret) { + fprintf(stderr, "PASSED: read from port\n"); + } else { + fprintf(stderr, "FAILED: read from port\n" ); + } + + result = scm_output_port_p (s_value); if (scm_is_true(result)) { fprintf(stderr, "FAILED: make-gnuradio-port()\n"); } else { |