diff --git a/tests/integration/compiler/counters_smaller_than/README b/tests/integration/compiler/counters_smaller_than/README new file mode 100644 index 000000000..3e10065cf --- /dev/null +++ b/tests/integration/compiler/counters_smaller_than/README @@ -0,0 +1,2 @@ +#Command-line: +"${KAPPABIN}"KaSim -l 1 counters_smaller_than.ka -seed 23014 -d output -syntax 4 || true diff --git a/tests/integration/compiler/counters_smaller_than/counters_smaller_than.ka b/tests/integration/compiler/counters_smaller_than/counters_smaller_than.ka new file mode 100644 index 000000000..1b2a9d07c --- /dev/null +++ b/tests/integration/compiler/counters_smaller_than/counters_smaller_than.ka @@ -0,0 +1,21 @@ +%agent: A(c{=0 / += 7}) +%agent: B() + +'rule_a' A(c{<=2}) -> A(c{+=1}) @ 1 +'rule_b' A(c{>=5}) -> A(c{-=1}) @ 1 +'rule_c' A(c{=3}) -> A(c{+=1}) @ 1 +'rule_aa' A(c{<=1}),. -> ., B() @ 0.2 + +%init: 10 A(c{=0}) +%init: 10 A(c{=7}) + +// %obs: 'A' |A()| +%obs: 'B' |B()| +%obs: 'A0' |A(c{=0})| +%obs: 'A1' |A(c{=1})| +%obs: 'A2' |A(c{=2})| +%obs: 'A3' |A(c{=3})| +%obs: 'A4' |A(c{=4})| +%obs: 'A5' |A(c{=5})| +%obs: 'A6' |A(c{=6})| +%obs: 'A7' |A(c{=7})| diff --git a/tests/integration/compiler/counters_smaller_than/output/LOG.ref b/tests/integration/compiler/counters_smaller_than/output/LOG.ref new file mode 100644 index 000000000..2c9d6f0d4 --- /dev/null +++ b/tests/integration/compiler/counters_smaller_than/output/LOG.ref @@ -0,0 +1,19 @@ +Parsing counters_smaller_than.ka... +done ++ simulation parameters ++ Sanity checks ++ Compiling... ++ Building initial simulation conditions... + -variable declarations + -rules + -interventions + -observables + -update_domain construction + 28 (sub)observables 58 navigation steps + -initial conditions ++ Building initial state (200 agents) +Done ++ Command line to rerun is: 'KaSim' '-l' '1' 'counters_smaller_than.ka' '-seed' '23014' '-d' 'output' '-syntax' '4' +______________________________________________________________________ +###################################################################### +Simulation ended diff --git a/tests/integration/compiler/counters_smaller_than/output/data.csv.ref b/tests/integration/compiler/counters_smaller_than/output/data.csv.ref new file mode 100644 index 000000000..4a807970b --- /dev/null +++ b/tests/integration/compiler/counters_smaller_than/output/data.csv.ref @@ -0,0 +1,4 @@ +# Output of 'KaSim' '-l' '1' 'counters_smaller_than.ka' '-seed' '23014' '-d' 'output' '-syntax' '4' +"[T]","B","A0","A1","A2","A3","A4","A5","A6","A7" +0.,0,10,0,0,0,0,0,0,10 +1.,2,3,2,2,0,1,2,3,5 diff --git a/tests/integration/compiler/counters_smaller_than/output/error.log.ref b/tests/integration/compiler/counters_smaller_than/output/error.log.ref new file mode 100644 index 000000000..e69de29bb diff --git a/tests/integration/compiler/counters_smaller_than/output/inputs.ka.ref b/tests/integration/compiler/counters_smaller_than/output/inputs.ka.ref new file mode 100644 index 000000000..836df5b98 --- /dev/null +++ b/tests/integration/compiler/counters_smaller_than/output/inputs.ka.ref @@ -0,0 +1,44 @@ +%def: "seed" "23014" +%def: "dumpIfDeadlocked" "true" +%def: "maxConsecutiveClash" "3" +%def: "progressBarSize" "70" +%def: "progressBarSymbol" "#" +%def: "plotPeriod" "1" "t.u." +%def: "outputFileName" "data.csv" + + +%agent: A(c{=0/+=7} c__inverted{=0/+=7}) +%agent: B() + +%var:/*0*/ 'B' |B()| +%var:/*1*/ 'A0' |A(c{=0})| +%var:/*2*/ 'A1' |A(c{=1})| +%var:/*3*/ 'A2' |A(c{=2})| +%var:/*4*/ 'A3' |A(c{=3})| +%var:/*5*/ 'A4' |A(c{=4})| +%var:/*6*/ 'A5' |A(c{=5})| +%var:/*7*/ 'A6' |A(c{=6})| +%var:/*8*/ 'A7' |A(c{=7})| +%plot: [T] +%plot: B +%plot: A0 +%plot: A1 +%plot: A2 +%plot: A3 +%plot: A4 +%plot: A5 +%plot: A6 +%plot: A7 + +'rule_a' A(c{>=0/+=1} c__inverted{>=5/+=-1}) @ 1 +'rule_b' A(c{>=5/+=-1} c__inverted{>=0/+=1}) @ 1 +'rule_c' A(c{=3/+=1} c__inverted{>=1/+=-1}) @ 1 +'rule_aa' A(c[#] c__inverted{>=6})-, B()+ @ 0.2 + +/*0*/%mod: (|A(c__inverted{=8})| = 1) do $PRINTF ""; $PRINTF "Counter c__inverted of agent A reached maximum"; $STOP "counter_perturbation.ka"; repeat [false] +/*1*/%mod: (|A(c{=8})| = 1) do $PRINTF ""; $PRINTF "Counter c of agent A reached maximum"; $STOP "counter_perturbation.ka"; repeat [false] + +%init: 10 A(c{=0} c__inverted{=7}) +%init: 10 A(c{=7} c__inverted{=0}) + +%mod: [E] = 19 do $STOP;