diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-30 10:54:44 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-30 10:54:44 +0200 |
commit | 44fb055cf47a3a54cce0d746af23955753284422 (patch) | |
tree | 63c91a02937b094fb122caa59399e7f1e95a8ae5 /test/test_jpeg.cc | |
parent | 7fc1b8f300b2ce2e7f8bd573f02b8650213c2be9 (diff) |
Modify unit tests to match API change.
Diffstat (limited to 'test/test_jpeg.cc')
-rw-r--r-- | test/test_jpeg.cc | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/test/test_jpeg.cc b/test/test_jpeg.cc index 894ae3a..ca6e80b 100644 --- a/test/test_jpeg.cc +++ b/test/test_jpeg.cc @@ -53,8 +53,10 @@ public: unsigned int csrc = 42; { // Encode - struct lrtp_t *lrtp = lrtp_init(KEY, SSRC); - + lrtp_status_t status; + struct lrtp_t *lrtp = lrtp_init(&status, KEY, SSRC); + CPPUNIT_ASSERT_EQUAL(status, LRTP_OK); + int x = lrtp_create_profile(lrtp, PROFILE_JPEG, csrc, OPTION_END); CPPUNIT_ASSERT_EQUAL(0, x); @@ -71,30 +73,33 @@ public: FILE *fp = fopen(filename, "r"); CPPUNIT_ASSERT(fp); - fseek(fp, 0, SEEK_END); + CPPUNIT_ASSERT(fseek(fp, 0, SEEK_END) != -1); int imagesize = ftell(fp); - fseek(fp, 0, SEEK_SET); + CPPUNIT_ASSERT(fseek(fp, 0, SEEK_SET) != -1); char *image = (char*)malloc(imagesize); - fread(image, imagesize, 1, fp); + CPPUNIT_ASSERT(fread(image, 1, imagesize, fp) == (size_t)imagesize); fclose(fp); int ret = 0; - ret = lrtp_enqueue_frame(lrtp, csrc, image, imagesize, n); + ret = lrtp_enqueue_frame(lrtp, csrc, image, imagesize, n, LRTP_COPY); CPPUNIT_ASSERT_EQUAL(0, ret); - while( (ret = lrtp_pack(lrtp, packet, sizeof(packet))) != 0) { + while( (ret = lrtp_pack(lrtp, packet, sizeof(packet))) > 0) { std::string p; p.append(packet, ret); packets.push_back(p); //dump("pkg", packet, ret); } + CPPUNIT_ASSERT_EQUAL(ret, 0); free(image); } - lrtp_destroy_profile(lrtp, csrc); + status = lrtp_destroy_profile(lrtp, csrc); + CPPUNIT_ASSERT_EQUAL(status, LRTP_OK); - lrtp_close(lrtp); + status = lrtp_close(lrtp); + CPPUNIT_ASSERT_EQUAL(status, LRTP_OK); } //printf("\nPackets: %d\n", packets.size()); @@ -105,7 +110,9 @@ public: // Write SIO and JFIF from original image: // fwrite(image, 2 + 16, 1, fp); - struct lrtp_t *lrtp = lrtp_init(KEY, SSRC); + lrtp_status_t status; + struct lrtp_t *lrtp = lrtp_init(&status, KEY, SSRC); + CPPUNIT_ASSERT_EQUAL(status, LRTP_OK); int x = lrtp_create_profile(lrtp, PROFILE_JPEG, csrc, OPTION_END); @@ -149,8 +156,11 @@ public: // CPPUNIT_ASSERT_EQUAL((int)imagesize, num); - lrtp_destroy_profile(lrtp, csrc); - lrtp_close(lrtp); + status = lrtp_destroy_profile(lrtp, csrc); + CPPUNIT_ASSERT_EQUAL(status, LRTP_OK); + + status = lrtp_close(lrtp); + CPPUNIT_ASSERT_EQUAL(status, LRTP_OK); //fclose(fp); } |