From 3e5d63b0224c3673521e786c37f5b09f81285fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20FERET?= Date: Sun, 10 Mar 2024 09:06:52 +0100 Subject: [PATCH] integration tests for #683 --- .../compiler/counters_empty_interface/README | 1 + .../counters_empty_interface.ka | 4 ++ .../counters_empty_interface/output/LOG.ref | 17 +++++ .../output/error.log.ref | 29 ++++++++ .../compiler/counters_empty_lhs/README | 1 + .../counters_empty_lhs/counters_empty_lhs.ka | 4 ++ .../counters_empty_lhs/output/LOG.ref | 17 +++++ .../counters_empty_lhs/output/error.log.ref | 28 ++++++++ .../compiler/counters_enumerate/README | 1 + .../counters_enumerate/counters_enumerate.ka | 8 +++ .../counters_enumerate/output/LOG.ref | 17 +++++ .../counters_enumerate/output/error.log.ref | 72 +++++++++++++++++++ 12 files changed, 199 insertions(+) create mode 100644 tests/integration/compiler/counters_empty_interface/README create mode 100644 tests/integration/compiler/counters_empty_interface/counters_empty_interface.ka create mode 100644 tests/integration/compiler/counters_empty_interface/output/LOG.ref create mode 100644 tests/integration/compiler/counters_empty_interface/output/error.log.ref create mode 100644 tests/integration/compiler/counters_empty_lhs/README create mode 100644 tests/integration/compiler/counters_empty_lhs/counters_empty_lhs.ka create mode 100644 tests/integration/compiler/counters_empty_lhs/output/LOG.ref create mode 100644 tests/integration/compiler/counters_empty_lhs/output/error.log.ref create mode 100644 tests/integration/compiler/counters_enumerate/README create mode 100644 tests/integration/compiler/counters_enumerate/counters_enumerate.ka create mode 100644 tests/integration/compiler/counters_enumerate/output/LOG.ref create mode 100644 tests/integration/compiler/counters_enumerate/output/error.log.ref diff --git a/tests/integration/compiler/counters_empty_interface/README b/tests/integration/compiler/counters_empty_interface/README new file mode 100644 index 000000000..bb356cf08 --- /dev/null +++ b/tests/integration/compiler/counters_empty_interface/README @@ -0,0 +1 @@ +"${KAPPABIN}"KaSim --compile counters_empty_interface.ka || true diff --git a/tests/integration/compiler/counters_empty_interface/counters_empty_interface.ka b/tests/integration/compiler/counters_empty_interface/counters_empty_interface.ka new file mode 100644 index 000000000..fbdd3d9f5 --- /dev/null +++ b/tests/integration/compiler/counters_empty_interface/counters_empty_interface.ka @@ -0,0 +1,4 @@ +%agent: A() +%agent: B(x,c{=0 / +=3}) + +A() -> . @1 diff --git a/tests/integration/compiler/counters_empty_interface/output/LOG.ref b/tests/integration/compiler/counters_empty_interface/output/LOG.ref new file mode 100644 index 000000000..973dcdbe0 --- /dev/null +++ b/tests/integration/compiler/counters_empty_interface/output/LOG.ref @@ -0,0 +1,17 @@ +Parsing counters_empty_interface.ka... +done ++ simulation parameters ++ Sanity checks ++ Compiling... ++ Building initial simulation conditions... + -variable declarations + -rules + -interventions + -observables + -update_domain construction + 8 (sub)observables 0 navigation steps + -initial conditions ++ Self seeding... ++ Building initial state (0 agents) +Done ++ Command line to rerun is: 'KaSim' '--compile' 'counters_empty_interface.ka' -seed 701950535 diff --git a/tests/integration/compiler/counters_empty_interface/output/error.log.ref b/tests/integration/compiler/counters_empty_interface/output/error.log.ref new file mode 100644 index 000000000..aeed06d57 --- /dev/null +++ b/tests/integration/compiler/counters_empty_interface/output/error.log.ref @@ -0,0 +1,29 @@ +_____(1) +A()- +_____(1) +B(c{>=4}) +Environment: + + %agent: A() + %agent: B(x c{=0/+=3}) + + %plot: [T] + A()- @ 1 + /*0*/%mod: (|B(c{=4})| = 1) do $PRINTF ""; $PRINTF "Counter c of agent B reached maximum"; $STOP "counter_perturbation.ka"; repeat [false] + Rules: + 0: (ast: 1) 0: /*cc1*/ A/*1*/() -- A/*1*//*0*/ ++ @1 +Polymers: + __counter_agent.a-b. +Domain: + /*cc0*/ -> () + /*cc1*/ A/*1*/() [rate_of_rule [0]] -> () + /*cc2*/ B/*2*/(c{=4}) [intervention [0]] -> () + /*cc3*/ -> () + /*cc4*/ -> () + /*cc5*/ -> () + /*cc6*/ -> () + /*cc7*/ B/*2*/(x[.]) -> () + /*cc8*/ B/*2*/(c[.]) -> () +Intial graph; + + diff --git a/tests/integration/compiler/counters_empty_lhs/README b/tests/integration/compiler/counters_empty_lhs/README new file mode 100644 index 000000000..ba3e0acb0 --- /dev/null +++ b/tests/integration/compiler/counters_empty_lhs/README @@ -0,0 +1 @@ +"${KAPPABIN}"KaSim --compile counters_empty_lhs.ka || true diff --git a/tests/integration/compiler/counters_empty_lhs/counters_empty_lhs.ka b/tests/integration/compiler/counters_empty_lhs/counters_empty_lhs.ka new file mode 100644 index 000000000..df9d159ea --- /dev/null +++ b/tests/integration/compiler/counters_empty_lhs/counters_empty_lhs.ka @@ -0,0 +1,4 @@ +%agent: A() +%agent: B(x,c{=0 / +=3}) + +. -> A() @1 diff --git a/tests/integration/compiler/counters_empty_lhs/output/LOG.ref b/tests/integration/compiler/counters_empty_lhs/output/LOG.ref new file mode 100644 index 000000000..d5dbad6dc --- /dev/null +++ b/tests/integration/compiler/counters_empty_lhs/output/LOG.ref @@ -0,0 +1,17 @@ +Parsing counters_empty_lhs.ka... +done ++ simulation parameters ++ Sanity checks ++ Compiling... ++ Building initial simulation conditions... + -variable declarations + -rules + -interventions + -observables + -update_domain construction + 7 (sub)observables 0 navigation steps + -initial conditions ++ Self seeding... ++ Building initial state (0 agents) +Done ++ Command line to rerun is: 'KaSim' '--compile' 'counters_empty_lhs.ka' -seed 897249907 diff --git a/tests/integration/compiler/counters_empty_lhs/output/error.log.ref b/tests/integration/compiler/counters_empty_lhs/output/error.log.ref new file mode 100644 index 000000000..cb6ef0b5e --- /dev/null +++ b/tests/integration/compiler/counters_empty_lhs/output/error.log.ref @@ -0,0 +1,28 @@ +_____(1) +A()+ +_____(1) +B(c{>=4}) +Environment: + + %agent: A() + %agent: B(x c{=0/+=3}) + + %plot: [T] + A()+ @ 1 + /*0*/%mod: (|B(c{=4})| = 1) do $PRINTF ""; $PRINTF "Counter c of agent B reached maximum"; $STOP "counter_perturbation.ka"; repeat [false] + Rules: + 0: (ast: 1) -- ++ A/*ν 0*/ @1 +Polymers: + __counter_agent.a-b. +Domain: + /*cc0*/ -> () + /*cc1*/ B/*1*/(c{=4}) [intervention [0]] -> () + /*cc2*/ -> () + /*cc3*/ -> () + /*cc4*/ -> () + /*cc5*/ -> () + /*cc6*/ B/*1*/(x[.]) -> () + /*cc7*/ B/*1*/(c[.]) -> () +Intial graph; + + diff --git a/tests/integration/compiler/counters_enumerate/README b/tests/integration/compiler/counters_enumerate/README new file mode 100644 index 000000000..047e2d81a --- /dev/null +++ b/tests/integration/compiler/counters_enumerate/README @@ -0,0 +1 @@ +"${KAPPABIN}"KaSim --compile counters_enumerate.ka || true diff --git a/tests/integration/compiler/counters_enumerate/counters_enumerate.ka b/tests/integration/compiler/counters_enumerate/counters_enumerate.ka new file mode 100644 index 000000000..11a55e8be --- /dev/null +++ b/tests/integration/compiler/counters_enumerate/counters_enumerate.ka @@ -0,0 +1,8 @@ +%agent: A() +%agent: B(c{=0 / +=2}) +%init: 40 A() + +A() -> . @ 1 +. -> A() @ 1 +A(),B(c{=x}) -> .,B(c{+=0}) @ x +.,B(c{=x}) -> A(),B(c{+=0}) @ x diff --git a/tests/integration/compiler/counters_enumerate/output/LOG.ref b/tests/integration/compiler/counters_enumerate/output/LOG.ref new file mode 100644 index 000000000..bf6b834b9 --- /dev/null +++ b/tests/integration/compiler/counters_enumerate/output/LOG.ref @@ -0,0 +1,17 @@ +Parsing counters_enumerate.ka... +done ++ simulation parameters ++ Sanity checks ++ Compiling... ++ Building initial simulation conditions... + -variable declarations + -rules + -interventions + -observables + -update_domain construction + 11 (sub)observables 9 navigation steps + -initial conditions ++ Self seeding... ++ Building initial state (40 agents) +Done ++ Command line to rerun is: 'KaSim' '--compile' 'counters_enumerate.ka' -seed 202629756 diff --git a/tests/integration/compiler/counters_enumerate/output/error.log.ref b/tests/integration/compiler/counters_enumerate/output/error.log.ref new file mode 100644 index 000000000..bc365dbf4 --- /dev/null +++ b/tests/integration/compiler/counters_enumerate/output/error.log.ref @@ -0,0 +1,72 @@ +_____(1) +A()- +_____(1) +A()+ +_____(1) +B(c{=0}), A()- +_____(1) +B(c{=1}), A()- +_____(1) +B(c{=2}), A()- +_____(1) +B(c{=0}), A()+ +_____(1) +B(c{=1}), A()+ +_____(1) +B(c{=2}), A()+ +_____(1) +B(c{>=3}) +_____(1) +A()+ +Environment: + + %agent: A() + %agent: B(c{=0/+=2}) + + %plot: [T] + A()- @ 1 + A()+ @ 1 + B(c{=0}), A()- @ 0 + B(c{=1}), A()- @ 1 + B(c{=2}), A()- @ 2 + B(c{=0}), A()+ @ 0 + B(c{=1}), A()+ @ 1 + B(c{=2}), A()+ @ 2 + + /*0*/%mod: (|B(c{=3})| = 1) do $PRINTF ""; $PRINTF "Counter c of agent B reached maximum"; $STOP "counter_perturbation.ka"; repeat [false] + Rules: + 0: (ast: 1) 0: /*cc1*/ A/*1*/() -- A/*1*//*0*/ ++ @1 + 1: (ast: 2) -- ++ A/*ν 0*/ @1 + 2: (ast: 3) 0: /*cc2*/ B/*2*/(c{=0}), 1: /*cc1*/ A/*1*/() -- A/*1*//*1*/ + ++ @0 + 3: (ast: 4) 0: /*cc3*/ B/*2*/(c{=1}), 1: /*cc1*/ A/*1*/() -- A/*1*//*1*/ + ++ @1 + 4: (ast: 5) 0: /*cc4*/ B/*2*/(c{=2}), 1: /*cc1*/ A/*1*/() -- A/*1*//*1*/ + ++ @2 + 5: (ast: 6) 0: /*cc2*/ B/*2*/(c{=0}) -- ++ A/*ν 0*/ @0 + 6: (ast: 7) 0: /*cc3*/ B/*2*/(c{=1}) -- ++ A/*ν 0*/ @1 + 7: (ast: 8) 0: /*cc4*/ B/*2*/(c{=2}) -- ++ A/*ν 0*/ @2 +Polymers: + +Domain: + /*cc0*/ -> () + /*cc1*/ A/*1*/() + [rate_of_rule [0] rate_of_rule [2] rate_of_rule [3] rate_of_rule [4]] + -> () + /*cc2*/ B/*2*/(c{=0}) [rate_of_rule [2] rate_of_rule [5]] -> () + /*cc3*/ B/*2*/(c{=1}) [rate_of_rule [3] rate_of_rule [6]] -> () + /*cc4*/ B/*2*/(c{=2}) [rate_of_rule [4] rate_of_rule [7]] -> () + /*cc5*/ B/*2*/(c{=3}) [intervention [0]] -> () + /*cc6*/ -> () + /*cc7*/ -> () + /*cc8*/ -> () + /*cc9*/ B/*2*/(c{=0}) + -> (-3(b[a.!__counter_agent-4])->-4(b[a.!__counter_agent-5])->-5(b[a.!__counter_agent-6])->() + 5 + -3(b[a.!__counter_agent-4])->-4(b[a.!__counter_agent-5])->-5(b[.])->() + 4 -3(b[a.!__counter_agent-4])->-4(b[.])->() 3 -3(b[.])->() 2) + /*cc10*/ -> () + /*cc11*/ B/*2*/(c[.]) -> () +Intial graph; + %init: 40 A() +