From 774e2789774dcb35f7e9e4cfa41632e13e2ac09e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 4 Dec 2013 14:04:33 +0100 Subject: Modernise autotools files. Convert all tests to cppunit. --- test/test_init.cc | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'test/test_init.cc') 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 + #include #include @@ -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); -- cgit v1.2.3