X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Ftad%2Ftest_tadstack.c;h=5bf519a31fff8e9e690a18ffa7548e01d7c6f8a9;hb=654ddfc5e1dd34274d80c076dc9b806aeee9ea26;hp=f65662cf95b6db00e97c1e4663061d6adcb296ce;hpb=8500f74cb1a56744ef7e324d82f2b5ab4288a787;p=bbk%2Fbchanf.git diff --git a/src/tad/test_tadstack.c b/src/tad/test_tadstack.c index f65662c..5bf519a 100644 --- a/src/tad/test_tadstack.c +++ b/src/tad/test_tadstack.c @@ -1,7 +1,7 @@ /* * test_tadstack.c * - * Copyright (c) 2012 project bchan + * Copyright (c) 2012-2014 project bchan * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -34,6 +34,7 @@ #include #include "taditerator.h" +#include "taddecoder.h" #include @@ -111,7 +112,39 @@ LOCAL UNITTEST_RESULT test_tadstack_1() return ok; } +LOCAL UNITTEST_RESULT test_tadstack_2() +{ + tadstack_t stack; + taddecoder_t decoder; + tadsegment segment; + Bool cont; + TADSTACK_RESULT stk_result; + UNITTEST_RESULT ok = UNITTEST_RESULT_PASS; + + tadstack_initialize(&stack); + taddecoder_initialize(&decoder, (TC*)test_tadstack_testdata01, sizeof(test_tadstack_testdata01)/sizeof(TC)); + + for (;;) { + cont = taddecoder_next(&decoder, &segment); + if (cont == False) { + break; + } + + stk_result = tadstack_inputsegment(&stack, &segment); + if (stk_result == TADSTACK_RESULT_FORMAT_ERROR) { + printf("format error\n"); + ok = UNITTEST_RESULT_FAIL; + } + } + + taddecoder_finalize(&decoder); + tadstack_finalize(&stack); + + return ok; +} + EXPORT VOID test_tadstack_main(unittest_driver_t *driver) { UNITTEST_DRIVER_REGIST(driver, test_tadstack_1); + UNITTEST_DRIVER_REGIST(driver, test_tadstack_2); }