• R/O
  • SSH
  • HTTPS

eircompile: Commit


Commit MetaInfo

Revision71 (tree)
Time2022-01-03 05:06:57
Authorquiret

Log Message

- added COS initialized declaration unit tests

Change Summary

Incremental Difference

--- testcompiler/src/cos_tests.cpp (revision 70)
+++ testcompiler/src/cos_tests.cpp (revision 71)
@@ -2950,8 +2950,24 @@
29502950 auto special_declinit = lexer.MakeStep <decltype(lexer)::RuntimeEnv::StepCustomIndirection> ();
29512951
29522952 // INDEX 0: array enclosure.
2953- auto *step_arrenclose = lexer.CompileInto( compiler, special_declinit, "'{' spaces ([initexpr, spaces ',' spaces] spaces)^0:1 '}'" );
2953+ auto *step_arrenclose = lexer.CompileInto( compiler, special_declinit, "'{' spaces ([item:initexpr, spaces ',' spaces] spaces)^0:1 '}'" );
2954+ {
2955+ struct arrenclose_dispatcher
2956+ {
2957+ static inline bool AssignNodeTo( ArrayDefinition *assign_to, const eir::FixedString <char>& attrib, COSNode *node )
2958+ {
2959+ if ( attrib == "item" )
2960+ {
2961+ assign_to->items.AddToBack( node );
2962+ return true;
2963+ }
29542964
2965+ return false;
2966+ }
2967+ };
2968+ step_arrenclose->setSelector <direct_obj_build_selector <char, ArrayDefinition, COSNode, arrenclose_dispatcher, decltype(lexer)::RuntimeEnv>> ( &lexer.GetRuntimeEnvironment() );
2969+ }
2970+
29552971 // INDEX 1: outer value.
29562972 auto *step_outerval = lexer.CompileInto( compiler, special_declinit, "'{' spaces operation spaces '}'" );
29572973
@@ -3012,20 +3028,23 @@
30123028 {
30133029 // Go as deep as required by init_depth to find the init-type.
30143030 COSNode *init_type = type;
3015-
3016- while ( init_depth > 0 )
30173031 {
3018- init_depth--;
3032+ size_t init_iter = init_depth;
30193033
3020- if ( TypeSpecifier *ptrspec = dynamic_cast <TypeSpecifier*> ( init_type ) )
3034+ while ( init_iter > 0 )
30213035 {
3022- init_type = ptrspec->spec;
3036+ init_iter--;
3037+
3038+ if ( TypeSpecifier *ptrspec = dynamic_cast <TypeSpecifier*> ( init_type ) )
3039+ {
3040+ init_type = ptrspec->spec;
3041+ }
3042+ else
3043+ {
3044+ // Unknown.
3045+ return nullptr;
3046+ }
30233047 }
3024- else
3025- {
3026- // Unknown.
3027- return nullptr;
3028- }
30293048 }
30303049
30313050 if ( dynamic_cast <ArrayTypeSpecifier*> ( init_type ) )
@@ -7931,4 +7950,596 @@
79317950 }
79327951 }
79337952 printf( "ok.\n" );
7953+
7954+ printf( "testing COS initialized declarations..." );
7955+ {
7956+ // 1)
7957+ {
7958+ COSNode *_root = lexer.StartProduction( "int a = 0;" );
7959+
7960+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
7961+
7962+ assert( root != nullptr );
7963+
7964+ SpecifierString *type = dynamic_cast <SpecifierString*> ( root->type );
7965+
7966+ assert( type != nullptr );
7967+ assert( type->string == "int" );
7968+
7969+ type->Delete();
7970+
7971+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
7972+
7973+ assert( name != nullptr );
7974+ assert( name->string == "a" );
7975+
7976+ name->Delete();
7977+
7978+ NumberString *init = dynamic_cast <NumberString*> ( root->initializer );
7979+
7980+ assert( init != nullptr );
7981+ assert( init->numeric_string == "0" );
7982+
7983+ init->Delete();
7984+ root->Delete();
7985+ }
7986+
7987+ // 2)
7988+ {
7989+ COSNode *_root = lexer.StartProduction( "void func myway(bool b){ b = false; }" );
7990+
7991+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
7992+
7993+ assert( root != nullptr );
7994+
7995+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
7996+
7997+ assert( name != nullptr );
7998+ assert( name->string == "myway" );
7999+
8000+ name->Delete();
8001+
8002+ FuncsigDefinition *type = dynamic_cast <FuncsigDefinition*> ( root->type );
8003+
8004+ assert( type != nullptr );
8005+ assert( type->params.GetCount() == 1 );
8006+
8007+ SpecifierString *type_rtype = dynamic_cast <SpecifierString*> ( type->return_type );
8008+
8009+ assert( type_rtype != nullptr );
8010+ assert( type_rtype->string == "void" );
8011+
8012+ type_rtype->Delete();
8013+
8014+ DeclarationStatement *type_p1 = dynamic_cast <DeclarationStatement*> ( type->params[0] );
8015+
8016+ assert( type_p1 != nullptr );
8017+ assert( type_p1->initializer == nullptr );
8018+
8019+ SpecifierString *type_p1_type = dynamic_cast <SpecifierString*> ( type_p1->type );
8020+
8021+ assert( type_p1_type != nullptr );
8022+ assert( type_p1_type->string == "bool" );
8023+
8024+ type_p1_type->Delete();
8025+
8026+ SpecifierString *type_p1_name = dynamic_cast <SpecifierString*> ( type_p1->name );
8027+
8028+ assert( type_p1_name != nullptr );
8029+ assert( type_p1_name->string == "b" );
8030+
8031+ type_p1_name->Delete();
8032+ type_p1->Delete();
8033+ type->Delete();
8034+ root->Delete();
8035+ }
8036+
8037+ // 3)
8038+ {
8039+ COSNode *_root = lexer.StartProduction( "float *p = nullptr;" );
8040+
8041+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8042+
8043+ assert( root != nullptr );
8044+
8045+ PointerTypeSpecifier *type = dynamic_cast <PointerTypeSpecifier*> ( root->type );
8046+
8047+ assert( type != nullptr );
8048+
8049+ SpecifierString *type_spec = dynamic_cast <SpecifierString*> ( type->spec );
8050+
8051+ assert( type_spec != nullptr );
8052+ assert( type_spec->string == "float" );
8053+
8054+ type_spec->Delete();
8055+ type->Delete();
8056+
8057+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8058+
8059+ assert( name != nullptr );
8060+ assert( name->string == "p" );
8061+
8062+ name->Delete();
8063+
8064+ SpecifierString *init = dynamic_cast <SpecifierString*> ( root->initializer );
8065+
8066+ assert( init != nullptr );
8067+ assert( init->string == "nullptr" );
8068+
8069+ init->Delete();
8070+ root->Delete();
8071+ }
8072+
8073+ // 4)
8074+ {
8075+ COSNode *_root = lexer.StartProduction( "int func (interrupts[]) ( int code ) {{return -1;},{g_var=code;return 1;}};" );
8076+
8077+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8078+
8079+ assert( root != nullptr );
8080+
8081+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8082+
8083+ assert( name != nullptr );
8084+ assert( name->string == "interrupts" );
8085+
8086+ name->Delete();
8087+
8088+ ArrayTypeSpecifier *type = dynamic_cast <ArrayTypeSpecifier*> ( root->type );
8089+
8090+ assert( type != nullptr );
8091+ assert( type->array_size_op == nullptr );
8092+
8093+ FuncsigDefinition *type_spec = dynamic_cast <FuncsigDefinition*> ( type->spec );
8094+
8095+ assert( type_spec != nullptr );
8096+ assert( type_spec->params.GetCount() == 1 );
8097+
8098+ SpecifierString *type_spec_rtype = dynamic_cast <SpecifierString*> ( type_spec->return_type );
8099+
8100+ assert( type_spec_rtype != nullptr );
8101+ assert( type_spec_rtype->string == "int" );
8102+
8103+ type_spec_rtype->Delete();
8104+
8105+ DeclarationStatement *type_spec_p1 = dynamic_cast <DeclarationStatement*> ( type_spec->params[0] );
8106+
8107+ assert( type_spec_p1 != nullptr );
8108+ assert( type_spec_p1->initializer == nullptr );
8109+
8110+ SpecifierString *type_spec_p1_type = dynamic_cast <SpecifierString*> ( type_spec_p1->type );
8111+
8112+ assert( type_spec_p1_type != nullptr );
8113+ assert( type_spec_p1_type->string == "int" );
8114+
8115+ type_spec_p1_type->Delete();
8116+
8117+ SpecifierString *type_spec_p1_name = dynamic_cast <SpecifierString*> ( type_spec_p1->name );
8118+
8119+ assert( type_spec_p1_name != nullptr );
8120+ assert( type_spec_p1_name->string == "code" );
8121+
8122+ type_spec_p1_name->Delete();
8123+ type_spec_p1->Delete();
8124+ type_spec->Delete();
8125+ type->Delete();
8126+
8127+ ArrayDefinition *init = dynamic_cast <ArrayDefinition*> ( root->initializer );
8128+
8129+ assert( init != nullptr );
8130+ assert( init->items.GetCount() == 2 );
8131+
8132+ BlockStatement *init_1 = dynamic_cast <BlockStatement*> ( init->items[0] );
8133+
8134+ assert( init_1 != nullptr );
8135+ assert( init_1->statements.GetCount() == 1 );
8136+
8137+ ReturnStatement *init_1_1 = dynamic_cast <ReturnStatement*> ( init_1->statements[0] );
8138+
8139+ assert( init_1_1 != nullptr );
8140+
8141+ NumericNegationOperation *init_1_1_op = dynamic_cast <NumericNegationOperation*> ( init_1_1->op );
8142+
8143+ assert( init_1_1_op != nullptr );
8144+
8145+ NumberString *init_1_1_op_op = dynamic_cast <NumberString*> ( init_1_1_op->op );
8146+
8147+ assert( init_1_1_op_op != nullptr );
8148+ assert( init_1_1_op_op->numeric_string == "1" );
8149+
8150+ init_1_1_op_op->Delete();
8151+ init_1_1_op->Delete();
8152+ init_1_1->Delete();
8153+ init_1->Delete();
8154+
8155+ BlockStatement *init_2 = dynamic_cast <BlockStatement*> ( init->items[1] );
8156+
8157+ assert( init_2 != nullptr );
8158+ assert( init_2->statements.GetCount() == 2 );
8159+
8160+ AssignmentOperation *init_2_1 = dynamic_cast <AssignmentOperation*> ( init_2->statements[0] );
8161+
8162+ assert( init_2_1 != nullptr );
8163+
8164+ SpecifierString *init_2_1_left = dynamic_cast <SpecifierString*> ( init_2_1->left );
8165+
8166+ assert( init_2_1_left != nullptr );
8167+ assert( init_2_1_left->string == "g_var" );
8168+
8169+ init_2_1_left->Delete();
8170+
8171+ SpecifierString *init_2_1_right = dynamic_cast <SpecifierString*> ( init_2_1->right );
8172+
8173+ assert( init_2_1_right != nullptr );
8174+ assert( init_2_1_right->string == "code" );
8175+
8176+ init_2_1_right->Delete();
8177+ init_2_1->Delete();
8178+
8179+ ReturnStatement *init_2_2 = dynamic_cast <ReturnStatement*> ( init_2->statements[1] );
8180+
8181+ assert( init_2_2 != nullptr );
8182+
8183+ NumberString *init_2_2_op = dynamic_cast <NumberString*> ( init_2_2->op );
8184+
8185+ assert( init_2_2_op != nullptr );
8186+ assert( init_2_2_op->numeric_string == "1" );
8187+
8188+ init_2_2_op->Delete();
8189+ init_2_2->Delete();
8190+ init_2->Delete();
8191+ init->Delete();
8192+ root->Delete();
8193+ }
8194+
8195+ // 5)
8196+ {
8197+ COSNode *_root = lexer.StartProduction( "void func (*protos[])(int) = {nullptr};" );
8198+
8199+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8200+
8201+ assert( root != nullptr );
8202+
8203+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8204+
8205+ assert( name != nullptr );
8206+ assert( name->string == "protos" );
8207+
8208+ name->Delete();
8209+
8210+ ArrayTypeSpecifier *type = dynamic_cast <ArrayTypeSpecifier*> ( root->type );
8211+
8212+ assert( type != nullptr );
8213+ assert( type->array_size_op == nullptr );
8214+
8215+ PointerTypeSpecifier *type_spec = dynamic_cast <PointerTypeSpecifier*> ( type->spec );
8216+
8217+ assert( type_spec != nullptr );
8218+
8219+ FuncsigDefinition *type_spec_spec = dynamic_cast <FuncsigDefinition*> ( type_spec->spec );
8220+
8221+ assert( type_spec_spec != nullptr );
8222+ assert( type_spec_spec->params.GetCount() == 1 );
8223+
8224+ SpecifierString *type_spec_spec_rtype = dynamic_cast <SpecifierString*> ( type_spec_spec->return_type );
8225+
8226+ assert( type_spec_spec_rtype != nullptr );
8227+ assert( type_spec_spec_rtype->string == "void" );
8228+
8229+ type_spec_spec_rtype->Delete();
8230+
8231+ DeclarationStatement *type_spec_spec_p1 = dynamic_cast <DeclarationStatement*> ( type_spec_spec->params[0] );
8232+
8233+ assert( type_spec_spec_p1 != nullptr );
8234+ assert( type_spec_spec_p1->name == nullptr );
8235+ assert( type_spec_spec_p1->initializer == nullptr );
8236+
8237+ SpecifierString *type_spec_spec_p1_type = dynamic_cast <SpecifierString*> ( type_spec_spec_p1->type );
8238+
8239+ assert( type_spec_spec_p1_type != nullptr );
8240+ assert( type_spec_spec_p1_type->string == "int" );
8241+
8242+ type_spec_spec_p1_type->Delete();
8243+ type_spec_spec_p1->Delete();
8244+ type_spec_spec->Delete();
8245+ type_spec->Delete();
8246+ type->Delete();
8247+
8248+ ArrayDefinition *init = dynamic_cast <ArrayDefinition*> ( root->initializer );
8249+
8250+ assert( init != nullptr );
8251+ assert( init->items.GetCount() == 1 );
8252+
8253+ SpecifierString *init_1 = dynamic_cast <SpecifierString*> ( init->items[0] );
8254+
8255+ assert( init_1 != nullptr );
8256+ assert( init_1->string == "nullptr" );
8257+
8258+ init_1->Delete();
8259+ init->Delete();
8260+ root->Delete();
8261+ }
8262+
8263+ // 6)
8264+ {
8265+ // NOT YET SUPPORTED (?)
8266+ }
8267+
8268+ // 7)
8269+ {
8270+ COSNode *_root = lexer.StartProduction( "float vector[] = {0,1,2};" );
8271+
8272+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8273+
8274+ assert( root != nullptr );
8275+
8276+ ArrayTypeSpecifier *type = dynamic_cast <ArrayTypeSpecifier*> ( root->type );
8277+
8278+ assert( type != nullptr );
8279+ assert( type->array_size_op == nullptr );
8280+
8281+ SpecifierString *type_spec = dynamic_cast <SpecifierString*> ( type->spec );
8282+
8283+ assert( type_spec != nullptr );
8284+ assert( type_spec->string == "float" );
8285+
8286+ type_spec->Delete();
8287+ type->Delete();
8288+
8289+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8290+
8291+ assert( name != nullptr );
8292+ assert( name->string == "vector" );
8293+
8294+ name->Delete();
8295+
8296+ ArrayDefinition *init = dynamic_cast <ArrayDefinition*> ( root->initializer );
8297+
8298+ assert( init != nullptr );
8299+ assert( init->items.GetCount() == 3 );
8300+
8301+ NumberString *init_1 = dynamic_cast <NumberString*> ( init->items[0] );
8302+
8303+ assert( init_1 != nullptr );
8304+ assert( init_1->numeric_string == "0" );
8305+
8306+ init_1->Delete();
8307+
8308+ NumberString *init_2 = dynamic_cast <NumberString*> ( init->items[1] );
8309+
8310+ assert( init_2 != nullptr );
8311+ assert( init_2->numeric_string == "1" );
8312+
8313+ init_2->Delete();
8314+
8315+ NumberString *init_3 = dynamic_cast <NumberString*> ( init->items[2] );
8316+
8317+ assert( init_3 != nullptr );
8318+ assert( init_3->numeric_string == "2" );
8319+
8320+ init_3->Delete();
8321+ init->Delete();
8322+ root->Delete();
8323+ }
8324+
8325+ // 8)
8326+ {
8327+ COSNode *_root = lexer.StartProduction( "double matrix[][] = {{7,3},{5,8}};" );
8328+
8329+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8330+
8331+ assert( root != nullptr );
8332+
8333+ ArrayTypeSpecifier *type = dynamic_cast <ArrayTypeSpecifier*> ( root->type );
8334+
8335+ assert( type != nullptr );
8336+ assert( type->array_size_op == nullptr );
8337+
8338+ ArrayTypeSpecifier *type_spec = dynamic_cast <ArrayTypeSpecifier*> ( type->spec );
8339+
8340+ assert( type_spec != nullptr );
8341+ assert( type_spec->array_size_op == nullptr );
8342+
8343+ SpecifierString *type_spec_spec = dynamic_cast <SpecifierString*> ( type_spec->spec );
8344+
8345+ assert( type_spec_spec != nullptr );
8346+ assert( type_spec_spec->string == "double" );
8347+
8348+ type_spec_spec->Delete();
8349+ type_spec->Delete();
8350+ type->Delete();
8351+
8352+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8353+
8354+ assert( name != nullptr );
8355+ assert( name->string == "matrix" );
8356+
8357+ name->Delete();
8358+
8359+ ArrayDefinition *init = dynamic_cast <ArrayDefinition*> ( root->initializer );
8360+
8361+ assert( init != nullptr );
8362+ assert( init->items.GetCount() == 2 );
8363+
8364+ ArrayDefinition *init_1 = dynamic_cast <ArrayDefinition*> ( init->items[0] );
8365+
8366+ assert( init_1 != nullptr );
8367+ assert( init_1->items.GetCount() == 2 );
8368+
8369+ NumberString *init_1_1 = dynamic_cast <NumberString*> ( init_1->items[0] );
8370+
8371+ assert( init_1_1 != nullptr );
8372+ assert( init_1_1->numeric_string == "7" );
8373+
8374+ init_1_1->Delete();
8375+
8376+ NumberString *init_1_2 = dynamic_cast <NumberString*> ( init_1->items[1] );
8377+
8378+ assert( init_1_2 != nullptr );
8379+ assert( init_1_2->numeric_string == "3" );
8380+
8381+ init_1_2->Delete();
8382+ init_1->Delete();
8383+
8384+ ArrayDefinition *init_2 = dynamic_cast <ArrayDefinition*> ( init->items[1] );
8385+
8386+ assert( init_2 != nullptr );
8387+ assert( init_2->items.GetCount() == 2 );
8388+
8389+ NumberString *init_2_1 = dynamic_cast <NumberString*> ( init_2->items[0] );
8390+
8391+ assert( init_2_1 != nullptr );
8392+ assert( init_2_1->numeric_string == "5" );
8393+
8394+ init_2_1->Delete();
8395+
8396+ NumberString *init_2_2 = dynamic_cast <NumberString*> ( init_2->items[1] );
8397+
8398+ assert( init_2_2 != nullptr );
8399+ assert( init_2_2->numeric_string == "8" );
8400+
8401+ init_2_2->Delete();
8402+ init_2->Delete();
8403+ init->Delete();
8404+ root->Delete();
8405+ }
8406+
8407+ // 9)
8408+ {
8409+ COSNode *_root = lexer.StartProduction( "int tab[]{42,9001};" );
8410+
8411+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8412+
8413+ assert( root != nullptr );
8414+
8415+ ArrayTypeSpecifier *type = dynamic_cast <ArrayTypeSpecifier*> ( root->type );
8416+
8417+ assert( type != nullptr );
8418+ assert( type->array_size_op == nullptr );
8419+
8420+ SpecifierString *type_spec = dynamic_cast <SpecifierString*> ( type->spec );
8421+
8422+ assert( type_spec != nullptr );
8423+ assert( type_spec->string == "int" );
8424+
8425+ type_spec->Delete();
8426+ type->Delete();
8427+
8428+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8429+
8430+ assert( name != nullptr );
8431+ assert( name->string == "tab" );
8432+
8433+ name->Delete();
8434+
8435+ ArrayDefinition *init = dynamic_cast <ArrayDefinition*> ( root->initializer );
8436+
8437+ assert( init != nullptr );
8438+ assert( init->items.GetCount() == 2 );
8439+
8440+ NumberString *init_1 = dynamic_cast <NumberString*> ( init->items[0] );
8441+
8442+ assert( init_1 != nullptr );
8443+ assert( init_1->numeric_string == "42" );
8444+
8445+ init_1->Delete();
8446+
8447+ NumberString *init_2 = dynamic_cast <NumberString*> ( init->items[1] );
8448+
8449+ assert( init_2 != nullptr );
8450+ assert( init_2->numeric_string == "9001" );
8451+
8452+ init_2->Delete();
8453+ init->Delete();
8454+ root->Delete();
8455+ }
8456+
8457+ // 10)
8458+ {
8459+ // NOT YET SUPPORTED (floating point numerical representation)
8460+ }
8461+
8462+ // 11)
8463+ {
8464+ COSNode *_root = lexer.StartProduction( "int imat[][]{{21,37},{80,28}};" );
8465+
8466+ DeclarationStatement *root = dynamic_cast <DeclarationStatement*> ( _root );
8467+
8468+ assert( root != nullptr );
8469+
8470+ ArrayTypeSpecifier *type = dynamic_cast <ArrayTypeSpecifier*> ( root->type );
8471+
8472+ assert( type != nullptr );
8473+ assert( type->array_size_op == nullptr );
8474+
8475+ ArrayTypeSpecifier *type_spec = dynamic_cast <ArrayTypeSpecifier*> ( type->spec );
8476+
8477+ assert( type_spec != nullptr );
8478+ assert( type_spec->array_size_op == nullptr );
8479+
8480+ SpecifierString *type_spec_spec = dynamic_cast <SpecifierString*> ( type_spec->spec );
8481+
8482+ assert( type_spec_spec != nullptr );
8483+ assert( type_spec_spec->string == "int" );
8484+
8485+ type_spec_spec->Delete();
8486+ type_spec->Delete();
8487+ type->Delete();
8488+
8489+ SpecifierString *name = dynamic_cast <SpecifierString*> ( root->name );
8490+
8491+ assert( name != nullptr );
8492+ assert( name->string == "imat" );
8493+
8494+ name->Delete();
8495+
8496+ ArrayDefinition *init = dynamic_cast <ArrayDefinition*> ( root->initializer );
8497+
8498+ assert( init != nullptr );
8499+ assert( init->items.GetCount() == 2 );
8500+
8501+ ArrayDefinition *init_1 = dynamic_cast <ArrayDefinition*> ( init->items[0] );
8502+
8503+ assert( init_1 != nullptr );
8504+ assert( init_1->items.GetCount() == 2 );
8505+
8506+ NumberString *init_1_1 = dynamic_cast <NumberString*> ( init_1->items[0] );
8507+
8508+ assert( init_1_1 != nullptr );
8509+ assert( init_1_1->numeric_string == "21" );
8510+
8511+ init_1_1->Delete();
8512+
8513+ NumberString *init_1_2 = dynamic_cast <NumberString*> ( init_1->items[1] );
8514+
8515+ assert( init_1_2 != nullptr );
8516+ assert( init_1_2->numeric_string == "37" );
8517+
8518+ init_1_2->Delete();
8519+ init_1->Delete();
8520+
8521+ ArrayDefinition *init_2 = dynamic_cast <ArrayDefinition*> ( init->items[1] );
8522+
8523+ assert( init_2 != nullptr );
8524+ assert( init_2->items.GetCount() == 2 );
8525+
8526+ NumberString *init_2_1 = dynamic_cast <NumberString*> ( init_2->items[0] );
8527+
8528+ assert( init_2_1 != nullptr );
8529+ assert( init_2_1->numeric_string == "80" );
8530+
8531+ init_2_1->Delete();
8532+
8533+ NumberString *init_2_2 = dynamic_cast <NumberString*> ( init_2->items[1] );
8534+
8535+ assert( init_2_2 != nullptr );
8536+ assert( init_2_2->numeric_string == "28" );
8537+
8538+ init_2_2->Delete();
8539+ init_2->Delete();
8540+ init->Delete();
8541+ root->Delete();
8542+ }
8543+ }
8544+ printf( "ok.\n" );
79348545 }
\ No newline at end of file
Show on old repository browser