diff options
Diffstat (limited to 'test/test_init.cc')
-rw-r--r-- | test/test_init.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/test/test_init.cc b/test/test_init.cc index 97ecd30..3281183 100644 --- a/test/test_init.cc +++ b/test/test_init.cc @@ -25,6 +25,8 @@ * License along with lrtp; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <cppunit/extensions/HelperMacros.h> + #include <lrtp.h> #include <stdio.h> @@ -32,32 +34,34 @@ #define KEY "123456789012345678901234567890123456789012345678901234567890" #define SSRC 1234567890 -void dump(const char *title, const char *buf, size_t size) -{ - printf("%12s: ", title); - for(int i = 0; i < size; i++) { - if(i % 8 == 0) printf(" "); - printf("%02x ", (unsigned char)*buf++); - } - printf("\n"); -} - -int main() +class test_init_class : public CppUnit::TestFixture { - char frame[] = "foo"; + CPPUNIT_TEST_SUITE(test_init_class); + CPPUNIT_TEST(test_init); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp() {} + void tearDown() {} + + void test_init() { + struct lrtp_t *lrtp = lrtp_init(KEY, SSRC); - struct lrtp_t *lrtp = lrtp_init(KEY, SSRC); + CPPUNIT_ASSERT(lrtp); - unsigned int csrc = 42; - struct lrtp_profile_t *profile = - lrtp_create_profile(lrtp, PROFILE_RAW, csrc, - OPTION_RAW_PKG_SIZE, sizeof(frame), - OPTION_END); + unsigned int csrc = 42; + struct lrtp_profile_t *profile = + lrtp_create_profile(lrtp, PROFILE_RAW, csrc, + OPTION_RAW_PKG_SIZE, 100, + OPTION_END); - lrtp_destroy_profile(lrtp, csrc); + CPPUNIT_ASSERT(profile); - lrtp_close(lrtp); + lrtp_destroy_profile(lrtp, csrc); - return 0; -} + lrtp_close(lrtp); + } +}; +// Registers the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION(test_init_class); |