00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "CParserTest.hpp"
00035
00036 #include "../CParser.hpp"
00037
00038 #include <iostream>
00039 #include <string>
00040 #include <sstream>
00041
00042 #include "../Type.hpp"
00043 #include "../BasicType.hpp"
00044 #include "../PointerType.hpp"
00045 #include "../FunctionType.hpp"
00046 #include "../ArrayType.hpp"
00047 #include "TestUtil.hpp"
00048
00049
00050 CPPUNIT_TEST_SUITE_REGISTRATION(CParserTest);
00051
00052 using namespace cfront;
00053
00054 #define DCAST(VAR_NAME, CAST_TYPE, EXPR) \
00055 CAST_TYPE VAR_NAME = dynamic_cast<CAST_TYPE>(EXPR); \
00056 CPPUNIT_ASSERT(VAR_NAME != NULL)
00057
00058 #define PREPARE_BASIC(NAME_POSTFIX, DECL_STR) \
00059 std::stringstream sstream##NAME_POSTFIX(DECL_STR); \
00060 cfront::CLexer lexer##NAME_POSTFIX(sstream##NAME_POSTFIX); \
00061 cfront::CAnalyzer analyzer##NAME_POSTFIX; \
00062 analyzer##NAME_POSTFIX.initialize(); \
00063 analyzer##NAME_POSTFIX.setTargetInfo(makeDefaultTargetInfo()); \
00064 cfront::CParser parser##NAME_POSTFIX(lexer##NAME_POSTFIX); \
00065 antlr::ASTFactory astFactory##NAME_POSTFIX("ValueNode", ValueNode::factory); \
00066 parser##NAME_POSTFIX.initializeASTFactory(astFactory##NAME_POSTFIX); \
00067 analyzer##NAME_POSTFIX.setASTFactory(&astFactory##NAME_POSTFIX); \
00068 parser##NAME_POSTFIX.setASTFactory(&astFactory##NAME_POSTFIX); \
00069 parser##NAME_POSTFIX.setAnalyzer(&analyzer##NAME_POSTFIX);
00070
00071
00072 #define PREPARE(NAME_POSTFIX, DECL_STR, VAR_NAME_STR) \
00073 PREPARE_BASIC(NAME_POSTFIX, DECL_STR); \
00074 parser##NAME_POSTFIX.declaration(NameDescription::TOPLEVEL); \
00075 NameDescription* nd##NAME_POSTFIX; \
00076 Environment* foundEnv##NAME_POSTFIX = analyzer##NAME_POSTFIX.getCurrentEnv()->lookupOrdinaryName(VAR_NAME_STR, &nd##NAME_POSTFIX); \
00077 CPPUNIT_ASSERT(foundEnv##NAME_POSTFIX != NULL); \
00078 Type* type##NAME_POSTFIX = nd##NAME_POSTFIX->getType()
00079
00080 void
00081 CParserTest::testAddNameAndTypeBasic()
00082 {
00083
00084 #define TEST_BASIC_TYPE(NAME_POSTFIX, DECL_STR, VAR_NAME_STR, BASIC_TYPE, QUAL_FLAGS) \
00085 PREPARE(NAME_POSTFIX, DECL_STR, VAR_NAME_STR); \
00086 BasicType* bt##NAME_POSTFIX = dynamic_cast<BasicType*>(type##NAME_POSTFIX); \
00087 CPPUNIT_ASSERT(bt##NAME_POSTFIX != NULL); \
00088 CPPUNIT_ASSERT(bt##NAME_POSTFIX->getPrimitiveTag() == BASIC_TYPE && \
00089 bt##NAME_POSTFIX->getQualFlags() == QUAL_FLAGS)
00090
00091 TEST_BASIC_TYPE(v1, "void v1;", "v1", BasicType::VOID, 0);
00092 TEST_BASIC_TYPE(c1, "char c1;", "c1", BasicType::CHAR, 0);
00093 TEST_BASIC_TYPE(c2, "signed char c2;", "c2", BasicType::SCHAR, 0);
00094 TEST_BASIC_TYPE(c3, "unsigned char c3;", "c3", BasicType::UCHAR, 0);
00095 TEST_BASIC_TYPE(s1, "short s1;", "s1", BasicType::SSHORT, 0);
00096 TEST_BASIC_TYPE(s2, "signed short s2;", "s2", BasicType::SSHORT, 0);
00097 TEST_BASIC_TYPE(s3, "short int s3;", "s3", BasicType::SSHORT, 0);
00098 TEST_BASIC_TYPE(s4, "signed short int s4;", "s4", BasicType::SSHORT, 0);
00099 TEST_BASIC_TYPE(s5, "unsigned short s5;", "s5", BasicType::USHORT, 0);
00100 TEST_BASIC_TYPE(s6, "unsigned short int s6;", "s6", BasicType::USHORT, 0);
00101 TEST_BASIC_TYPE(i1, "int i1;", "i1", BasicType::SINT, 0);
00102 TEST_BASIC_TYPE(i2, "signed i2;", "i2", BasicType::SINT, 0);
00103 TEST_BASIC_TYPE(i3, "signed int i3;", "i3", BasicType::SINT, 0);
00104 TEST_BASIC_TYPE(i4, "unsigned i4;", "i4", BasicType::UINT, 0);
00105 TEST_BASIC_TYPE(i5, "unsigned int i5;", "i5", BasicType::UINT, 0);
00106 TEST_BASIC_TYPE(l1, "long l1;", "l1", BasicType::SLONG, 0);
00107 TEST_BASIC_TYPE(l2, "signed long l2;", "l2", BasicType::SLONG, 0);
00108 TEST_BASIC_TYPE(l3, "long int l3;", "l3", BasicType::SLONG, 0);
00109 TEST_BASIC_TYPE(l4, "signed long int l4;", "l4", BasicType::SLONG, 0);
00110 TEST_BASIC_TYPE(l5, "unsigned long l5;", "l5", BasicType::ULONG, 0);
00111 TEST_BASIC_TYPE(l6, "unsigned long int l6;", "l6", BasicType::ULONG, 0);
00112 TEST_BASIC_TYPE(ll1, "long long ll1;", "ll1", BasicType::SLLONG, 0);
00113 TEST_BASIC_TYPE(ll2, "signed long long ll2;", "ll2", BasicType::SLLONG, 0);
00114 TEST_BASIC_TYPE(ll3, "long long int ll3;", "ll3", BasicType::SLLONG, 0);
00115 TEST_BASIC_TYPE(ll4, "signed long long int ll4;", "ll4", BasicType::SLLONG, 0);
00116 TEST_BASIC_TYPE(ll5, "unsigned long long ll5;", "ll5", BasicType::ULLONG, 0);
00117 TEST_BASIC_TYPE(ll6, "unsigned long long int ll6;", "ll6", BasicType::ULLONG, 0);
00118 TEST_BASIC_TYPE(f1, "float f1;", "f1", BasicType::FLOAT, 0);
00119 TEST_BASIC_TYPE(d1, "double d1;", "d1", BasicType::DOUBLE, 0);
00120 TEST_BASIC_TYPE(ld1, "long double ld1;", "ld1", BasicType::LDOUBLE, 0);
00121
00122 TEST_BASIC_TYPE(cq1, "const char cq1;", "cq1", BasicType::CHAR, Const);
00123 TEST_BASIC_TYPE(sq1, "const short volatile sq1;", "sq1", BasicType::SSHORT,
00124 (Const | Volatile));
00125
00126 #undef TEST_BASIC_TYPE
00127 }
00128
00129 void
00130 CParserTest::testAddNameAndTypePointer()
00131 {
00132 {
00133 PREPARE(b1, "int* p1;", "p1");
00134 DCAST(pb1, PointerType*, typeb1);
00135 DCAST(bpb1, const BasicType*, pb1->getBaseType());
00136 CPPUNIT_ASSERT(bpb1->getPrimitiveTag() == BasicType::SINT &&
00137 bpb1->getQualFlags() == 0 &&
00138 pb1->getQualFlags() == 0);
00139 }
00140 {
00141 PREPARE(b2, "const int * const p2;", "p2");
00142 DCAST(pb2, PointerType*, typeb2);
00143 DCAST(bpb2, const BasicType*, pb2->getBaseType());
00144 CPPUNIT_ASSERT(bpb2->getPrimitiveTag() == BasicType::SINT &&
00145 bpb2->getQualFlags() == Const &&
00146 pb2->getQualFlags() == Const);
00147 }
00148 {
00149 PREPARE(b3, "long double * volatile * restrict p3;", "p3");
00150 DCAST(pp3, PointerType*, typeb3);
00151 DCAST(p3, const PointerType*, pp3->getBaseType());
00152 DCAST(bp3, const BasicType*, p3->getBaseType());
00153 CPPUNIT_ASSERT(bp3->getPrimitiveTag() == BasicType::LDOUBLE &&
00154 bp3->getQualFlags() == 0 &&
00155 p3->getQualFlags() == Restrict &&
00156 pp3->getQualFlags() == Volatile);
00157 }
00158 }
00159
00160 void
00161 CParserTest::testAddNameAndTypeFunction()
00162 {
00163 #define PREP_RET_PARAM(DECL_STR, VAR_NAME_STR, RET_TYPE) \
00164 PREPARE(f, DECL_STR, VAR_NAME_STR); \
00165 DCAST(ff, FunctionType*, typef); \
00166 DCAST(r, RET_TYPE, ff->getReturnType()); \
00167 const ParameterTypes& pts = ff->getParameterTypes(); \
00168 ParameterTypes::const_iterator i = pts.begin()
00169
00170 {
00171 PREP_RET_PARAM("void f0(void);", "f0", const BasicType*);
00172 CPPUNIT_ASSERT(r->getPrimitiveTag() == BasicType::VOID &&
00173 r->getQualFlags() == 0 &&
00174 ! ff->hasVararg() &&
00175 i == pts.end());
00176 }
00177 {
00178 PREP_RET_PARAM("int f1(int a);", "f1", const BasicType*);
00179 DCAST(p1, const BasicType*, *i); ++i;
00180 CPPUNIT_ASSERT(r->getPrimitiveTag() == BasicType::SINT &&
00181 r->getQualFlags() == 0 &&
00182 p1->getPrimitiveTag() == BasicType::SINT &&
00183 p1->getQualFlags() == 0 &&
00184 ! ff->hasVararg() &&
00185 i == pts.end());
00186 }
00187 {
00188 PREP_RET_PARAM("void f2(int a, ...);", "f2", const BasicType*);
00189 DCAST(p1, const BasicType*, *i); ++i;
00190 CPPUNIT_ASSERT(r->getPrimitiveTag() == BasicType::VOID &&
00191 r->getQualFlags() == 0 &&
00192 p1->getPrimitiveTag() == BasicType::SINT &&
00193 p1->getQualFlags() == 0 &&
00194 ff->hasVararg() &&
00195 i == pts.end());
00196 }
00197 {
00198 PREP_RET_PARAM("void *f3(int a, int * b, unsigned int c);", "f3",
00199 const PointerType*);
00200 DCAST(r1, const BasicType*, r->getBaseType());
00201 DCAST(p1, const BasicType*, *i); ++i;
00202 DCAST(p2, const PointerType*, *i); ++i;
00203 DCAST(p21, const BasicType*, p2->getBaseType());
00204 DCAST(p3, const BasicType*, *i); ++i;
00205 CPPUNIT_ASSERT(r->getQualFlags() == 0 &&
00206 r1->getPrimitiveTag() == BasicType::VOID &&
00207 r1->getQualFlags() == 0 &&
00208 p1->getPrimitiveTag() == BasicType::SINT &&
00209 p1->getQualFlags() == 0 &&
00210 p2->getQualFlags() == 0 &&
00211 p21->getPrimitiveTag() == BasicType::SINT &&
00212 p21->getQualFlags() == 0 &&
00213 p3->getPrimitiveTag() == BasicType::UINT &&
00214 p3->getQualFlags() == 0 &&
00215 ! ff->hasVararg() &&
00216 i == pts.end());
00217 }
00218 {
00219 PREP_RET_PARAM("void f4(int, float *, long double);", "f4",
00220 const BasicType*);
00221 #ifdef PARSER_DEBUG
00222 std::cout << (typef == NULL ? "((NULL))" : typef->toString()) << std::endl;
00223 #endif
00224 DCAST(p1, const BasicType*, *i); ++i;
00225 DCAST(p2, const PointerType*, *i); ++i;
00226 DCAST(p21, const BasicType*, p2->getBaseType());
00227 DCAST(p3, const BasicType*, *i); ++i;
00228 CPPUNIT_ASSERT(r->getPrimitiveTag() == BasicType::VOID &&
00229 r->getQualFlags() == 0 &&
00230 p1->getPrimitiveTag() == BasicType::SINT &&
00231 p1->getQualFlags() == 0 &&
00232 p2->getQualFlags() == 0 &&
00233 p21->getPrimitiveTag() == BasicType::FLOAT &&
00234 p21->getQualFlags() == 0 &&
00235 p3->getPrimitiveTag() == BasicType::LDOUBLE &&
00236 p3->getQualFlags() == 0 &&
00237 ! ff->hasVararg() &&
00238 i == pts.end());
00239 }
00240 {
00241 PREP_RET_PARAM("void f5(int []);", "f5", const BasicType*);
00242 DCAST(p1, const ArrayType*, *i); ++i;
00243 DCAST(p11, const BasicType*, p1->getBaseType());
00244 CPPUNIT_ASSERT(r->getPrimitiveTag() == BasicType::VOID &&
00245 r->getQualFlags() == 0 &&
00246 p1->getQualFlags() == 0 &&
00247 p11->getPrimitiveTag() == BasicType::SINT &&
00248 p11->getQualFlags() == 0 &&
00249 ! ff->hasVararg() &&
00250 i == pts.end());
00251 }
00252 {
00253 PREP_RET_PARAM("void f6(int (*)(void), void (*)(int, float));", "f6",
00254 const BasicType*);
00255 #ifdef PARSER_DEBUG
00256 std::cout << (typef == NULL ? "((NULL))" : typef->toString()) << std::endl;
00257 #endif
00258 DCAST(p1, const PointerType*, *i); ++i;
00259 DCAST(p1f, const FunctionType*, p1->getBaseType());
00260 DCAST(p1r, const BasicType*, p1f->getReturnType());
00261 const ParameterTypes& pts1 = p1f->getParameterTypes();
00262 ParameterTypes::const_iterator pi1 = pts1.begin();
00263 CPPUNIT_ASSERT(p1->getQualFlags() == 0 &&
00264 p1r->getPrimitiveTag() == BasicType::SINT &&
00265 p1r->getQualFlags() == 0 &&
00266 ! p1f->hasVararg() &&
00267 pi1 == pts1.end());
00268
00269 DCAST(p2, const PointerType*, *i); ++i;
00270 DCAST(p2f, const FunctionType*, p2->getBaseType());
00271 DCAST(p2r, const BasicType*, p2f->getReturnType());
00272 const ParameterTypes& pts2 = p2f->getParameterTypes();
00273 ParameterTypes::const_iterator pi2 = pts2.begin();
00274 DCAST(p21, const BasicType*, *pi2); ++pi2;
00275 DCAST(p22, const BasicType*, *pi2); ++pi2;
00276 CPPUNIT_ASSERT(p2->getQualFlags() == 0 &&
00277 p2r->getPrimitiveTag() == BasicType::VOID &&
00278 p2r->getQualFlags() == 0 &&
00279 p21->getPrimitiveTag() == BasicType::SINT &&
00280 p21->getQualFlags() == 0 &&
00281 p22->getPrimitiveTag() == BasicType::FLOAT &&
00282 p22->getQualFlags() == 0 &&
00283 ! p2f->hasVararg() &&
00284 pi2 == pts2.end());
00285
00286 CPPUNIT_ASSERT(r->getPrimitiveTag() == BasicType::VOID &&
00287 r->getQualFlags() == 0 &&
00288 p1->getQualFlags() == 0 &&
00289 ! ff->hasVararg() &&
00290 i == pts.end());
00291 }
00292 #undef PREP_RET_PARAM
00293 }
00294
00295 void
00296 CParserTest::testAddNameAndTypeArray()
00297 {
00298 {
00299 PREPARE(a, "int a1[];", "a1");
00300 DCAST(a1, ArrayType*, typea);
00301 DCAST(b, const BasicType*, a1->getBaseType());
00302 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00303 b->getPrimitiveTag() == BasicType::SINT &&
00304 b->getQualFlags() == 0);
00305 }
00306 {
00307 PREPARE(a, "int a2[][];", "a2");
00308 DCAST(a1, ArrayType*, typea);
00309 DCAST(a2, const ArrayType*, a1->getBaseType());
00310 DCAST(b, const BasicType*, a2->getBaseType());
00311 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00312 a2->getQualFlags() == 0 &&
00313 b->getPrimitiveTag() == BasicType::SINT &&
00314 b->getQualFlags() == 0);
00315 }
00316 {
00317 PREPARE(a, "int a3[4][2 + 1];", "a3");
00318 DCAST(a1, ArrayType*, typea);
00319 DCAST(a2, const ArrayType*, a1->getBaseType());
00320 DCAST(b, const BasicType*, a2->getBaseType());
00321 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00322 a1->getLengthValue() == 4 &&
00323 a2->getQualFlags() == 0 &&
00324 a2->getLengthValue() == 3 &&
00325 b->getPrimitiveTag() == BasicType::SINT &&
00326 b->getQualFlags() == 0);
00327 }
00328 {
00329 PREPARE(a, "const int a4[const];", "a4");
00330 DCAST(a1, ArrayType*, typea);
00331 DCAST(b, const BasicType*, a1->getBaseType());
00332 CPPUNIT_ASSERT(a1->getQualFlags() == Const &&
00333 b->getPrimitiveTag() == BasicType::SINT &&
00334 b->getQualFlags() == Const);
00335 }
00336 {
00337 PREPARE(a, "char a5[static 7];", "a5");
00338 DCAST(a1, ArrayType*, typea);
00339 DCAST(b, const BasicType*, a1->getBaseType());
00340 CPPUNIT_ASSERT(a1->getQualFlags() == Static &&
00341 a1->getLengthValue() == 7 &&
00342 b->getPrimitiveTag() == BasicType::CHAR &&
00343 b->getQualFlags() == 0);
00344 }
00345 {
00346 PREPARE(a, "float a6[static const volatile restrict 8];", "a6");
00347 DCAST(a1, ArrayType*, typea);
00348 DCAST(b, const BasicType*, a1->getBaseType());
00349 CPPUNIT_ASSERT(a1->getQualFlags() ==
00350 (Static | Const | Volatile | Restrict) &&
00351 a1->getLengthValue() == 8 &&
00352 b->getPrimitiveTag() == BasicType::FLOAT &&
00353 b->getQualFlags() == 0);
00354 }
00355 {
00356 PREPARE(a, "char *argv[];", "argv");
00357 DCAST(a1, ArrayType*, typea);
00358 DCAST(p, const PointerType*, a1->getBaseType());
00359 DCAST(b, const BasicType*, p->getBaseType());
00360 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00361 a1->getLengthSpec() == ArrayType::NOT_SPECIFIED &&
00362 p->getQualFlags() == 0 &&
00363 b->getPrimitiveTag() == BasicType::CHAR &&
00364 b->getQualFlags() == 0);
00365 }
00366
00367 {
00368 PREPARE(a, "int a7[] = {0, 1, 2, 3};", "a7");
00369 DCAST(a1, ArrayType*, typea);
00370 DCAST(b, const BasicType*, a1->getBaseType());
00371 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00372 a1->getLengthValue() == 4 &&
00373 b->getPrimitiveTag() == BasicType::SINT &&
00374 b->getQualFlags() == 0);
00375 }
00376 {
00377 PREPARE(a, "const char a8[] = \"Hello!\";", "a8");
00378 DCAST(a1, ArrayType*, typea);
00379 DCAST(b, const BasicType*, a1->getBaseType());
00380 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00381 a1->getLengthValue() == 7 &&
00382 b->getPrimitiveTag() == BasicType::CHAR &&
00383 b->getQualFlags() == Const);
00384 }
00385 {
00386 PREPARE(a, "const char a9[] = \"\\177\\xAB\\0\\r\\n\";", "a9");
00387 DCAST(a1, ArrayType*, typea);
00388 DCAST(b, const BasicType*, a1->getBaseType());
00389 CPPUNIT_ASSERT(a1->getQualFlags() == 0 &&
00390 a1->getLengthValue() == 6 &&
00391 b->getPrimitiveTag() == BasicType::CHAR &&
00392 b->getQualFlags() == Const);
00393 }
00394 }
00395
00396 void
00397 CParserTest::testAddNameAndTypeComposition()
00398 {
00399 {
00400 PREPARE(c, "void (*c1)(int);", "c1");
00401 DCAST(p, PointerType*, typec);
00402 DCAST(f, const FunctionType*, p->getBaseType());
00403 DCAST(r, const BasicType*, f->getReturnType());
00404 const ParameterTypes& pts = f->getParameterTypes();
00405 ParameterTypes::const_iterator i = pts.begin();
00406 DCAST(p1, const BasicType*, *i); ++i;
00407 CPPUNIT_ASSERT(p->getQualFlags() == 0 &&
00408 ! f->hasVararg() &&
00409 r->getPrimitiveTag() == BasicType::VOID &&
00410 r->getQualFlags() == 0 &&
00411 p1->getPrimitiveTag() == BasicType::SINT &&
00412 p1->getQualFlags() == 0 &&
00413 i == pts.end());
00414 }
00415 {
00416 PREPARE(c, "long (*c2);", "c2");
00417 DCAST(pb1, PointerType*, typec);
00418 DCAST(bpb1, const BasicType*, pb1->getBaseType());
00419 CPPUNIT_ASSERT(bpb1->getPrimitiveTag() == BasicType::SLONG &&
00420 bpb1->getQualFlags() == 0 &&
00421 pb1->getQualFlags() == 0);
00422 }
00423 {
00424 PREPARE(c, "int (c3)[5];", "c3");
00425 DCAST(ab1, ArrayType*, typec);
00426 DCAST(bab1, const BasicType*, ab1->getBaseType());
00427 CPPUNIT_ASSERT(bab1->getPrimitiveTag() == BasicType::SINT &&
00428 bab1->getQualFlags() == 0 &&
00429 ab1->getQualFlags() == 0);
00430 }
00431 {
00432 PREPARE(c, "int (*c4)();", "c4");
00433 DCAST(p1, PointerType*, typec);
00434 DCAST(f1, const FunctionType*, p1->getBaseType());
00435 const ParameterTypes& pts1 = f1->getParameterTypes();
00436 ParameterTypes::const_iterator i1 = pts1.begin();
00437 CPPUNIT_ASSERT(i1 == pts1.end() && !f1->hasVararg());
00438 DCAST(b1, const BasicType*, f1->getReturnType());
00439 CPPUNIT_ASSERT(b1->getPrimitiveTag() == BasicType::SINT &&
00440 b1->getQualFlags() == 0);
00441 }
00442 {
00443 PREPARE(c, "int *(*(*(*c5)())[6])();", "c5");
00444 DCAST(p1, PointerType*, typec);
00445 DCAST(f1, const FunctionType*, p1->getBaseType());
00446 const ParameterTypes& pts1 = f1->getParameterTypes();
00447 ParameterTypes::const_iterator i1 = pts1.begin();
00448 CPPUNIT_ASSERT(i1 == pts1.end() && !f1->hasVararg());
00449 DCAST(p2, const PointerType*, f1->getReturnType());
00450 DCAST(a1, const ArrayType*, p2->getBaseType());
00451 CPPUNIT_ASSERT(a1->getLengthValue() == 6);
00452 DCAST(p3, const PointerType*, a1->getBaseType());
00453 DCAST(f2, const FunctionType*, p3->getBaseType());
00454 const ParameterTypes& pts2 = f2->getParameterTypes();
00455 ParameterTypes::const_iterator i2 = pts2.begin();
00456 CPPUNIT_ASSERT(i2 == pts2.end() && !f2->hasVararg());
00457 DCAST(p4, const PointerType*, f2->getReturnType());
00458 DCAST(b1, const BasicType*, p4->getBaseType());
00459 CPPUNIT_ASSERT(b1->getPrimitiveTag() == BasicType::SINT &&
00460 b1->getQualFlags() == 0);
00461 }
00462
00463
00464
00465 }
00466
00467 #define PREPARE_TAG(NAME_POSTFIX, DECL_STR, VAR_NAME_STR) \
00468 PREPARE_BASIC(NAME_POSTFIX, DECL_STR); \
00469 parser##NAME_POSTFIX.declaration(NameDescription::TOPLEVEL); \
00470 Environment* env##NAME_POSTFIX = analyzer##NAME_POSTFIX.getCurrentEnv(); \
00471 NameDescription* nd##NAME_POSTFIX; \
00472 Environment* foundEnv##NAME_POSTFIX = env##NAME_POSTFIX->lookupTagName(VAR_NAME_STR, &nd##NAME_POSTFIX); \
00473 CPPUNIT_ASSERT(foundEnv##NAME_POSTFIX != NULL); \
00474 Type* type##NAME_POSTFIX = nd##NAME_POSTFIX->getType()
00475
00476
00477
00478 void
00479 CParserTest::testAddNameAndTypeStructUnion()
00480 {
00481 {
00482 PREPARE_TAG(s, "struct complex { double r, i; };", "complex");
00483 DCAST(s1, StructType*, types);
00484
00485 const Fields& fs = s1->getDefinition()->getFields();
00486 Fields::const_iterator i = fs.begin();
00487
00488 const Field& f1 = *i; ++i;
00489 DCAST(f1t, const BasicType*, f1.type);
00490 CPPUNIT_ASSERT(f1t->getPrimitiveTag() == BasicType::DOUBLE &&
00491 f1t->getQualFlags() == 0 &&
00492 f1.bitField == ConstantUnspecified);
00493
00494 const Field& f2 = *i; ++i;
00495 DCAST(f2t, const BasicType*, f2.type);
00496 CPPUNIT_ASSERT(f2t->getPrimitiveTag() == BasicType::DOUBLE &&
00497 f2t->getQualFlags() == 0);
00498
00499 CPPUNIT_ASSERT(i == fs.end());
00500 }
00501 {
00502 PREPARE_TAG(s, "struct list { int v; struct list* next; };", "list");
00503 DCAST(s1, StructType*, types);
00504
00505 const Fields& fs = s1->getDefinition()->getFields();
00506 Fields::const_iterator i = fs.begin();
00507
00508 const Field& f1 = *i; ++i;
00509 DCAST(f1t, const BasicType*, f1.type);
00510 CPPUNIT_ASSERT(f1t->getPrimitiveTag() == BasicType::SINT &&
00511 f1t->getQualFlags() == 0 &&
00512 f1.bitField == ConstantUnspecified);
00513
00514 const Field& f2 = *i; ++i;
00515 DCAST(f2t, const PointerType*, f2.type);
00516 DCAST(f2t1, const StructType*, f2t->getBaseType());
00517 CPPUNIT_ASSERT(f2t->getQualFlags() == 0 &&
00518 f2t1->getDefinition() == s1->getDefinition());
00519
00520 CPPUNIT_ASSERT(i == fs.end());
00521
00522 #ifdef PARSER_DEBUG
00523 const Environment* env = s1->getDefinition()->getEnv();
00524 std::cout << "Env:" << env->toString() << std::endl;
00525 #endif
00526 }
00527 {
00528 PREPARE(s, "typedef struct { double r, i; } complex;", "complex");
00529 DCAST(t1, TypedefType*, types);
00530
00531 DCAST(s1, const StructType*, t1->getBaseType());
00532
00533 const Fields& fs = s1->getDefinition()->getFields();
00534 Fields::const_iterator i = fs.begin();
00535
00536 const Field& f1 = *i; ++i;
00537 DCAST(f1t, const BasicType*, f1.type);
00538 CPPUNIT_ASSERT(f1t->getPrimitiveTag() == BasicType::DOUBLE &&
00539 f1t->getQualFlags() == 0 &&
00540 f1.bitField == ConstantUnspecified);
00541
00542 const Field& f2 = *i; ++i;
00543 DCAST(f2t, const BasicType*, f2.type);
00544 CPPUNIT_ASSERT(f2t->getPrimitiveTag() == BasicType::DOUBLE &&
00545 f2t->getQualFlags() == 0);
00546
00547 CPPUNIT_ASSERT(i == fs.end());
00548 }
00549 {
00550 PREPARE(u, "union { float f; struct {int i1, i2;} is; } u1;", "u1");
00551 DCAST(u1, UnionType*, typeu);
00552 CPPUNIT_ASSERT(u1->getQualFlags() == 0);
00553
00554 const Fields& fs = u1->getDefinition()->getFields();
00555 Fields::const_iterator i = fs.begin();
00556
00557 const Field& f1 = *i; ++i;
00558 DCAST(f1t, const BasicType*, f1.type);
00559 CPPUNIT_ASSERT(f1t->getPrimitiveTag() == BasicType::FLOAT &&
00560 f1t->getQualFlags() == 0 &&
00561 f1.bitField == ConstantUnspecified);
00562
00563 const Field& f2 = *i; ++i;
00564 DCAST(f2t, const StructType*, f2.type);
00565 {
00566 const Fields& fs2 = f2t->getDefinition()->getFields();
00567 Fields::const_iterator i2 = fs2.begin();
00568
00569 const Field& f21 = *i2; ++i2;
00570 DCAST(f21t, const BasicType*, f21.type);
00571 CPPUNIT_ASSERT(f21t->getPrimitiveTag() == BasicType::SINT &&
00572 f21t->getQualFlags() == 0 &&
00573 f21.bitField == ConstantUnspecified);
00574 const Field& f22 = *i2; ++i2;
00575 DCAST(f22t, const BasicType*, f22.type);
00576 CPPUNIT_ASSERT(f22t->getPrimitiveTag() == BasicType::SINT &&
00577 f22t->getQualFlags() == 0 &&
00578 f22.bitField == ConstantUnspecified);
00579 CPPUNIT_ASSERT(i2 == fs2.end());
00580 }
00581 CPPUNIT_ASSERT(i == fs.end());
00582 }
00583 }
00584
00585 void
00586 CParserTest::testAddNameAndTypeEnum()
00587 {
00588 #define LOOKUP_NAME(NAME_POSTFIX, ENV, NAME_STR) \
00589 NameDescription* nd##NAME_POSTFIX = NULL; \
00590 Environment* foundEnv##NAME_POSTFIX = ENV->lookupOrdinaryName(NAME_STR, &nd##NAME_POSTFIX); \
00591 CPPUNIT_ASSERT(foundEnv##NAME_POSTFIX != NULL); \
00592 Type* t##NAME_POSTFIX = nd##NAME_POSTFIX->getType()
00593
00594 #define IS_ENUM_CONST_TYPE(TYP) \
00595 DCAST(b##TYP, const BasicType*, TYP); \
00596 CPPUNIT_ASSERT(b##TYP->getPrimitiveTag() == BasicType::SINT)
00597
00598
00599 PREPARE_TAG(e, "enum color { red = 0, blue, green } favorite;", "color");
00600 DCAST(e1, EnumType*, typee);
00601
00602 const EnumConstants& ecs = e1->getDefinition()->getConsts();
00603 EnumConstants::const_iterator i = ecs.begin();
00604
00605 const EnumConstant& c1 = *i; ++i;
00606 CPPUNIT_ASSERT(c1.name == "red");
00607
00608 const EnumConstant& c2 = *i; ++i;
00609 CPPUNIT_ASSERT(c2.name == "blue");
00610
00611 const EnumConstant& c3 = *i; ++i;
00612 CPPUNIT_ASSERT(c3.name == "green");
00613
00614 CPPUNIT_ASSERT(i == ecs.end());
00615
00616 {
00617 LOOKUP_NAME(1, enve, "red");
00618 IS_ENUM_CONST_TYPE(t1);
00619 }
00620 {
00621 LOOKUP_NAME(2, enve, "blue");
00622 IS_ENUM_CONST_TYPE(t2);
00623 }
00624 {
00625 LOOKUP_NAME(3, enve, "green");
00626 IS_ENUM_CONST_TYPE(t3);
00627 }
00628 #undef IS_ENUM_CONST_TYPE
00629 }
00630
00631 void
00632 CParserTest::testTypeExpr()
00633 {
00634 #define PREPARE_EXPR(NAME_POSTFIX, EXPR_STR) \
00635 PREPARE_BASIC(NAME_POSTFIX, EXPR_STR); \
00636 parser##NAME_POSTFIX.expression(); \
00637 RefValueNode e##NAME_POSTFIX = RefValueNode(parser##NAME_POSTFIX.getAST()); \
00638 RefValueNode te##NAME_POSTFIX = analyzer##NAME_POSTFIX.typeExpr(e##NAME_POSTFIX); \
00639 const Type* t##NAME_POSTFIX = te##NAME_POSTFIX->getValueRef().type
00640
00641 {
00642 PREPARE_EXPR(1, "0;");
00643 DCAST(bt1, const BasicType*, t1);
00644 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT &&
00645 bt1->getQualFlags() == 0);
00646 }
00647
00648 {
00649 PREPARE_EXPR(1, "+ 'A';");
00650 DCAST(bt1, const BasicType*, t1);
00651 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT &&
00652 bt1->getQualFlags() == 0);
00653 }
00654
00655
00656 {
00657 PREPARE_EXPR(1, "1 + 2;");
00658 DCAST(bt1, const BasicType*, t1);
00659 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT &&
00660 bt1->getQualFlags() == 0);
00661 }
00662
00663 {
00664 PREPARE_EXPR(1, "3LL - 4U;");
00665 DCAST(bt1, const BasicType*, t1);
00666 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SLLONG &&
00667 bt1->getQualFlags() == 0);
00668 RefNode rn = RefNode(te1->getFirstChild()->getNextSibling());
00669 CPPUNIT_ASSERT(rn->getType() == CTokenTypes::NImplicitCast);
00670 }
00671
00672 {
00673 PREPARE_EXPR(1, "5LL * 6UL;");
00674 DCAST(bt1, const BasicType*, t1);
00675
00676 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::ULLONG &&
00677 bt1->getQualFlags() == 0);
00678 }
00679 {
00680 PREPARE_EXPR(1, "7L * 8U;");
00681 DCAST(bt1, const BasicType*, t1);
00682
00683 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SLONG &&
00684 bt1->getQualFlags() == 0);
00685 }
00686
00687
00688 {
00689 PREPARE_EXPR(1, "9 == 10LL;");
00690 DCAST(bt1, const BasicType*, t1);
00691 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT &&
00692 bt1->getQualFlags() == 0);
00693 }
00694 {
00695 PREPARE_EXPR(1, "'a' != 0.0;");
00696 DCAST(bt1, const BasicType*, t1);
00697 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT &&
00698 bt1->getQualFlags() == 0);
00699 }
00700
00701
00702 {
00703 PREPARE_EXPR(1, "(double) 9;");
00704 DCAST(bt1, const BasicType*, t1);
00705 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::DOUBLE &&
00706 bt1->getQualFlags() == 0);
00707 }
00708
00709 {
00710 PREPARE_EXPR(1, "(unsigned char*) 10 + 11;");
00711 DCAST(pt1, const PointerType*, t1);
00712 DCAST(bt1, const BasicType*, pt1->getBaseType());
00713 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::UCHAR &&
00714 bt1->getQualFlags() == 0);
00715 }
00716
00717 #undef PREPARE_EXPR
00718
00719 PREPARE_BASIC(1, " \
00720 void f(void) { \
00721 \n struct S1 {int m1; char m2;} s1; \
00722 \n struct S1* s1p1, *s1p2; \
00723 \n s1p1 = &s1; /* assignment (1) */ \
00724 \n s1.m1; /* DOT (1) */ \
00725 \n s1p1->m2; /* DEREF (1) */ \
00726 \n s1.m1 += 1; /* assignment (2) */ \
00727 \n long i1; \
00728 \n i1 = s1p1; /* assignment (3) */ \
00729 \n _Bool b1; \
00730 \n b1 = s1p1; /* assignment (4) */ \
00731 \n (*s1p1).m1; /* DEREF (2) */ \
00732 \n s1p1 + 1; /* binary (1) */ \
00733 \n \
00734 \n extern long g(long long, char, long, void*, float, ...); \
00735 \n short si = 7; \
00736 \n g((10LL), si, si, s1p1, 10.0f, 10.0f); /* NCall (1) */ \
00737 \n \
00738 \n 1 ? 1L : 1UL; /* QUERY (1) */ \
00739 \n 1 ? s1p1 : 0; /* QUERY (2) */ \
00740 \n s1p1 == 0; /* equality (1) */ \
00741 \n s1p1 == s1p2; /* equality (2) */ \
00742 \n s1p1 == (void*) s1p2; /* equality (3) */ \
00743 } \
00744 ");
00745 parser1.functionDefinition();
00746 RefValueNode etop = RefValueNode(parser1.getAST());
00747 RefValueNode n;
00748 for (n = etop->getFirstChild(); n != NULL; n = n->getNextSibling()) {
00749 if (n->getType() == CTokenTypes::NCompoundStatement) {
00750 break;
00751 }
00752 }
00753 CPPUNIT_ASSERT(n != NULL);
00754 n = n->getFirstChild();
00755
00756 #define NEXT_EXPR(snode, enode) \
00757 do { \
00758 for (; snode != NULL; snode = snode->getNextSibling()) { \
00759 if (snode->getType() == CTokenTypes::NExpression) { \
00760 enode = snode->getFirstChild(); \
00761 break; \
00762 } \
00763 } \
00764 CPPUNIT_ASSERT(snode != NULL); \
00765 snode = snode->getNextSibling(); \
00766 } while (0)
00767
00768
00769 #ifdef PARSER_DEBUG
00770 std::cout << n->toStringList() << std::endl;
00771 #endif
00772
00773 RefValueNode en;
00774 RefValueNode tn;
00775 {
00776
00777 NEXT_EXPR(n, en);
00778 tn = analyzer1.typeExpr(en);
00779 DCAST(pt1, const PointerType*, tn->getValueRef().type);
00780 DCAST(st1, const StructType*, pt1->getBaseType());
00781 }
00782
00783 {
00784
00785 NEXT_EXPR(n, en);
00786 tn = analyzer1.typeExpr(en);
00787 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00788 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT);
00789 }
00790
00791 {
00792
00793 NEXT_EXPR(n, en);
00794 tn = analyzer1.typeExpr(en);
00795 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00796 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::CHAR);
00797 }
00798
00799 {
00800
00801 NEXT_EXPR(n, en);
00802 tn = analyzer1.typeExpr(en);
00803 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00804 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT);
00805 }
00806
00807 {
00808
00809 NEXT_EXPR(n, en);
00810 tn = analyzer1.typeExpr(en);
00811 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00812 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SLONG);
00813 }
00814
00815 {
00816
00817 NEXT_EXPR(n, en);
00818 tn = analyzer1.typeExpr(en);
00819 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00820 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::BOOL);
00821 }
00822
00823 {
00824
00825 NEXT_EXPR(n, en);
00826 tn = analyzer1.typeExpr(en);
00827 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00828 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT);
00829 }
00830
00831 {
00832
00833 NEXT_EXPR(n, en);
00834 tn = analyzer1.typeExpr(en);
00835 DCAST(pt1, const PointerType*, tn->getValueRef().type);
00836 DCAST(st1, const StructType*, pt1->getBaseType());
00837 }
00838
00839 {
00840
00841 NEXT_EXPR(n, en);
00842 tn = analyzer1.typeExpr(en);
00843 DCAST(bt0, const BasicType*, tn->getValueRef().type);
00844 CPPUNIT_ASSERT(bt0->getPrimitiveTag() == BasicType::SLONG);
00845 RefValueNode an = RefValueNode(en->getFirstChild()->getNextSibling());
00846
00847 CPPUNIT_ASSERT(an != NULL);
00848 tn = RefNode(an->getFirstChild());
00849 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00850 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SLLONG);
00851
00852 an = an->getNextSibling();
00853 CPPUNIT_ASSERT(an != NULL);
00854 tn = RefNode(an->getFirstChild());
00855 DCAST(bt2, const BasicType*, tn->getValueRef().type);
00856 CPPUNIT_ASSERT(bt2->getPrimitiveTag() == BasicType::SINT &&
00857 tn->getType() == CTokenTypes::NImplicitCast);
00858
00859 an = an->getNextSibling();
00860 CPPUNIT_ASSERT(an != NULL);
00861 tn = RefNode(an->getFirstChild());
00862 DCAST(bt3, const BasicType*, tn->getValueRef().type);
00863 CPPUNIT_ASSERT(bt3->getPrimitiveTag() == BasicType::SLONG &&
00864 tn->getType() == CTokenTypes::NImplicitCast);
00865
00866 an = an->getNextSibling();
00867 CPPUNIT_ASSERT(an != NULL);
00868 tn = RefNode(an->getFirstChild());
00869 DCAST(pt4, const PointerType*, tn->getValueRef().type);
00870 DCAST(bt4, const BasicType*, pt4->getBaseType());
00871 CPPUNIT_ASSERT(bt4->getPrimitiveTag() == BasicType::VOID &&
00872 tn->getType() == CTokenTypes::NImplicitCast);
00873
00874 an = an->getNextSibling();
00875 CPPUNIT_ASSERT(an != NULL);
00876 tn = RefNode(an->getFirstChild());
00877 DCAST(bt5, const BasicType*, tn->getValueRef().type);
00878 CPPUNIT_ASSERT(bt5->getPrimitiveTag() == BasicType::FLOAT);
00879
00880 an = an->getNextSibling();
00881 CPPUNIT_ASSERT(an != NULL);
00882 tn = RefNode(an->getFirstChild());
00883 DCAST(bt6, const BasicType*, tn->getValueRef().type);
00884 CPPUNIT_ASSERT(bt6->getPrimitiveTag() == BasicType::DOUBLE &&
00885 tn->getType() == CTokenTypes::NImplicitCast);
00886 }
00887
00888 {
00889
00890 NEXT_EXPR(n, en);
00891 tn = analyzer1.typeExpr(en);
00892 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00893 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::ULONG);
00894 }
00895 {
00896
00897 NEXT_EXPR(n, en);
00898 tn = analyzer1.typeExpr(en);
00899 DCAST(pt1, const PointerType*, tn->getValueRef().type);
00900 DCAST(st1, const StructType*, pt1->getBaseType());
00901 }
00902 {
00903
00904 NEXT_EXPR(n, en);
00905 tn = analyzer1.typeExpr(en);
00906 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00907 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT);
00908 }
00909 {
00910
00911 NEXT_EXPR(n, en);
00912 tn = analyzer1.typeExpr(en);
00913 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00914 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT);
00915 }
00916 {
00917
00918 NEXT_EXPR(n, en);
00919 tn = analyzer1.typeExpr(en);
00920 DCAST(bt1, const BasicType*, tn->getValueRef().type);
00921 CPPUNIT_ASSERT(bt1->getPrimitiveTag() == BasicType::SINT &&
00922 tn->getFirstChild()->getType() == CTokenTypes::NImplicitCast);
00923 }
00924 }
00925
00926
00927 void
00928 CParserTest::testTypeInitializer()
00929 {
00930 #define PREPARE_INITER(NAME_POSTFIX, EXPR_STR) \
00931 PREPARE_BASIC(NAME_POSTFIX, EXPR_STR); \
00932 parser##NAME_POSTFIX.declaration(NameDescription::TOPLEVEL); \
00933 RefValueNode d##NAME_POSTFIX = RefValueNode(parser##NAME_POSTFIX.getAST()); \
00934 RefValueNode idl##NAME_POSTFIX = RefValueNode(d##NAME_POSTFIX->getFirstChild()->getNextSibling()); \
00935 RefValueNode id##NAME_POSTFIX = RefValueNode(idl##NAME_POSTFIX->getFirstChild()); \
00936 RefValueNode i##NAME_POSTFIX = RefValueNode(id##NAME_POSTFIX->getNextSibling())
00937
00938 {
00939 PREPARE_INITER(1, "long a[] = { 0L, 1, 'a' };");
00940 CPPUNIT_ASSERT(i1->getType() == CTokenTypes::NCompoundInitializer);
00941
00942 RefValueNode ins = RefValueNode(i1->getFirstChild());
00943 RefValueNode e = RefValueNode(ins->getFirstChild()->getFirstChild());
00944 DCAST(b1, const BasicType*, e->getValueRef().type);
00945 CPPUNIT_ASSERT(b1->getPrimitiveTag() == BasicType::SLONG);
00946
00947 ins = RefValueNode(ins->getNextSibling());
00948 e = RefValueNode(ins->getFirstChild()->getFirstChild());
00949 DCAST(b2, const BasicType*, e->getValueRef().type);
00950 CPPUNIT_ASSERT(e->getType() == CTokenTypes::NImplicitCast &&
00951 b2->getPrimitiveTag() == BasicType::SLONG);
00952
00953 ins = RefValueNode(ins->getNextSibling());
00954 e = RefValueNode(ins->getFirstChild()->getFirstChild());
00955 DCAST(b3, const BasicType*, e->getValueRef().type);
00956 CPPUNIT_ASSERT(e->getType() == CTokenTypes::NImplicitCast &&
00957 b3->getPrimitiveTag() == BasicType::SLONG);
00958 CPPUNIT_ASSERT(ins->getNextSibling() == NULL);
00959 }
00960 {
00961 PREPARE_INITER(1, "struct S1 { char c1, c2; double d; } s1 = "
00962 "{ 7, 'A', 0.1 };");
00963 CPPUNIT_ASSERT(i1->getType() == CTokenTypes::NCompoundInitializer);
00964
00965 RefValueNode ins = RefValueNode(i1->getFirstChild());
00966 RefValueNode e = RefValueNode(ins->getFirstChild()->getFirstChild());
00967 DCAST(b1, const BasicType*, e->getValueRef().type);
00968 CPPUNIT_ASSERT(e->getType() == CTokenTypes::NImplicitCast &&
00969 b1->getPrimitiveTag() == BasicType::CHAR);
00970
00971 ins = RefValueNode(ins->getNextSibling());
00972 e = RefValueNode(ins->getFirstChild()->getFirstChild());
00973 DCAST(b2, const BasicType*, e->getValueRef().type);
00974 CPPUNIT_ASSERT(b2->getPrimitiveTag() == BasicType::CHAR);
00975
00976 ins = RefValueNode(ins->getNextSibling());
00977 e = RefValueNode(ins->getFirstChild()->getFirstChild());
00978 #ifdef PARSER_DEBUG
00979 std::cout << "Initer: " << e->toStringList() << std::endl;
00980 #endif
00981 DCAST(b3, const BasicType*, e->getValueRef().type);
00982 CPPUNIT_ASSERT(b3->getPrimitiveTag() == BasicType::DOUBLE);
00983 CPPUNIT_ASSERT(ins->getNextSibling() == NULL);
00984 }
00985 #undef PREPARE_INITER
00986 }