• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂513 (tree)
時間2012-06-29 00:23:28
作者ornse01

Log Message

add testcase for TR_CONT.
and fix bug.

Change Summary

差異

--- bchanf/trunk/src/tad/test_traydata_iterator.c (revision 512)
+++ bchanf/trunk/src/tad/test_traydata_iterator.c (revision 513)
@@ -353,6 +353,37 @@
353353 return test_traydata_iterator_common(rec, len, expected, expected_len);
354354 }
355355
356+LOCAL UNITTEST_RESULT test_traydata_7()
357+{
358+ TRAYREC rec[] = {
359+ {TS_INFO, 6, testdata_infoseg},
360+ {TS_TEXT|TR_CONT, 10, testdata_textseg},
361+ {TS_TEXT, 24-10, testdata_textseg+10},
362+ {TR_VOBJ, sizeof(testdata_vobjrec), (UB*)&testdata_vobjrec},
363+ {TR_TEXT, sizeof(testdata_text), (UB*)testdata_text},
364+ };
365+ W len = sizeof(rec)/sizeof(TRAYREC);
366+ test_traydata_iterator_expected_t *expected = test_traydata_expected02;
367+ W expected_len = sizeof(test_traydata_expected02)/sizeof(test_traydata_iterator_expected_t);
368+ return test_traydata_iterator_common(rec, len, expected, expected_len);
369+}
370+
371+LOCAL UNITTEST_RESULT test_traydata_8()
372+{
373+ TRAYREC rec[] = {
374+ {TS_INFO, 6, testdata_infoseg},
375+ {TS_TEXT|TR_CONT, 10, testdata_textseg},
376+ {TS_TEXT|TR_CONT, 10, testdata_textseg+10},
377+ {TS_TEXT, 24-20, testdata_textseg+20},
378+ {TR_VOBJ, sizeof(testdata_vobjrec), (UB*)&testdata_vobjrec},
379+ {TR_TEXT, sizeof(testdata_text), (UB*)testdata_text},
380+ };
381+ W len = sizeof(rec)/sizeof(TRAYREC);
382+ test_traydata_iterator_expected_t *expected = test_traydata_expected02;
383+ W expected_len = sizeof(test_traydata_expected02)/sizeof(test_traydata_iterator_expected_t);
384+ return test_traydata_iterator_common(rec, len, expected, expected_len);
385+}
386+
356387 EXPORT VOID test_traydata_iterator_main(unittest_driver_t *driver)
357388 {
358389 UNITTEST_DRIVER_REGIST(driver, test_traydata_1);
@@ -361,4 +392,6 @@
361392 UNITTEST_DRIVER_REGIST(driver, test_traydata_4);
362393 UNITTEST_DRIVER_REGIST(driver, test_traydata_5);
363394 UNITTEST_DRIVER_REGIST(driver, test_traydata_6);
395+ UNITTEST_DRIVER_REGIST(driver, test_traydata_7);
396+ UNITTEST_DRIVER_REGIST(driver, test_traydata_8);
364397 }
--- bchanf/trunk/src/tad/traydata_iterator.c (revision 512)
+++ bchanf/trunk/src/tad/traydata_iterator.c (revision 513)
@@ -77,6 +77,7 @@
7777 break;
7878 } else if ((rec->id & TR_CONT) != 0) {
7979 iterator->state = TRAYDATA_ITERATOR_STATE_REC_DEVIDE;
80+ iterator->status.devide.id = rec->id & (~TR_CONT);
8081 result->type = TRAYDATA_ITERATOR_RESULTTYPE_VARIABLE_SEGMENT_CONT;
8182 result->val.seg.id = rec->id;
8283 result->val.seg.seglen = rec->len;
@@ -227,6 +228,7 @@
227228 case TRAYDATA_ITERATOR_STATE_REC_DEVIDE:
228229 DP_STATE("TRAYDATA_ITERATOR_STATE_REC_DEVIDE");
229230 if (rec->id == iterator->status.devide.id) {
231+ iterator->state = TRAYDATA_ITERATOR_STATE_REC_START;
230232 result->type = TRAYDATA_ITERATOR_RESULTTYPE_VARIABLE_SEGMENT;
231233 } else {
232234 result->type = TRAYDATA_ITERATOR_RESULTTYPE_VARIABLE_SEGMENT_CONT;
@@ -235,7 +237,7 @@
235237 result->val.seg.seglen = -1; /* TODO */
236238 result->val.seg.chunk_data = rec->dt;
237239 result->val.seg.chunk_data_len = rec->len;
238- ret = 1;
240+ ret = 2;
239241 break;
240242 }
241243
Show on old repository browser