Changeset 1009


Ignore:
Timestamp:
07/15/20 00:19:52 (4 years ago)
Author:
Maciej Komosinski
Message:

Added tests for most SDK demo programs

Location:
cpp
Files:
33 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/evol_test.cpp

    r1008 r1009  
    127127                //TODO add b - bounding box volume (from Model), s - surface area (from geometry), v - volume (from geometry), h,w,d - three consecutive dimensions (from geometry)
    128128
    129                 printf("\nThe output contains 7 columns separated by the TAB character.\n");
     129                printf("\nThe output consists of 7 columns separated by the TAB character.\n");
    130130                printf("The first column is the number of mutated or crossed over and evaluated genotypes.\n");
    131131                printf("The remaining columns are triplets of min,avg,max (in the population) of fitness, Parts, Joints, Neurons, Connections, genotype characters.\n");
     
    192192                if (i % population.size() == 0 || i == nr_evals - 1)
    193193                {
    194                         printf("Evaluation %d\t", i);
     194                        printf("Evaluation %d", i);
    195195                        for (char c : string("!PJNCL"))
    196196                        {
     197                                printf("\t");
    197198                                print_stats(population, c);
    198                                 printf("\t");
    199199                        }
    200200                        printf("\n");
     
    204204        {
    205205                printf("%.1f\t", ind.fitness);
    206                 printf("%s\n", ind.geno.getGenes().c_str());
     206                printf("%s\n", ind.geno.getGenesAndFormat().c_str());
    207207        }
    208208
  • cpp/frams/_demos/full_props.cpp

    r999 r1009  
    6363                        {
    6464                        case 'r': reverse = true; break;
    65                         case 'h': puts("usage: full_props [-r[everse]] [genotype_or_stdin]\n"); break;
     65                        case 'h': puts("Usage: full_props [-r[everse]] [genotype_or_stdin]\n"); break;
    6666                        }
    6767                else
     
    7979        if (!m.isValid())
    8080        {
    81                 logPrintf("", "full_props", LOG_ERROR, "Cannot build Model from the supplied genotype\n");
     81                logPrintf("full_props", "main", LOG_ERROR, "Cannot build Model from the supplied genotype.\n");
    8282                return 2;
    8383        }
     
    8888                Neuro *n = m.getNeuro(i);
    8989                SyntParam p = n->classProperties(reverse);
    90                 p.update();// ...so everyone reading the source can recognize that p was created to update the neuro d field
    91                 // but actually, calling update() here is not necessary, because ~SyntParam() would do it anyway
     90                p.update();// ...so everyone reading the source can recognize that p was created to update the neuro d field;
     91                // but actually, calling update() here is not necessary, because the ~SyntParam() destructor would do it anyway.
    9292        }
    9393        m.close();
    9494
    95         // normal f0 (omitting default values) would be retrieved using m.getF0Geno()
    96         // the following form allows for more control:
     95        // Normal f0 (omitting default values) would be retrieved using m.getF0Geno().
     96        // The following form allows for more control:
    9797        Geno f0_g;
    98         m.makeGeno(f0_g, NULL, reverse);//third arg is "handle_defaults" == whether f0 should omit default property values
     98        m.makeGeno(f0_g, NULL, reverse);//The third argument is "handle_defaults" == whether f0 should omit default property values
    9999        puts(f0_g.getGenesAndFormat().c_str());
    100100
    101101        return 0;
    102102}
    103 
  • cpp/frams/_demos/genomanipulation.cpp

    r999 r1009  
    378378                "     need to uncomment srand(time(0)) in genomanipulation.cpp.\n"
    379379                "  3. This application will use custom genotype passed as\n"
    380                 "     a commandline parameter: genomanipulation XX\n"
     380                "     a commandline parameter: genomanipulation \"/*9*/FULU\"\n"
    381381                "\n");
    382382        return 0;
  • cpp/tests/SDK-tests.txt

    r798 r1009  
    1 exe:geno_test
     1exe:geno_test.exe
    22
    33TESTNAME:geno_test valid f1
     
    3636RUNTEST
    3737
    38 ##################################
     38################################## another executable... ##################################
    3939
    4040exe:full_props
     
    4444out:*INSERTPLATFORMDEPENDENTFILE*:full_props_x
    4545RUNTEST
     46
     47TESTNAME:full_props with a more complex genotype
     48arg:FIX[@,p:0.6543,1:-1.23456]X[G]
     49out:*INSERTPLATFORMDEPENDENTFILE*:full_props-complex
     50RUNTEST
     51
     52TESTNAME:full_props with fS
     53arg:/*S*/1.1:ssC[S;S;S]{ry=-0.214;ty=0.781}fSC[S;S;*;M'4:-5.154;M'0]fE[M;Gpart]{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;z=1}ttC[*;*;Gpart]{st=0.262}fTE{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;y=1;z=1}ftC[*;*;N'0'2'3'9'12'14]{ry=-0.199;y=0.828;z=0.806}
     54out:*INSERTPLATFORMDEPENDENTFILE*:full_props-fS
     55RUNTEST
     56
     57################################## another executable... ##################################
     58
     59exe:f0_variants_test
     60
     61TESTNAME:f0_variants_test
     62out:*INSERTPLATFORMDEPENDENTFILE*:f0_variants_test-default
     63RUNTEST
     64
     65TESTNAME:f0_variants_test with a more complex genotype
     66arg:FIX[@,p:0.6543,1:-1.23456]X[G]
     67out:*INSERTPLATFORMDEPENDENTFILE*:f0_variants_test-complex
     68RUNTEST
     69
     70TESTNAME:f0_variants_test with fS
     71arg:/*S*/1.1:ssC[S;S;S]{ry=-0.214;ty=0.781}fSC[S;S;*;M'4:-5.154;M'0]fE[M;Gpart]{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;z=1}ttC[*;*;Gpart]{st=0.262}fTE{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;y=1;z=1}ftC[*;*;N'0'2'3'9'12'14]{ry=-0.199;y=0.828;z=0.806}
     72out:*INSERTPLATFORMDEPENDENTFILE*:f0_variants_test-fS
     73RUNTEST
     74
     75################################## another executable... ##################################
     76
     77exe:genoconv_test
     78
     79TESTNAME:genoconv_test
     80out:*INSERTPLATFORMDEPENDENTFILE*:genoconv_test-default
     81RUNTEST
     82
     83TESTNAME:genoconv_test with a more complex genotype
     84arg:FIX[@,p:0.6543,1:-1.23456]X[G]
     85out:*INSERTPLATFORMDEPENDENTFILE*:genoconv_test-complex
     86RUNTEST
     87
     88TESTNAME:genoconv_test with a simple multiplying converter
     89arg:/*multiply*/2X2r3X2(X2)
     90out:*INSERTPLATFORMDEPENDENTFILE*:genoconv_test-simplemultiply
     91RUNTEST
     92
     93TESTNAME:genoconv_test with a simple solid-shape converter
     94arg:/*shapes*/ball,cube,cylinder,cube
     95out:*INSERTPLATFORMDEPENDENTFILE*:genoconv_test-simplesolids
     96RUNTEST
     97
     98################################## another executable... ##################################
     99
     100exe:genomanipulation
     101
     102TESTNAME:genomanipulation
     103out:*INSERTPLATFORMDEPENDENTFILE*:genomanipulation-default
     104RUNTEST
     105
     106TESTNAME:genomanipulation with a more complex genotype
     107arg:FIX[@,p:0.6543,1:-1.23456]X[G]
     108out:*INSERTPLATFORMDEPENDENTFILE*:genomanipulation-complex
     109RUNTEST
     110
     111TESTNAME:genomanipulation with fS
     112arg:/*S*/1.1:ssC[S;S;S]{ry=-0.214;ty=0.781}fSC[S;S;*;M'4:-5.154;M'0]fE[M;Gpart]{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;z=1}ttC[*;*;Gpart]{st=0.262}fTE{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;y=1;z=1}ftC[*;*;N'0'2'3'9'12'14]{ry=-0.199;y=0.828;z=0.806}
     113out:*INSERTPLATFORMDEPENDENTFILE*:genomanipulation-fS
     114RUNTEST
     115
     116################################## another executable... ##################################
     117
     118exe:genooper_test
     119
     120TESTNAME:genooper_test
     121out:*INSERTPLATFORMDEPENDENTFILE*:genooper_test-default
     122#RUNTEST #fS unstable and crashes all the time, so commented out
     123#make deterministic?
     124
     125TESTNAME:genooper_test with a more complex genotype
     126arg:/*4*/<<N:ML<rCXm>N:T>N:T><N:T><X>N:@[G:2.427]
     127out:*INSERTPLATFORMDEPENDENTFILE*:genooper_test-complex
     128#RUNTEST
     129
     130################################## another executable... ##################################
     131
     132TESTNAME:genooper_test_fTest
     133exe:genooper_test_fTest
     134out:*INSERTPLATFORMDEPENDENTFILE*:genooper_test_fTest
     135RUNTEST
     136
     137################################## another executable... ##################################
     138
     139TESTNAME:loader_test_geno
     140exe:loader_test_geno
     141arg:similarity.gen
     142arg:Spiral plant
     143out:*INSERTPLATFORMDEPENDENTFILE*:loader_test_geno
     144RUNTEST
     145
     146################################## another executable... ##################################
     147
     148TESTNAME:loader_test_param
     149exe:loader_test_param
     150arg:../frams/_demos/loader_test_param.in
     151out:*INSERTPLATFORMDEPENDENTFILE*:loader_test_param
     152RUNTEST
     153
     154################################## another executable... ##################################
     155
     156exe:multiline_f0_test
     157
     158TESTNAME:multiline_f0_test default
     159out:*INSERTPLATFORMDEPENDENTFILE*:multiline_f0_test-default
     160RUNTEST
     161
     162TESTNAME:multiline_f0_test with complex genotype
     163arg:FIX[@,p:0.6543,1:-1.23456]X[G]
     164out:*INSERTPLATFORMDEPENDENTFILE*:multiline_f0_test-complex
     165RUNTEST
     166
     167TESTNAME:multiline_f0_test with fS
     168arg:/*S*/1.1:ssC[S;S;S]{ry=-0.214;ty=0.781}fSC[S;S;*;M'4:-5.154;M'0]fE[M;Gpart]{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;z=1}ttC[*;*;Gpart]{st=0.262}fTE{rx=0.603;ry=-0.9391;rz=0.3034;tx=0.6534;ty=0.6856;tz=-0.166;x=1;y=1;z=1}ftC[*;*;N'0'2'3'9'12'14]{ry=-0.199;y=0.828;z=0.806}
     169out:*INSERTPLATFORMDEPENDENTFILE*:multiline_f0_test-fS
     170RUNTEST
     171
     172################################## another executable... ##################################
     173
     174TESTNAME:mutableparam_test
     175exe:mutableparam_test
     176out:*INSERTPLATFORMDEPENDENTFILE*:mutableparam_test
     177RUNTEST
     178
     179################################## another executable... ##################################
     180
     181TESTNAME:neuro_layout_test
     182exe:neuro_layout_test
     183arg:/*4*/<lX>CfmQ<,fm<<<<rFX>N:N[-2:-0.202]>X>mfrm<<<N:M<rFX>N:N[-2:3.64]>XF>mN:*>N:T>N:T>m<m<<<N:M<r<r<<N:M<rX>N:N[-2:0.58]>X>qfrm<<<N:M<rFX>N:N[-2:3.64]>XF>mN:*>N:T>N:N[-2:-0.495]>N:N[-2:-0.495]>X>qfm<<imN:*><XF>N:M<rFX>N:N[-2:3.64]>N:T>N:T>N:T
     184out:*INSERTPLATFORMDEPENDENTFILE*:neuro_layout_test
     185RUNTEST
     186
     187################################## another executable... ##################################
     188
     189TESTNAME:neuro_test
     190exe:neuro_test
     191arg:X[N][Nu][G][Gpart][T][Tcontact][Tproximity][S][*][|][@][M][D][DoesNotExist][Fuzzy][VEye][VMotor][Sti][LMu][Water][Energy][Ch][ChMux][ChSel][Rnd][Sin][Delay][Light][Nn][PIDP][PIDV][SeeLight][SeeLight2][S0][S1][Thr]
     192arg:30
     193out:*INSERTPLATFORMDEPENDENTFILE*:neuro_test
     194RUNTEST
     195
     196################################## another executable... ##################################
     197
     198TESTNAME:paramtree_paramlist_test
     199exe:paramtree_paramlist_test
     200out:*INSERTPLATFORMDEPENDENTFILE*:paramtree_paramlist_test
     201RUNTEST
     202
     203################################## another executable... ##################################
     204
     205TESTNAME:paramtree_stdin_test
     206exe:paramtree_stdin_test
     207in:a
     208in:a: b: d
     209in:a: z
     210in:a: b
     211in:a: b: c
     212in:a: y
     213in:A
     214out:*INSERTPLATFORMDEPENDENTFILE*:paramtree_stdin_test
     215RUNTEST
     216
     217################################## another executable... ##################################
     218
     219TESTNAME:part_shapes
     220exe:part_shapes
     221out:*INSERTPLATFORMDEPENDENTFILE*:part_shapes
     222RUNTEST
     223
     224################################## another executable... ##################################
     225
     226TESTNAME:saver_test_geno
     227exe:saver_test_geno
     228arg:_tmp_saver_test_output.gen
     229arg:7
     230out:*INSERTPLATFORMDEPENDENTFILE*:saver_test_geno
     231RUNTEST
     232# we could also verify the contents of the saved file, but for this we would need a way to print it (in frams we use a script function to do this)
     233
     234################################## another executable... ##################################
     235
     236exe:serial_test
     237
     238TESTNAME:serial_test
     239out:*INSERTPLATFORMDEPENDENTFILE*:serial_test
     240RUNTEST
     241
     242# TESTNAME:serial_test custom
     243# out:*INSERTPLATFORMDEPENDENTFILE*:serial_test-custom
     244# arg:{"2":[1]}
     245# RUNTEST
     246
     247# Even though the command is launched correctly from python: ['../serial_test', '{"2":[1]}'] the executable in cygwin does not get its argument: 'input string = ' with default settings and input string = {\2\:[1]} with CYGWIN=noglob.
     248# The problem is with characters like {} and "", and CYGWIN=noglob is supposed to fix this (it fixes the same problems with {}), but there are some bugs and it is not fixed.
     249
     250################################## another executable... ##################################
     251
     252TESTNAME:shapeconvert
     253exe:shapeconvert
     254out:*INSERTPLATFORMDEPENDENTFILE*:shapeconvert
     255arg:FIX[@,p:0.6543,1:-1.23456](X[G],XX)
     256RUNTEST
     257
     258################################## another executable... ##################################
     259
     260exe:evol_test
     261
     262TESTNAME:evol_test f9
     263arg:1
     264arg:10
     265arg:100
     266arg:0.6
     267arg:0.4
     268arg:9
     269arg:PJNCL
     270out:*INSERTPLATFORMDEPENDENTFILE*:evol_test-f9
     271RUNTEST
     272
     273TESTNAME:evol_test f4
     274arg:1
     275arg:10
     276arg:100
     277arg:0.6
     278arg:0.4
     279arg:4
     280arg:PJNCL
     281out:*INSERTPLATFORMDEPENDENTFILE*:evol_test-f4
     282RUNTEST
     283
     284TESTNAME:evol_test fH
     285arg:1
     286arg:10
     287arg:100
     288arg:0.6
     289arg:0.4
     290arg:H
     291arg:PJNCL
     292out:*INSERTPLATFORMDEPENDENTFILE*:evol_test-fH
     293RUNTEST
     294
     295TESTNAME:evol_test fB
     296arg:1
     297arg:10
     298arg:100
     299arg:0.6
     300arg:0.4
     301arg:B
     302arg:PJNCL
     303out:*INSERTPLATFORMDEPENDENTFILE*:evol_test-fB
     304RUNTEST
     305
     306TESTNAME:evol_test fL
     307arg:1
     308arg:10
     309arg:100
     310arg:0.6
     311arg:0.4
     312arg:L
     313arg:PJNCL
     314out:*INSERTPLATFORMDEPENDENTFILE*:evol_test-fL
     315RUNTEST
     316
     317TESTNAME:evol_test fS
     318arg:1
     319arg:10
     320arg:100
     321arg:0.6
     322arg:0.4
     323arg:S
     324arg:PJNCL
     325out:*INSERTPLATFORMDEPENDENTFILE*:evol_test-fS
     326RUNTEST
Note: See TracChangeset for help on using the changeset viewer.