Home | History | Annotate | Download | only in test
      1 /*
      2  * Copyright (C) 2007 Esmertec AG.
      3  * Copyright (C) 2007 The Android Open Source Project
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 #include <embUnit.h>
     19 #include <stdlib.h>
     20 #include <string.h>
     21 #include "wbxml_parser.h"
     22 
     23 #define DEFINE_TEST(test)   \
     24     new_TestFixture(#test, test)
     25 
     26 #define ASSERT_EQUAL_INT(expected, actual) \
     27 {   \
     28     int tmp = actual;   /* avoid duplicated evaluation in TEST_ASSERT_EQUAL_INT */  \
     29     TEST_ASSERT_EQUAL_INT(expected, tmp);   \
     30 }
     31 
     32 /*
     33 <?xml version="1.0" encoding="UTF-8" ?>
     34 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1"></WV-CSP-Message>
     35  */
     36 static const char simple_wbxml[] = {
     37     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01, 0x01
     38 };
     39 
     40 /*
     41 <?xml version="1.0" encoding="UTF-8" ?>
     42 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1" />
     43  */
     44 static const char simple_nocontent_wbxml[] = {
     45       0x03, 0x10, 0x6a, 0x00, 0x89, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01
     46 };
     47 
     48 /*
     49 <?xml version="1.0" encoding="UTF-8" ?>
     50 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1">
     51     <Session></Session>
     52 </WV-CSP-Message>
     53 */
     54 static const char simple2_wbxml[] = {
     55     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01,
     56     0x6d, 0x01, 0x01
     57 };
     58 
     59 /*
     60 <?xml version="1.0" encoding="UTF-8" ?>
     61 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1">
     62     <Session>
     63         <SessionDescriptor>
     64             <SessionType>Outband</SessionType>
     65         </SessionDescriptor>
     66     </Session>
     67 </WV-CSP-Message>
     68 */
     69 static const char simple3_wbxml[] = {
     70     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01,
     71     0x6d, 0x6e, 0x70, 0x80, 0x19, 0x01, 0x01, 0x01, 0x01
     72 };
     73 
     74 /* A STR_I (the '0x03' after '0x70') without ending '\0' */
     75 static const char incomplete_str_i_wbxml[] = {
     76     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01,
     77     0x6d, 0x6e, 0x70, 0x03, 0x44, 0x55, 0x66, 0x01, 0x01, 0x01, 0x01
     78 };
     79 
     80 /*
     81 <?xml version="1.0" encoding="UTF-8" ?>
     82 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1">
     83     <Session>
     84         <SessionDescriptor>
     85             <SessionType>&#1114111</SessionType>
     86         </SessionDescriptor>
     87     </Session>
     88 </WV-CSP-Message>
     89 */
     90 /* &#1114111 = U+10ffff = mb_u_int32 C3 ff 7f */
     91 static const char big_entity_wbxml[] = {
     92     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01,
     93     0x6d, 0x6e, 0x70, 0x02, 0xc3, 0xff, 0x7f, 0x01, 0x01, 0x01, 0x01
     94 };
     95 
     96 /*
     97 <?xml version="1.0" encoding="UTF-8" ?>
     98 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1">
     99     <Session>
    100         <SessionDescriptor>
    101             <SessionType>&#1114112</SessionType>
    102         </SessionDescriptor>
    103     </Session>
    104 </WV-CSP-Message>
    105 */
    106 /* &#1114112 = 0x110000 = mb_u_int32 C4 80 00 */
    107 static const char invalid_entity_wbxml[] = {
    108     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01,
    109     0x6d, 0x6e, 0x70, 0x02, 0xc4, 0x80, 0x00, 0x01, 0x01, 0x01, 0x01
    110 };
    111 
    112 /*
    113 <?xml version="1.0" encoding="UTF-8" ?>
    114 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1">
    115     <Session>
    116         <SessionDescriptor>
    117             <SessionType>Outband</SessionType>
    118         </SessionDescriptor>
    119         <Transaction>
    120             <TransactionDescriptor>
    121                 <TransactionMode>Response</TransactionMode>
    122                 <TransactionID>transId1</TransactionID>
    123             </TransactionDescriptor>
    124             <TransactionContent xmlns="http://www.wireless-village.org/TRC1.1">
    125                 <Login-Response>
    126                     <ClientID>Esmertec112233</ClientID>
    127                     <Result>
    128                         <Code>401</Code>
    129                         <Description>Please complete authentication challenge</Description>
    130                     </Result>
    131                     <Nonce>e6b68ebd81309d538357e39e2fba3204</Nonce>
    132                     <DigestSchema>MD5</DigestSchema>
    133                     <CapabilityRequest>F</CapabilityRequest>
    134                 </Login-Response>
    135             </TransactionContent>
    136         </Transaction>
    137     </Session>
    138 </WV-CSP-Message>
    139 */
    140 static const char loginresponse_wbxml[] = {
    141     0x03, 0x10, 0x6a, 0x00, 0xc9, 0x05, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01,
    142     0x6d, 0x6e, 0x70, 0x80, 0x19, 0x01, 0x01, 0x72, 0x74, 0x76, 0x80, 0x21,
    143     0x01, 0x75, 0x03, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x64, 0x31, 0x00,
    144     0x01, 0x01, 0xf3, 0x07, 0x03, 0x31, 0x2e, 0x31, 0x00, 0x01, 0x00, 0x01,
    145     0x5e, 0x00, 0x00, 0x4a, 0x03, 0x45, 0x73, 0x6d, 0x65, 0x72, 0x74, 0x65,
    146     0x63, 0x31, 0x31, 0x32, 0x32, 0x33, 0x33, 0x00, 0x01, 0x6a, 0x4b, 0x03,
    147     0x34, 0x30, 0x31, 0x00, 0x01, 0x52, 0x03, 0x50, 0x6c, 0x65, 0x61, 0x73,
    148     0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x61,
    149     0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
    150     0x6e, 0x20, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x00,
    151     0x01, 0x01, 0x00, 0x01, 0x60, 0x03, 0x65, 0x36, 0x62, 0x36, 0x38, 0x65,
    152     0x62, 0x64, 0x38, 0x31, 0x33, 0x30, 0x39, 0x64, 0x35, 0x33, 0x38, 0x33,
    153     0x35, 0x37, 0x65, 0x33, 0x39, 0x65, 0x32, 0x66, 0x62, 0x61, 0x33, 0x32,
    154     0x30, 0x34, 0x00, 0x01, 0x4f, 0x03, 0x4d, 0x44, 0x35, 0x00, 0x01, 0x4b,
    155     0x80, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
    156 };
    157 
    158 /*
    159 <?xml version="1.0" encoding="UTF-8" ?>
    160 <WV-CSP-Message xmlns="http://www.openmobilealliance.org/DTD/IMPS-CSP1.3">
    161  <Session>
    162   <SessionDescriptor>
    163    <SessionType>Inband</SessionType>
    164    <SessionID>im.user.com#48815 (at) server.com</SessionID>
    165   </SessionDescriptor>
    166   <Transaction>
    167    <TransactionDescriptor>
    168     <TransactionMode>Response</TransactionMode>
    169     <TransactionID>IMApp01#12345@NOK5110</TransactionID>
    170    </TransactionDescriptor>
    171    <TransactionContent xmlns="http://www.openmobilealliance.org/DTD/IMPS-TRC1.3">
    172     <Status>
    173      <Result>
    174       <Code>201</Code>
    175       <Description>Partially successful.</Description>
    176       <DetailedResult>
    177        <Code>531</Code>
    178        <Description>Unknown user.</Description>
    179        <UserID>wv:bad_user1 (at) im.com</UserID>
    180        <UserID>wv:bad_user2 (at) im.com</UserID>
    181       </DetailedResult>
    182       <DetailedResult>
    183        <Code>532</Code>
    184        <Description>Blocked.</Description>
    185        <UserID>wv:bad_user3 (at) im.com</UserID>
    186        <UserID>wv:bad_user4 (at) im.com</UserID>
    187       </DetailedResult>
    188      </Result>
    189     </Status>
    190    </TransactionContent>
    191   </Transaction>
    192   <Poll>F</Poll>
    193  </Session>
    194 </WV-CSP-Message>
    195 */
    196 static const char statusprim_wbxml[] = {
    197   0x03, 0x12, 0x6a, 0x00, 0xc9, 0x0b, 0x03, 0x31, 0x2e, 0x33, 0x00, 0x01,
    198   0x6d, 0x6e, 0x70, 0x80, 0x11, 0x01, 0x6f, 0x03, 0x69, 0x6d, 0x2e, 0x75,
    199   0x73, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x23, 0x34, 0x38, 0x38, 0x31,
    200   0x35, 0x40, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
    201   0x00, 0x01, 0x01, 0x72, 0x74, 0x76, 0x80, 0x21, 0x01, 0x75, 0x03, 0x49,
    202   0x4d, 0x41, 0x70, 0x70, 0x30, 0x31, 0x23, 0x31, 0x32, 0x33, 0x34, 0x35,
    203   0x40, 0x4e, 0x4f, 0x4b, 0x35, 0x31, 0x31, 0x30, 0x00, 0x01, 0x01, 0xf3,
    204   0x0d, 0x03, 0x31, 0x2e, 0x33, 0x00, 0x01, 0x71, 0x6a, 0x4b, 0xc3, 0x01,
    205   0xc9, 0x01, 0x52, 0x03, 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x6c,
    206   0x79, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c,
    207   0x2e, 0x00, 0x01, 0x53, 0x4b, 0xc3, 0x02, 0x02, 0x13, 0x01, 0x52, 0x03,
    208   0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72,
    209   0x2e, 0x00, 0x01, 0x7a, 0x03, 0x77, 0x76, 0x3a, 0x62, 0x61, 0x64, 0x5f,
    210   0x75, 0x73, 0x65, 0x72, 0x31, 0x40, 0x69, 0x6d, 0x2e, 0x63, 0x6f, 0x6d,
    211   0x00, 0x01, 0x7a, 0x03, 0x77, 0x76, 0x3a, 0x62, 0x61, 0x64, 0x5f, 0x75,
    212   0x73, 0x65, 0x72, 0x32, 0x40, 0x69, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x00,
    213   0x01, 0x01, 0x53, 0x4b, 0xc3, 0x02, 0x02, 0x14, 0x01, 0x52, 0x03, 0x42,
    214   0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x2e, 0x00, 0x01, 0x7a, 0x03, 0x77,
    215   0x76, 0x3a, 0x62, 0x61, 0x64, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x33, 0x40,
    216   0x69, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x01, 0x7a, 0x03, 0x77, 0x76,
    217   0x3a, 0x62, 0x61, 0x64, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x34, 0x40, 0x69,
    218   0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    219   0x61, 0x80, 0x0b, 0x01, 0x01, 0x01,
    220 };
    221 
    222 /*
    223 <?xml version="1.0" encoding="UTF-8" ?>
    224 <WV-CSP-Message xmlns="http://www.openmobilealliance.org/DTD/WV-CSP1.2">
    225     <Session>
    226         <SessionDescriptor>
    227             <SessionType>Inband</SessionType>
    228             <SessionID>AA0BD762.00000000.test1</SessionID>
    229         </SessionDescriptor>
    230         <Transaction>
    231             <TransactionDescriptor>
    232                 <TransactionMode>Request</TransactionMode>
    233                 <TransactionID>transId8</TransactionID>
    234             </TransactionDescriptor>
    235             <TransactionContent xmlns="http://www.openmobilealliance.org/DTD/WV-TRC1.2">
    236                 <SendMessage-Request>
    237                     <DeliveryReport>T</DeliveryReport>
    238                     <MessageInfo>
    239                         <Recipient>
    240                             <User>
    241                                 <UserID>wv:test2</UserID>
    242                             </User>
    243                         </Recipient>
    244                         <Sender>
    245                             <User>
    246                                 <UserID>wv:test1</UserID>
    247                             </User>
    248                         </Sender>
    249                         <DateTime>20070625T055652Z</DateTime>
    250                         <ContentSize>5</ContentSize>
    251                     </MessageInfo>
    252                     <ContentData>Today &#160;Today</ContentData>
    253                 </SendMessage-Request>
    254             </TransactionContent>
    255         </Transaction>
    256     </Session>
    257 </WV-CSP-Message>
    258 */
    259 static const char sendmsgreq1_wbxml[] = {
    260   0x03, 0x10, 0x6a, 0x00, 0xc9, 0x08, 0x03, 0x31, 0x2e, 0x32, 0x00, 0x01,
    261   0x6d, 0x6e, 0x70, 0x80, 0x11, 0x01, 0x6f, 0x03, 0x41, 0x41, 0x30, 0x42,
    262   0x44, 0x37, 0x36, 0x32, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
    263   0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x31, 0x00, 0x01, 0x01, 0x72, 0x74,
    264   0x76, 0x80, 0x20, 0x01, 0x75, 0x03, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x49,
    265   0x64, 0x38, 0x00, 0x01, 0x01, 0xf3, 0x0a, 0x03, 0x31, 0x2e, 0x32, 0x00,
    266   0x01, 0x00, 0x06, 0x57, 0x48, 0x80, 0x2c, 0x01, 0x53, 0x00, 0x00, 0x67,
    267   0x79, 0x7a, 0x03, 0x77, 0x76, 0x3a, 0x74, 0x65, 0x73, 0x74, 0x32, 0x00,
    268   0x01, 0x01, 0x01, 0x6c, 0x79, 0x7a, 0x03, 0x77, 0x76, 0x3a, 0x74, 0x65,
    269   0x73, 0x74, 0x31, 0x00, 0x01, 0x01, 0x01, 0x51, 0x03, 0x32, 0x30, 0x30,
    270   0x37, 0x30, 0x36, 0x32, 0x35, 0x54, 0x30, 0x35, 0x35, 0x36, 0x35, 0x32,
    271   0x5a, 0x00, 0x01, 0x4f, 0xc3, 0x01, 0x05, 0x01, 0x01, 0x4d, 0x03, 0x54,
    272   0x6f, 0x64, 0x61, 0x79, 0x20, 0x00, 0x02, 0x81, 0x20, 0x03, 0x54, 0x6f,
    273   0x64, 0x61, 0x79, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
    274 };
    275 
    276 /*
    277 <?xml version="1.0" encoding="UTF-8" ?>
    278 <WV-CSP-Message xmlns="http://www.openmobilealliance.org/DTD/WV-CSP1.2">
    279     <Session>
    280         <SessionDescriptor>
    281             <SessionType>Inband</SessionType>
    282             <SessionID>196FE717.00000000.test1</SessionID>
    283         </SessionDescriptor>
    284         <Transaction>
    285             <TransactionDescriptor>
    286                 <TransactionMode>Request</TransactionMode>
    287                 <TransactionID>transId2</TransactionID>
    288             </TransactionDescriptor>
    289             <TransactionContent xmlns="http://www.openmobilealliance.org/DTD/WV-TRC1.2">
    290                 <ClientCapability-Request>
    291                     <CapabilityList>
    292                         <ClientType>MOBILE_PHONE</ClientType>
    293                         <ParserSize>32767</ParserSize>
    294                         <MultiTrans>1</MultiTrans>
    295                         <InitialDeliveryMethod>P</InitialDeliveryMethod>
    296                         <ServerPollMin>2</ServerPollMin>
    297                         <SupportedBearer>HTTP</SupportedBearer>
    298                         <SupportedCIRMethod>STCP</SupportedCIRMethod>
    299                         <SupportedCIRMethod>SHTTP</SupportedCIRMethod>
    300                         <SupportedCIRMethod>SSMS</SupportedCIRMethod>
    301                     </CapabilityList>
    302                 </ClientCapability-Request>
    303             </TransactionContent>
    304         </Transaction>
    305     </Session>
    306 </WV-CSP-Message>
    307 */
    308 static const char cap_request_wbxml[] = {
    309     0x03, 0x11, 0x6a, 0x00, 0xc9, 0x08, 0x03, 0x31, 0x2e, 0x32, 0x00, 0x01,
    310     0x6d, 0x6e, 0x70, 0x80, 0x11, 0x01, 0x6f, 0x03, 0x31, 0x39, 0x36, 0x46,
    311     0x45, 0x37, 0x31, 0x37, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
    312     0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x31, 0x00, 0x01, 0x01, 0x72, 0x74,
    313     0x76, 0x80, 0x20, 0x01, 0x75, 0x03, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x49,
    314     0x64, 0x32, 0x00, 0x01, 0x01, 0xf3, 0x0a, 0x03, 0x31, 0x2e, 0x32, 0x00,
    315     0x01, 0x00, 0x01, 0x4c, 0x4a, 0x00, 0x05, 0x4f, 0x80, 0x6f, 0x01, 0x00,
    316     0x03, 0x4d, 0xc3, 0x02, 0x7f, 0xff, 0x01, 0x4c, 0xc3, 0x01, 0x01, 0x01,
    317     0x4b, 0x80, 0x1f, 0x01, 0x4e, 0xc3, 0x01, 0x02, 0x01, 0x4f, 0x80, 0x42,
    318     0x01, 0x50, 0x80, 0x44, 0x01, 0x50, 0x80, 0x81, 0x25, 0x01, 0x50, 0x80,
    319     0x81, 0x24, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    320 };
    321 
    322 /*
    323 <?xml version="1.0" encoding="UTF-8" ?>
    324 <WV-CSP-Message xmlns="http://www.wireless-village.org/CSP1.1">
    325     <sometag>
    326         <Session>
    327             <someMoreTag/>
    328         </Session>
    329     </sometag>
    330     <metag attr="sometag"/>
    331     <tag movie="transformer"></tag>
    332 </WV-CSP-Message>
    333 */
    334 static const char literal_wbxml[] = {
    335   0x03, 0x10, 0x6a, 0x29, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x61, 0x67, 0x00,
    336   0x73, 0x6f, 0x6d, 0x65, 0x4d, 0x6f, 0x72, 0x65, 0x54, 0x61, 0x67, 0x00,
    337   0x6d, 0x65, 0x74, 0x61, 0x67, 0x00, 0x61, 0x74, 0x74, 0x72, 0x00, 0x74,
    338   0x61, 0x67, 0x00, 0x6d, 0x6f, 0x76, 0x69, 0x65, 0x00, 0xc9, 0x05, 0x03,
    339   0x31, 0x2e, 0x31, 0x00, 0x01, 0x44, 0x00, 0x6d, 0x04, 0x08, 0x01, 0x01,
    340   0x84, 0x14, 0x04, 0x1a, 0x83, 0x00, 0x01, 0x84, 0x1f, 0x04, 0x23, 0x03,
    341   0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x00,
    342   0x01, 0x01
    343 };
    344 
    345 class SimpleTestHandler: public DefaultWbxmlContentHandler
    346 {
    347 public:
    348     void startElement(const char *name, const vector<Attribute> & attribs)
    349     {
    350         startElemName = name;
    351         this->attribs = attribs;
    352     }
    353     void endElement(const char *name)
    354     {
    355         endElemName = name;
    356     }
    357     string startElemName;
    358     string endElemName;
    359     vector<Attribute> attribs;
    360 };
    361 
    362 struct DomElement
    363 {
    364     DomElement()
    365     {
    366         intVal = 0;
    367     }
    368 
    369     string name;
    370     vector<Attribute> attribs;
    371     vector<DomElement> children;
    372     string characters;
    373     uint32_t intVal;
    374 };
    375 
    376 class DomTestHandler: public DefaultWbxmlContentHandler
    377 {
    378 public:
    379     DomTestHandler()
    380     {
    381         currentElement = NULL;
    382     }
    383 
    384     void startElement(const char *name, const vector<Attribute> & attribs)
    385     {
    386         if (!currentElement) {
    387             currentElement = &root;
    388             currentElement->name = name;
    389             currentElement->attribs = attribs;
    390         } else {
    391             DomElement child;
    392             child.name = name;
    393             child.attribs = attribs;
    394             currentElement->children.push_back(child);
    395             elemStack.push_back(currentElement);
    396             currentElement = &(currentElement->children.back());
    397         }
    398     }
    399 
    400     void endElement(const char *name)
    401     {
    402         TEST_ASSERT_EQUAL_STRING(name, currentElement->name.c_str());
    403         TEST_ASSERT((currentElement == &root) ? !elemStack.size() : elemStack.size() > 0);
    404         if (elemStack.size()) {
    405             currentElement = elemStack.back();
    406             elemStack.pop_back();
    407         }
    408     }
    409 
    410     void characters(const char * data, int len)
    411     {
    412         string s(data, len);
    413         currentElement->characters.append(data, len);
    414     }
    415 
    416     void opaque(const char * data, int len)
    417     {
    418         if (currentElement->name == "Code") {
    419             while (len--) {
    420                 currentElement->intVal <<= 8;
    421                 currentElement->intVal |= (unsigned char)*data;
    422                 data++;
    423             }
    424         }
    425     }
    426 
    427     DomElement root;
    428 
    429 private:
    430     vector<DomElement *> elemStack;
    431     DomElement *currentElement;
    432 };
    433 
    434 static void setUp(void)
    435 {
    436 }
    437 
    438 static void tearDown(void)
    439 {
    440 }
    441 
    442 static void testSimpleCspRet(void)
    443 {
    444     WbxmlParser parser(0);
    445     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple_wbxml,
    446                 sizeof(simple_wbxml), true));
    447 }
    448 
    449 static void testSimpleCspPublicId(void)
    450 {
    451     WbxmlParser parser(0);
    452     DefaultWbxmlContentHandler handler;
    453     parser.setContentHandler(&handler);
    454     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple_wbxml,
    455                 sizeof(simple_wbxml), true));
    456     TEST_ASSERT_EQUAL_INT(0x10 /* WV CSP 1.1 */, handler.getPublicId());
    457 }
    458 
    459 static void testSimpleCspStartElement(void)
    460 {
    461     WbxmlParser parser(0);
    462     SimpleTestHandler handler;
    463     parser.setContentHandler(&handler);
    464     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple_wbxml,
    465                 sizeof(simple_wbxml), true));
    466     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", handler.startElemName.c_str());
    467 }
    468 
    469 static void testSimpleCspStartElementAttr(void)
    470 {
    471     WbxmlParser parser(0);
    472     SimpleTestHandler handler;
    473     parser.setContentHandler(&handler);
    474     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple_wbxml,
    475                 sizeof(simple_wbxml), true));
    476     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", handler.startElemName.c_str());
    477     TEST_ASSERT_EQUAL_INT(1, handler.attribs.size());
    478     TEST_ASSERT_EQUAL_STRING("xmlns", handler.attribs[0].name.c_str());
    479     TEST_ASSERT_EQUAL_STRING("http://www.wireless-village.org/CSP1.1", handler.attribs[0].value.c_str());
    480 }
    481 
    482 static void testSimpleCspEndElement(void)
    483 {
    484     WbxmlParser parser(0);
    485     SimpleTestHandler handler;
    486     parser.setContentHandler(&handler);
    487     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple_wbxml,
    488                 sizeof(simple_wbxml), true));
    489     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", handler.endElemName.c_str());
    490 }
    491 
    492 static void testSimpleCspNoContentTag(void)
    493 {
    494     WbxmlParser parser(0);
    495     SimpleTestHandler handler;
    496     parser.setContentHandler(&handler);
    497     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple_nocontent_wbxml,
    498                 sizeof(simple_nocontent_wbxml), true));
    499     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", handler.startElemName.c_str());
    500     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", handler.endElemName.c_str());
    501     TEST_ASSERT_EQUAL_INT(1, handler.attribs.size());
    502     TEST_ASSERT_EQUAL_STRING("xmlns", handler.attribs[0].name.c_str());
    503     TEST_ASSERT_EQUAL_STRING("http://www.wireless-village.org/CSP1.1", handler.attribs[0].value.c_str());
    504 }
    505 
    506 static void testSimpleCspLevel2(void)
    507 {
    508     WbxmlParser parser(0);
    509     DomTestHandler handler;
    510     parser.setContentHandler(&handler);
    511     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple2_wbxml,
    512                 sizeof(simple2_wbxml), true));
    513     const DomElement &root = handler.root;
    514     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", root.name.c_str());
    515     TEST_ASSERT_EQUAL_INT(1, root.attribs.size());
    516     TEST_ASSERT_EQUAL_STRING("xmlns", root.attribs[0].name.c_str());
    517     TEST_ASSERT_EQUAL_STRING("http://www.wireless-village.org/CSP1.1", root.attribs[0].value.c_str());
    518 
    519     TEST_ASSERT_EQUAL_INT(1, root.children.size());
    520     const DomElement &elem = root.children[0];
    521     TEST_ASSERT_EQUAL_INT(0, elem.children.size());
    522     TEST_ASSERT_EQUAL_STRING("Session", elem.name.c_str());
    523     TEST_ASSERT_EQUAL_INT(0, elem.attribs.size());
    524 }
    525 
    526 static void testSimpleCspLevel3Characters(void)
    527 {
    528     WbxmlParser parser(0);
    529     DomTestHandler handler;
    530     parser.setContentHandler(&handler);
    531     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(simple3_wbxml,
    532                 sizeof(simple3_wbxml), true));
    533 
    534     const DomElement &root = handler.root;
    535     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", root.name.c_str());
    536     TEST_ASSERT_EQUAL_INT(1, root.attribs.size());
    537     TEST_ASSERT_EQUAL_STRING("xmlns", root.attribs[0].name.c_str());
    538     TEST_ASSERT_EQUAL_STRING("http://www.wireless-village.org/CSP1.1", root.attribs[0].value.c_str());
    539 
    540     TEST_ASSERT_EQUAL_INT(1, root.children.size());
    541     const DomElement &session = root.children[0];
    542     TEST_ASSERT_EQUAL_INT(1, session.children.size());
    543     TEST_ASSERT_EQUAL_STRING("Session", session.name.c_str());
    544     TEST_ASSERT_EQUAL_INT(0, session.attribs.size());
    545 
    546     const DomElement &sessionDesc = session.children[0];
    547     TEST_ASSERT_EQUAL_INT(1, sessionDesc.children.size());
    548     TEST_ASSERT_EQUAL_STRING("SessionDescriptor", sessionDesc.name.c_str());
    549     TEST_ASSERT_EQUAL_INT(0, sessionDesc.attribs.size());
    550 
    551     const DomElement &sessionType = sessionDesc.children[0];
    552     TEST_ASSERT_EQUAL_INT(0, sessionType.children.size());
    553     TEST_ASSERT_EQUAL_STRING("SessionType", sessionType.name.c_str());
    554     TEST_ASSERT_EQUAL_INT(0, sessionType.attribs.size());
    555     TEST_ASSERT_EQUAL_STRING("Outband", sessionType.characters.c_str());
    556 }
    557 
    558 /* String table, LITERAL* for tag, LITERAL for attribute, STR_T */
    559 static void testLiteralAndStrTable(void)
    560 {
    561     WbxmlParser parser(0);
    562     DomTestHandler handler;
    563     parser.setContentHandler(&handler);
    564     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(literal_wbxml,
    565                 sizeof(literal_wbxml), true));
    566     const DomElement &sometag = handler.root.children[0];
    567     TEST_ASSERT_EQUAL_STRING("sometag", sometag.name.c_str());
    568     TEST_ASSERT_EQUAL_INT(0, sometag.attribs.size());
    569     TEST_ASSERT_EQUAL_INT(1, sometag.children.size());
    570 
    571     const DomElement &someMoreTag = sometag.children[0].children[0];
    572     TEST_ASSERT_EQUAL_STRING("someMoreTag", someMoreTag.name.c_str());
    573     TEST_ASSERT_EQUAL_INT(0, someMoreTag.attribs.size());
    574     TEST_ASSERT_EQUAL_INT(0, someMoreTag.children.size());
    575 
    576     const DomElement &metag = handler.root.children[1];
    577     TEST_ASSERT_EQUAL_STRING("metag", metag.name.c_str());
    578     TEST_ASSERT_EQUAL_INT(1, metag.attribs.size());
    579     TEST_ASSERT_EQUAL_STRING("attr", metag.attribs[0].name);
    580     TEST_ASSERT_EQUAL_STRING("sometag", metag.attribs[0].value);
    581     TEST_ASSERT_EQUAL_INT(0, metag.children.size());
    582 
    583     const DomElement &tag = handler.root.children[2];
    584     TEST_ASSERT_EQUAL_STRING("tag", tag.name.c_str());
    585     TEST_ASSERT_EQUAL_INT(1, tag.attribs.size());
    586     TEST_ASSERT_EQUAL_STRING("movie", tag.attribs[0].name);
    587     TEST_ASSERT_EQUAL_STRING("transformer", tag.attribs[0].value);
    588     TEST_ASSERT_EQUAL_INT(0, tag.children.size());
    589 }
    590 
    591 /* SWITCH_PAGE */
    592 static void testCspLoginResponse(void)
    593 {
    594     WbxmlParser parser(0);
    595     DomTestHandler handler;
    596     parser.setContentHandler(&handler);
    597     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(loginresponse_wbxml,
    598                 sizeof(loginresponse_wbxml), true));
    599 
    600     const DomElement &root = handler.root;
    601     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", root.name.c_str());
    602     TEST_ASSERT_EQUAL_INT(1, root.attribs.size());
    603     TEST_ASSERT_EQUAL_STRING("xmlns", root.attribs[0].name.c_str());
    604     TEST_ASSERT_EQUAL_STRING("http://www.wireless-village.org/CSP1.1",
    605             root.attribs[0].value.c_str());
    606 
    607     const DomElement &transaction = root.children[0].children[1];
    608     TEST_ASSERT_EQUAL_STRING("Transaction", transaction.name.c_str());
    609     TEST_ASSERT_EQUAL_INT(0, transaction.attribs.size());
    610     TEST_ASSERT_EQUAL_INT(2, transaction.children.size());
    611 
    612     const DomElement &transactionContent = transaction.children[1];
    613     TEST_ASSERT_EQUAL_STRING("TransactionContent", transactionContent.name.c_str());
    614     TEST_ASSERT_EQUAL_INT(1, transactionContent.attribs.size());
    615     TEST_ASSERT_EQUAL_STRING("xmlns", transactionContent.attribs[0].name.c_str());
    616     TEST_ASSERT_EQUAL_STRING("http://www.wireless-village.org/TRC1.1",
    617             transactionContent.attribs[0].value.c_str());
    618     TEST_ASSERT_EQUAL_INT(1, transactionContent.children.size());
    619 
    620     const DomElement &clientID = transactionContent.children[0].children[0];
    621     TEST_ASSERT_EQUAL_STRING("ClientID", clientID.name.c_str());
    622     TEST_ASSERT_EQUAL_STRING("Esmertec112233", clientID.characters.c_str());
    623     TEST_ASSERT_EQUAL_INT(0, clientID.attribs.size());
    624     TEST_ASSERT_EQUAL_INT(0, clientID.children.size());
    625 
    626     const DomElement &capReq = transactionContent.children[0].children[4];
    627     TEST_ASSERT_EQUAL_STRING("CapabilityRequest", capReq.name.c_str());
    628     TEST_ASSERT_EQUAL_STRING("F", capReq.characters.c_str());
    629     TEST_ASSERT_EQUAL_INT(0, capReq.attribs.size());
    630     TEST_ASSERT_EQUAL_INT(0, capReq.children.size());
    631 }
    632 
    633 /* OPAQUE integer */
    634 static void testCspStatusPrim(void)
    635 {
    636     WbxmlParser parser(0);
    637     DomTestHandler handler;
    638     parser.setContentHandler(&handler);
    639     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(statusprim_wbxml,
    640                 sizeof(statusprim_wbxml), true));
    641 
    642     const DomElement &root = handler.root;
    643     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", root.name.c_str());
    644     TEST_ASSERT_EQUAL_INT(1, root.attribs.size());
    645     TEST_ASSERT_EQUAL_STRING("xmlns", root.attribs[0].name.c_str());
    646     TEST_ASSERT_EQUAL_STRING("http://www.openmobilealliance.org/DTD/IMPS-CSP1.3",
    647             root.attribs[0].value.c_str());
    648 
    649     const DomElement &transacContent = root.children[0].children[1].children[1];
    650     TEST_ASSERT_EQUAL_STRING("TransactionContent", transacContent.name.c_str());
    651     TEST_ASSERT_EQUAL_INT(1, transacContent.attribs.size());
    652     TEST_ASSERT_EQUAL_STRING("xmlns", transacContent.attribs[0].name.c_str());
    653     TEST_ASSERT_EQUAL_STRING("http://www.openmobilealliance.org/DTD/IMPS-TRC1.3",
    654             transacContent.attribs[0].value.c_str());
    655 
    656     const DomElement &resultCode = transacContent.children[0].children[0].children[0];
    657     TEST_ASSERT_EQUAL_STRING("Code", resultCode.name.c_str());
    658     TEST_ASSERT_EQUAL_INT(0, resultCode.attribs.size());
    659     TEST_ASSERT_EQUAL_INT(201, resultCode.intVal);
    660 
    661     const DomElement &detailedResultCode = transacContent.children[0].children[0].children[2].children[0];
    662     TEST_ASSERT_EQUAL_STRING("Code", detailedResultCode.name.c_str());
    663     TEST_ASSERT_EQUAL_INT(0, detailedResultCode.attribs.size());
    664     TEST_ASSERT_EQUAL_INT(531, detailedResultCode.intVal);
    665 }
    666 
    667 /* SWITCH_PAGE, OPAQUE integer, ENTITY */
    668 static void testCspSendMsg(void)
    669 {
    670     WbxmlParser parser(0);
    671     DomTestHandler handler;
    672     parser.setContentHandler(&handler);
    673     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml,
    674                 sizeof(sendmsgreq1_wbxml), true));
    675 
    676     const DomElement &root = handler.root;
    677     const DomElement &transacContent = root.children[0].children[1].children[1];
    678     const DomElement &contentData = transacContent.children[0].children[2];
    679 
    680     TEST_ASSERT_EQUAL_STRING("ContentData", contentData.name.c_str());
    681     TEST_ASSERT_EQUAL_INT(0, contentData.attribs.size());
    682     // &#160; => U+00A0, UTF-8 0xC2 0xA0
    683     TEST_ASSERT_EQUAL_STRING("Today \xc2\xa0Today", contentData.characters.c_str());
    684 }
    685 
    686 /* Token values, EXT_0 + mbuint32 */
    687 static void testCspCapRequest(void)
    688 {
    689     WbxmlParser parser(0);
    690     DomTestHandler handler;
    691     parser.setContentHandler(&handler);
    692     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(cap_request_wbxml,
    693                 sizeof(cap_request_wbxml), true));
    694 
    695     const DomElement &root = handler.root;
    696     const DomElement &transacContent = root.children[0].children[1].children[1];
    697     const DomElement &capList = transacContent.children[0].children[0];
    698 
    699     TEST_ASSERT_EQUAL_STRING("CapabilityList", capList.name.c_str());
    700     TEST_ASSERT_EQUAL_INT(0, capList.attribs.size());
    701     TEST_ASSERT_EQUAL_INT(9, capList.children.size());
    702 
    703     TEST_ASSERT_EQUAL_STRING("ClientType", capList.children[0].name.c_str());
    704     TEST_ASSERT_EQUAL_STRING("MOBILE_PHONE", capList.children[0].characters.c_str());
    705 
    706     TEST_ASSERT_EQUAL_STRING("SupportedBearer", capList.children[5].name.c_str());
    707     TEST_ASSERT_EQUAL_STRING("HTTP", capList.children[5].characters.c_str());
    708 
    709     TEST_ASSERT_EQUAL_STRING("SupportedCIRMethod", capList.children[7].name.c_str());
    710     TEST_ASSERT_EQUAL_STRING("SHTTP", capList.children[7].characters.c_str());
    711 
    712     TEST_ASSERT_EQUAL_STRING("SupportedCIRMethod", capList.children[8].name.c_str());
    713     TEST_ASSERT_EQUAL_STRING("SSMS", capList.children[8].characters.c_str());
    714 }
    715 
    716 static void testIncompleteInlineString(void)
    717 {
    718     WbxmlParser parser(0);
    719     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser.parse(incomplete_str_i_wbxml,
    720                 sizeof(incomplete_str_i_wbxml), true));
    721 }
    722 
    723 /* more ENTITY tests */
    724 static void testBigEntity(void)
    725 {
    726     WbxmlParser parser(0);
    727     DomTestHandler handler;
    728     parser.setContentHandler(&handler);
    729     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(big_entity_wbxml,
    730                 sizeof(big_entity_wbxml), true));
    731 
    732     const DomElement &sessionType = handler.root.children[0].children[0].children[0];
    733     TEST_ASSERT_EQUAL_INT(0, sessionType.children.size());
    734     TEST_ASSERT_EQUAL_STRING("SessionType", sessionType.name.c_str());
    735     TEST_ASSERT_EQUAL_INT(0, sessionType.attribs.size());
    736     TEST_ASSERT_EQUAL_STRING("\xf4\x8f\xbf\xbf", sessionType.characters.c_str());
    737 }
    738 
    739 static void testInvalidEntity(void)
    740 {
    741     WbxmlParser parser(0);
    742     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser.parse(invalid_entity_wbxml,
    743                 sizeof(invalid_entity_wbxml), true));
    744 }
    745 
    746 static void testParseInChunk(void)
    747 {
    748     WbxmlParser parser(0);
    749     DomTestHandler handler;
    750     parser.setContentHandler(&handler);
    751     // wbxml version
    752     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml,
    753                 1, false));
    754 
    755     // public id + charset
    756     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml + 1,
    757                 2, false));
    758 
    759     // 0 byte long string table
    760     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml + 3,
    761                 1, false));
    762 
    763     // first start tag
    764     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml + 4,
    765                 1, false));
    766 
    767     // some data
    768     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml + 5,
    769                 5, false));
    770 
    771     // some more data
    772     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml + 10,
    773                 sizeof(sendmsgreq1_wbxml) - 1 - 2 - 1 - 1 - 5 - 4, false));
    774 
    775     // last 4 bytes
    776     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml
    777                 + sizeof(sendmsgreq1_wbxml) - 4, 4, true));
    778 
    779     const DomElement &root = handler.root;
    780     TEST_ASSERT_EQUAL_STRING("WV-CSP-Message", root.name.c_str());
    781     TEST_ASSERT_EQUAL_INT(1, root.attribs.size());
    782     TEST_ASSERT_EQUAL_STRING("xmlns", root.attribs[0].name.c_str());
    783     TEST_ASSERT_EQUAL_STRING("http://www.openmobilealliance.org/DTD/WV-CSP1.2",
    784             root.attribs[0].value.c_str());
    785 }
    786 
    787 static void testParserReset(void)
    788 {
    789     WbxmlParser parser(0);
    790 
    791     // first some incomplete data
    792     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser.parse(sendmsgreq1_wbxml,
    793                 1, true));
    794 
    795     parser.reset();
    796 
    797     // now some correct data: wbxml version
    798     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml,
    799                 1, false));
    800 
    801     // more correct data: public id + charset
    802     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(sendmsgreq1_wbxml + 1,
    803                 2, false));
    804 
    805     parser.reset();
    806 
    807     // some wrong data again
    808     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser.parse(sendmsgreq1_wbxml + 3,
    809                 6, false));
    810 
    811     parser.reset();
    812 
    813     DomTestHandler handler;
    814     parser.setContentHandler(&handler);
    815     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(big_entity_wbxml,
    816                 sizeof(big_entity_wbxml), true));
    817 
    818     const DomElement &sessionType = handler.root.children[0].children[0].children[0];
    819     TEST_ASSERT_EQUAL_INT(0, sessionType.children.size());
    820     TEST_ASSERT_EQUAL_STRING("SessionType", sessionType.name.c_str());
    821 
    822     parser.reset();
    823     handler.root.name.clear();
    824     handler.root.children.clear();
    825 
    826     // parse same document without setting a handler
    827     ASSERT_EQUAL_INT(WBXML_STATUS_OK, parser.parse(big_entity_wbxml,
    828                 sizeof(big_entity_wbxml), true));
    829     TEST_ASSERT_EQUAL_INT(0, handler.root.children.size());
    830     TEST_ASSERT_EQUAL_INT(0, handler.root.name.size());
    831 }
    832 
    833 static void testIncompleteData(void)
    834 {
    835     WbxmlParser parser(0);
    836     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser.parse(sendmsgreq1_wbxml,
    837                 1, true));
    838 
    839     WbxmlParser parser1(0);
    840     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser1.parse(sendmsgreq1_wbxml,
    841                 3, true));
    842 
    843     WbxmlParser parser2(0);
    844     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser2.parse(sendmsgreq1_wbxml,
    845                 4, true));
    846 
    847     WbxmlParser parser3(0);
    848     ASSERT_EQUAL_INT(WBXML_STATUS_ERROR, parser3.parse(sendmsgreq1_wbxml,
    849                 5, true));
    850 }
    851 
    852 extern "C" TestRef ImpsParserTest_tests(void)
    853 {
    854     EMB_UNIT_TESTFIXTURES(fixtures) {
    855         DEFINE_TEST(testSimpleCspRet),
    856         DEFINE_TEST(testSimpleCspPublicId),
    857         DEFINE_TEST(testSimpleCspStartElement),
    858         DEFINE_TEST(testSimpleCspStartElementAttr),
    859         DEFINE_TEST(testSimpleCspEndElement),
    860         DEFINE_TEST(testSimpleCspNoContentTag),
    861         DEFINE_TEST(testSimpleCspLevel2),
    862         DEFINE_TEST(testSimpleCspLevel3Characters),
    863         DEFINE_TEST(testLiteralAndStrTable),
    864         DEFINE_TEST(testCspLoginResponse),
    865         DEFINE_TEST(testCspStatusPrim),
    866         DEFINE_TEST(testCspSendMsg),
    867         DEFINE_TEST(testCspCapRequest),
    868         DEFINE_TEST(testIncompleteInlineString),
    869         DEFINE_TEST(testBigEntity),
    870         DEFINE_TEST(testInvalidEntity),
    871         DEFINE_TEST(testParseInChunk),
    872         DEFINE_TEST(testParserReset),
    873         DEFINE_TEST(testIncompleteData),
    874     };
    875     EMB_UNIT_TESTCALLER(ImpsParserTest, "ImpsParserTest", setUp, tearDown, fixtures);
    876 
    877     // temporary work around for the linker/loader problem of the sooner build
    878     static TestCaller t = ImpsParserTest;
    879     t.isa = (TestImplement *)&TestCallerImplement;
    880     return (TestRef)&t;
    881 }
    882 
    883