Skip to content

Commit

Permalink
Update apalache integration test for compile
Browse files Browse the repository at this point in the history
We now test that identifiers are sanitized, that imports and instances
are resolved as expected, and that the unit is represented correctly.
  • Loading branch information
Shon Feder committed Mar 14, 2024
1 parent 2c03d46 commit a742359
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 15 deletions.
41 changes: 26 additions & 15 deletions quint/apalache-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,34 +224,45 @@ An example execution:

### Test that we can compile to TLA+ of the expected form

<!-- !test in can convert booleans.qnt to TLA+ -->
<!-- !test in can convert ApalacheCompliation.qnt to TLA+ -->
```
quint compile --target tlaplus ../examples/language-features/booleans.qnt
quint compile --target tlaplus ./testFixture/ApalacheCompilation.qnt
```

<!-- !test out can convert booleans.qnt to TLA+ -->
<!-- !test out can convert ApalacheCompliation.qnt to TLA+ -->
```
------------------------------- MODULE booleans -------------------------------
-------------------------- MODULE ApalacheCompilation --------------------------
EXTENDS Integers, Sequences, FiniteSets, TLC, Apalache
VARIABLE b
VARIABLE x
step ==
(b \/ TRUE)
/\ ~(b /\ FALSE)
/\ (b => b)
/\ (b <=> b)
/\ b = b
/\ b /= (~b)
/\ b' := (~b)
A == Variant("A", <<>>)
init == b' := TRUE
B(__BParam_27) == Variant("B", __BParam_27)
foo_bar(id__123_31) == id__123_31
importedValue == 0
ApalacheCompilation_ModuleToInstantiate_C == 0
step == x' := (x + 1)
inv == x >= 0
ApalacheCompilation_ModuleToInstantiate_instantiatedValue ==
ApalacheCompilation_ModuleToInstantiate_C
init ==
x'
:= (importedValue
+ ApalacheCompilation_ModuleToInstantiate_instantiatedValue)
================================================================================
```

### Test that we can compile a module with imports and instances to TLA+
### Test that we can compile a module to TLA+ that instantiates but has not declarations


<!-- !test in can convert clockSync3.qnt to TLA+ -->
Expand Down
35 changes: 35 additions & 0 deletions quint/testFixture/ApalacheCompilation.qnt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module ModuleToInstantiate {
const C: int

val instantiatedValue = C
}

module ModuleToImport {
val importedValue = 0
}

module ApalacheCompilation {
// Tests whether we can compile imports
import ModuleToImport.*

// Tests whether we can compile instantiations
import ModuleToInstantiate(C = 0).*

var x: int

type T =
| A // Test whether we represent the unit correctly
| B(int)

// Tests whether we will sanitize identifiers
def foo::bar(__123) = __123

// TODO: Tests that we remove primes from assignments in the init functino
action init = {
x' = importedValue + instantiatedValue
}

action step = x' = x + 1

def inv = x >= 0
}

0 comments on commit a742359

Please sign in to comment.