diff options
author | Rob Savoye | 2010-11-26 11:22:54 -0700 |
---|---|---|
committer | Rob Savoye | 2010-11-26 11:22:54 -0700 |
commit | 9039bed758fc3e3513ca96a33e6fe130b5d976a2 (patch) | |
tree | fecd6092f2bda88bb3abd16c363801bb3aa2a288 /gr-run-waveform | |
parent | 922bc95950787d74265cc68e572dba331753f6b2 (diff) | |
download | gnuradio-9039bed758fc3e3513ca96a33e6fe130b5d976a2.tar.gz gnuradio-9039bed758fc3e3513ca96a33e6fe130b5d976a2.tar.bz2 gnuradio-9039bed758fc3e3513ca96a33e6fe130b5d976a2.zip |
test string conversion static method.
Diffstat (limited to 'gr-run-waveform')
-rw-r--r-- | gr-run-waveform/test_xyzzy.cc | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/gr-run-waveform/test_xyzzy.cc b/gr-run-waveform/test_xyzzy.cc index b629e20f6..efd76b6cb 100644 --- a/gr-run-waveform/test_xyzzy.cc +++ b/gr-run-waveform/test_xyzzy.cc @@ -26,6 +26,7 @@ #include <iostream> #include <fstream> #include <libguile.h> +#include <boost/cstdint.hpp> // Include our definitions #include "xyzzy.h" @@ -35,16 +36,46 @@ using namespace std; int main(int argc, char *argv[]) { + // Test static methods + string hello("Hello World!"); + boost::uint8_t *hi = reinterpret_cast<boost::uint8_t *>(const_cast<char *> + (hello.c_str())); + struct string_entry entry = { + 12, + hi + }; + if (XYZZY::read_string(entry) == hello) { + cout << "PASSED: XYZZY::read_string(struct string_entry &)" << endl; + } else { + cout << "FAILED: XYZZY::read_string(struct string_entry &)" << endl; + } + + if (XYZZY::read_string(hi, hello.size()) == hello) { + cout << "PASSED: XYZZY::read_string(struct string_entry &)" << endl; + } else { + cout << "FAILED: XYZZY::read_string(struct string_entry &)" << endl; + } + + // Test other methods + XYZZY xyzzy; + + if (xyzzy.init()) { + cout << "PASSED: XYZZY::init()" << endl; + } else { + cout << "FAILED: XYZZY::init()" << endl; + } + + // Initialize with the data file produced by gen-xyzzy. -// bool init() -// bool init(const std::string &file) +// xyzzy_init(); +// bool xyzzy_init(const std::string &file) // Does a file with name 'filename' exist in magic filesystem? -// bool file_exists(handle, const std::string &filespec); +// bool xyzzy_file_exists(handle, const std::string &filespec); // bool file_exists(const std::string &filespec) // Return a C port that will read the file contents // SCM make_read_only_port(handle, const std::string &filespec) -// SCM make_read_only_port(const std::string &filespec) +// SCM xyzzy_make_read_only_port(const std::string &filespec) } |