diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/benchmarks/createBenchmarks.pl | 50 | ||||
-rw-r--r-- | test/benchmarks/finalParallel.scxml | 786 | ||||
-rw-r--r-- | test/benchmarks/findLCCA.scxml | 2 | ||||
-rw-r--r-- | test/src/test-performance.cpp | 2 | ||||
-rw-r--r-- | test/src/test-state-pass.cpp | 5 |
5 files changed, 842 insertions, 3 deletions
diff --git a/test/benchmarks/createBenchmarks.pl b/test/benchmarks/createBenchmarks.pl index 231c843..088c020 100755 --- a/test/benchmarks/createBenchmarks.pl +++ b/test/benchmarks/createBenchmarks.pl @@ -74,17 +74,57 @@ sub createFindLCCANestedCompounds { push @{$$where}, $state; } +} + +sub createFinalParallelBenchmark { + my $where = shift; + + my $nestingDepth = 20; + my $finalStates = 20; + + $$where->{'name'} = 'finalParallel'; + $$where->{'type'} = 'scxml'; + $$where->{'intial'} = ""; + + $$where->{'children'}[0]->{'type'} = 'parallel'; + $$where->{'children'}[0]->{'id'} = "p0"; + + $$where->{'children'}[0]->{'transitions'}[0]->{'event'} = 'done.state.p0'; + $$where->{'children'}[0]->{'transitions'}[0]->{'target'} = 'p0'; + + for (my $i = 0; $i < $finalStates; $i++) { + createFinalParallelNestedFinals(\$$where->{'children'}[0]->{'children'}, $nestingDepth); + } } +sub createFinalParallelNestedFinals { + my $where = shift; + my $amount = shift; + + if ($amount > 0) { + my $state; + if ($amount == 1) { + $state->{'type'} = "final"; + } else { + $state->{'type'} = "state"; + } + $state->{'id'} = "id".$stateId++; + + createFinalParallelNestedFinals(\$state->{'children'}, $amount - 1); + + push @{$$where}, $state; + } + +} sub writeState { my $state = shift; my $fh = shift; print $fh '<'.$state->{'type'}; - print $fh ' id="'.$state->{'id'} . '"'; + print $fh ' id="'.$state->{'id'} . '"' if $state->{'id'}; print $fh ' type="deep"' if exists $state->{'deep'}; print $fh '>'; @@ -156,4 +196,12 @@ sub xmllint { # print Dumper($machine); writeMachine($machine, "findLCCA.scxml"); xmllint("findLCCA.scxml"); + + + $machine = {}; + $stateId = 1; + createFinalParallelBenchmark(\$machine); + writeMachine($machine, "finalParallel.scxml"); + xmllint("finalParallel.scxml"); + } diff --git a/test/benchmarks/finalParallel.scxml b/test/benchmarks/finalParallel.scxml new file mode 100644 index 0000000..415c4d2 --- /dev/null +++ b/test/benchmarks/finalParallel.scxml @@ -0,0 +1,786 @@ +<?xml version="1.0"?> +<scxml seed="681439801" name="finalParallel"> + <parallel id="p0"> + <state id="id1"> + <state id="id2"> + <state id="id3"> + <state id="id4"> + <state id="id5"> + <state id="id6"> + <state id="id7"> + <state id="id8"> + <state id="id9"> + <state id="id10"> + <state id="id11"> + <state id="id12"> + <state id="id13"> + <state id="id14"> + <state id="id15"> + <state id="id16"> + <state id="id17"> + <state id="id18"> + <state id="id19"> + <final id="id20"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id21"> + <state id="id22"> + <state id="id23"> + <state id="id24"> + <state id="id25"> + <state id="id26"> + <state id="id27"> + <state id="id28"> + <state id="id29"> + <state id="id30"> + <state id="id31"> + <state id="id32"> + <state id="id33"> + <state id="id34"> + <state id="id35"> + <state id="id36"> + <state id="id37"> + <state id="id38"> + <state id="id39"> + <final id="id40"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id41"> + <state id="id42"> + <state id="id43"> + <state id="id44"> + <state id="id45"> + <state id="id46"> + <state id="id47"> + <state id="id48"> + <state id="id49"> + <state id="id50"> + <state id="id51"> + <state id="id52"> + <state id="id53"> + <state id="id54"> + <state id="id55"> + <state id="id56"> + <state id="id57"> + <state id="id58"> + <state id="id59"> + <final id="id60"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id61"> + <state id="id62"> + <state id="id63"> + <state id="id64"> + <state id="id65"> + <state id="id66"> + <state id="id67"> + <state id="id68"> + <state id="id69"> + <state id="id70"> + <state id="id71"> + <state id="id72"> + <state id="id73"> + <state id="id74"> + <state id="id75"> + <state id="id76"> + <state id="id77"> + <state id="id78"> + <state id="id79"> + <final id="id80"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id81"> + <state id="id82"> + <state id="id83"> + <state id="id84"> + <state id="id85"> + <state id="id86"> + <state id="id87"> + <state id="id88"> + <state id="id89"> + <state id="id90"> + <state id="id91"> + <state id="id92"> + <state id="id93"> + <state id="id94"> + <state id="id95"> + <state id="id96"> + <state id="id97"> + <state id="id98"> + <state id="id99"> + <final id="id100"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id101"> + <state id="id102"> + <state id="id103"> + <state id="id104"> + <state id="id105"> + <state id="id106"> + <state id="id107"> + <state id="id108"> + <state id="id109"> + <state id="id110"> + <state id="id111"> + <state id="id112"> + <state id="id113"> + <state id="id114"> + <state id="id115"> + <state id="id116"> + <state id="id117"> + <state id="id118"> + <state id="id119"> + <final id="id120"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id121"> + <state id="id122"> + <state id="id123"> + <state id="id124"> + <state id="id125"> + <state id="id126"> + <state id="id127"> + <state id="id128"> + <state id="id129"> + <state id="id130"> + <state id="id131"> + <state id="id132"> + <state id="id133"> + <state id="id134"> + <state id="id135"> + <state id="id136"> + <state id="id137"> + <state id="id138"> + <state id="id139"> + <final id="id140"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id141"> + <state id="id142"> + <state id="id143"> + <state id="id144"> + <state id="id145"> + <state id="id146"> + <state id="id147"> + <state id="id148"> + <state id="id149"> + <state id="id150"> + <state id="id151"> + <state id="id152"> + <state id="id153"> + <state id="id154"> + <state id="id155"> + <state id="id156"> + <state id="id157"> + <state id="id158"> + <state id="id159"> + <final id="id160"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id161"> + <state id="id162"> + <state id="id163"> + <state id="id164"> + <state id="id165"> + <state id="id166"> + <state id="id167"> + <state id="id168"> + <state id="id169"> + <state id="id170"> + <state id="id171"> + <state id="id172"> + <state id="id173"> + <state id="id174"> + <state id="id175"> + <state id="id176"> + <state id="id177"> + <state id="id178"> + <state id="id179"> + <final id="id180"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id181"> + <state id="id182"> + <state id="id183"> + <state id="id184"> + <state id="id185"> + <state id="id186"> + <state id="id187"> + <state id="id188"> + <state id="id189"> + <state id="id190"> + <state id="id191"> + <state id="id192"> + <state id="id193"> + <state id="id194"> + <state id="id195"> + <state id="id196"> + <state id="id197"> + <state id="id198"> + <state id="id199"> + <final id="id200"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id201"> + <state id="id202"> + <state id="id203"> + <state id="id204"> + <state id="id205"> + <state id="id206"> + <state id="id207"> + <state id="id208"> + <state id="id209"> + <state id="id210"> + <state id="id211"> + <state id="id212"> + <state id="id213"> + <state id="id214"> + <state id="id215"> + <state id="id216"> + <state id="id217"> + <state id="id218"> + <state id="id219"> + <final id="id220"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id221"> + <state id="id222"> + <state id="id223"> + <state id="id224"> + <state id="id225"> + <state id="id226"> + <state id="id227"> + <state id="id228"> + <state id="id229"> + <state id="id230"> + <state id="id231"> + <state id="id232"> + <state id="id233"> + <state id="id234"> + <state id="id235"> + <state id="id236"> + <state id="id237"> + <state id="id238"> + <state id="id239"> + <final id="id240"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id241"> + <state id="id242"> + <state id="id243"> + <state id="id244"> + <state id="id245"> + <state id="id246"> + <state id="id247"> + <state id="id248"> + <state id="id249"> + <state id="id250"> + <state id="id251"> + <state id="id252"> + <state id="id253"> + <state id="id254"> + <state id="id255"> + <state id="id256"> + <state id="id257"> + <state id="id258"> + <state id="id259"> + <final id="id260"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id261"> + <state id="id262"> + <state id="id263"> + <state id="id264"> + <state id="id265"> + <state id="id266"> + <state id="id267"> + <state id="id268"> + <state id="id269"> + <state id="id270"> + <state id="id271"> + <state id="id272"> + <state id="id273"> + <state id="id274"> + <state id="id275"> + <state id="id276"> + <state id="id277"> + <state id="id278"> + <state id="id279"> + <final id="id280"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id281"> + <state id="id282"> + <state id="id283"> + <state id="id284"> + <state id="id285"> + <state id="id286"> + <state id="id287"> + <state id="id288"> + <state id="id289"> + <state id="id290"> + <state id="id291"> + <state id="id292"> + <state id="id293"> + <state id="id294"> + <state id="id295"> + <state id="id296"> + <state id="id297"> + <state id="id298"> + <state id="id299"> + <final id="id300"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id301"> + <state id="id302"> + <state id="id303"> + <state id="id304"> + <state id="id305"> + <state id="id306"> + <state id="id307"> + <state id="id308"> + <state id="id309"> + <state id="id310"> + <state id="id311"> + <state id="id312"> + <state id="id313"> + <state id="id314"> + <state id="id315"> + <state id="id316"> + <state id="id317"> + <state id="id318"> + <state id="id319"> + <final id="id320"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id321"> + <state id="id322"> + <state id="id323"> + <state id="id324"> + <state id="id325"> + <state id="id326"> + <state id="id327"> + <state id="id328"> + <state id="id329"> + <state id="id330"> + <state id="id331"> + <state id="id332"> + <state id="id333"> + <state id="id334"> + <state id="id335"> + <state id="id336"> + <state id="id337"> + <state id="id338"> + <state id="id339"> + <final id="id340"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id341"> + <state id="id342"> + <state id="id343"> + <state id="id344"> + <state id="id345"> + <state id="id346"> + <state id="id347"> + <state id="id348"> + <state id="id349"> + <state id="id350"> + <state id="id351"> + <state id="id352"> + <state id="id353"> + <state id="id354"> + <state id="id355"> + <state id="id356"> + <state id="id357"> + <state id="id358"> + <state id="id359"> + <final id="id360"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id361"> + <state id="id362"> + <state id="id363"> + <state id="id364"> + <state id="id365"> + <state id="id366"> + <state id="id367"> + <state id="id368"> + <state id="id369"> + <state id="id370"> + <state id="id371"> + <state id="id372"> + <state id="id373"> + <state id="id374"> + <state id="id375"> + <state id="id376"> + <state id="id377"> + <state id="id378"> + <state id="id379"> + <final id="id380"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <state id="id381"> + <state id="id382"> + <state id="id383"> + <state id="id384"> + <state id="id385"> + <state id="id386"> + <state id="id387"> + <state id="id388"> + <state id="id389"> + <state id="id390"> + <state id="id391"> + <state id="id392"> + <state id="id393"> + <state id="id394"> + <state id="id395"> + <state id="id396"> + <state id="id397"> + <state id="id398"> + <state id="id399"> + <final id="id400"/> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + </state> + <transition target="p0" event="done.state.p0"/> + </parallel> +</scxml> diff --git a/test/benchmarks/findLCCA.scxml b/test/benchmarks/findLCCA.scxml index de2e8ce..068057f 100644 --- a/test/benchmarks/findLCCA.scxml +++ b/test/benchmarks/findLCCA.scxml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<scxml seed="341532910" name="findLCCA" initial="id20 id40 id60 id80 id100 id120 id140 id160 id180 id200 id220 id240 id260 id280 id300 id320 id340 id360 id380 id400 "> +<scxml seed="681439801" name="findLCCA" initial="id20 id40 id60 id80 id100 id120 id140 id160 id180 id200 id220 id240 id260 id280 id300 id320 id340 id360 id380 id400 "> <parallel id="p0"> <state id="id1"> <state id="id2"> diff --git a/test/src/test-performance.cpp b/test/src/test-performance.cpp index 4142b9d..13fc141 100644 --- a/test/src/test-performance.cpp +++ b/test/src/test-performance.cpp @@ -1,5 +1,6 @@ #include "uscxml/config.h" #include "uscxml/Interpreter.h" +#include "uscxml/debug/Benchmark.h" #include <chrono> #include <iostream> @@ -43,4 +44,5 @@ int main(int argc, char** argv) { iterations = 0; } } + Benchmark::report(std::cout); } diff --git a/test/src/test-state-pass.cpp b/test/src/test-state-pass.cpp index 33f13ac..c07523e 100644 --- a/test/src/test-state-pass.cpp +++ b/test/src/test-state-pass.cpp @@ -79,7 +79,10 @@ int main(int argc, char** argv) { while(state != USCXML_FINISHED) { state = interpreter.step(); } - assert(interpreter.isInState("pass")); + if (interpreter.isInState("pass")) + return EXIT_SUCCESS; + return EXIT_FAILURE; + } catch (Event e) { std::cerr << "Thrown Event out of Interpreter: " << e; return EXIT_FAILURE; |