Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
2d0bff2b
Commit
2d0bff2b
authored
9 years ago
by
Mikaël Mayer
Browse files
Options
Downloads
Patches
Plain Diff
Reformatted examples and added two not yet parsing testcases.
parent
c7f8f236
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
testcases/stringrender/BinaryTreeRender.scala
+11
-11
11 additions, 11 deletions
testcases/stringrender/BinaryTreeRender.scala
testcases/stringrender/Example-Stack.scala
+95
-0
95 additions, 0 deletions
testcases/stringrender/Example-Stack.scala
with
106 additions
and
11 deletions
testcases/stringrender/BinaryTreeRender.scala
+
11
−
11
View file @
2d0bff2b
...
@@ -17,53 +17,53 @@ object TreeRender {
...
@@ -17,53 +17,53 @@ object TreeRender {
case
class
Leaf
[
T
]()
extends
Tree
[
T
]
case
class
Leaf
[
T
]()
extends
Tree
[
T
]
/** Synthesis by example specs */
/** Synthesis by example specs */
@inline
def
psStandard
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psStandard
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"Node(Node(Leaf(), 2, Leaf()), 1, Node(Leaf(), -3, Leaf()))"
case
Node
(
Node
(
Leaf
[
Int
]
(),
2
,
Leaf
[
Int
]
()),
1
,
Node
(
Leaf
[
Int
]
(),
-
3
,
Leaf
[
Int
]
()))
=>
"Node(Node(Leaf(), 2, Leaf()), 1, Node(Leaf(), -3, Leaf()))"
case
Node
(
Leaf
(),
1
,
Leaf
())
=>
"Node(Leaf(), 1, Leaf())"
case
Node
(
Leaf
[
Int
]
(),
1
,
Leaf
[
Int
]
())
=>
"Node(Leaf(), 1, Leaf())"
case
Leaf
()
=>
"Leaf()"
case
Leaf
[
Int
]
()
=>
"Leaf()"
}
}
@inline
def
psRemoveNode
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psRemoveNode
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"((Leaf(), 2, Leaf()), 1, (Leaf(), -3, Leaf()))"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"((Leaf(), 2, Leaf()), 1, (Leaf(), -3, Leaf()))"
case
Node
(
Leaf
(),
1
,
Leaf
())
=>
"(Leaf(), 1, Leaf())"
case
Node
(
Leaf
(),
1
,
Leaf
())
=>
"(Leaf(), 1, Leaf())"
case
Leaf
()
=>
"Leaf()"
case
Leaf
()
=>
"Leaf()"
}
}
@inline
def
psRemoveLeaf
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psRemoveLeaf
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"((, 2, ), 1, (, -3, ))"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"((, 2, ), 1, (, -3, ))"
case
Node
(
Leaf
(),
1
,
Leaf
())
=>
"(, 1, )"
case
Node
(
Leaf
(),
1
,
Leaf
())
=>
"(, 1, )"
case
Leaf
()
=>
""
case
Leaf
()
=>
""
}
}
@inline
def
psRemoveComma
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psRemoveComma
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"((2), 1, (-3))"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"((2), 1, (-3))"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"(1, (2))"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"(1, (2))"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"((2), 1)"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"((2), 1)"
case
Leaf
()
=>
""
case
Leaf
()
=>
""
}
}
@inline
def
psRemoveParentheses
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psRemoveParentheses
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"(2), 1, (-3)"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"(2), 1, (-3)"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"1, (2)"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"1, (2)"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"(2), 1"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"(2), 1"
case
Leaf
()
=>
""
case
Leaf
()
=>
""
}
}
@inline
def
psPrefix
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psPrefix
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"1 (2) (-3)"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"1 (2) (-3)"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"1 () (2)"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"1 () (2)"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"1 (2) ()"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"1 (2) ()"
case
Leaf
()
=>
"()"
case
Leaf
()
=>
"()"
}
}
@inline
def
psLispLike
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psLispLike
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"(1 (2) (-3))"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"(1 (2) (-3))"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"(1 () (2))"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"(1 () (2))"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"(1 (2) ())"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"(1 (2) ())"
case
Leaf
()
=>
"()"
case
Leaf
()
=>
"()"
}
}
@inline
def
psSuffix
(
s
:
Tree
[
Int
])(
res
:
String
)
=
(
s
,
res
)
passes
{
@inline
def
psSuffix
(
s
:
Tree
[
Int
])
=
(
res
:
String
)
=
>
(
s
,
res
)
passes
{
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"(2) (-3) 1"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Node
(
Leaf
(),
-
3
,
Leaf
()))
=>
"(2) (-3) 1"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"() (2) 1"
case
Node
(
Leaf
(),
1
,
Node
(
Leaf
(),
2
,
Leaf
()))
=>
"() (2) 1"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"(2) () 1"
case
Node
(
Node
(
Leaf
(),
2
,
Leaf
()),
1
,
Leaf
())
=>
"(2) () 1"
...
...
This diff is collapsed.
Click to expand it.
testcases/stringrender/Example-Stack.scala
+
95
−
0
View file @
2d0bff2b
...
@@ -385,5 +385,100 @@ object AtomicStack {
...
@@ -385,5 +385,100 @@ object AtomicStack {
"T1: call Push(5)\nT1: internal\nT2: call Pop()\nT1: ret Push(5)\nT2: internal\nT2: ret Pop() -> 5"
"T1: call Push(5)\nT1: internal\nT2: call Pop()\nT1: ret Push(5)\nT2: internal\nT2: ret Pop() -> 5"
}
}
}
}
// Warning: Spacing differs from records to records.
// Warning: The displaying of a tuple might depend on its operands.
/*def configurationToString(p: List[Configuration[StackTid, StackMethodName, Option[BigInt], StackState, List[BigInt]]]): String = {
???[String]
} ensuring {
res => (p, res) passes {
case Cons(Configuration(Nil(), Map(T1() -> Some((Push(), Some(BigInt(5)), ValueState(BigInt(5)))))),
Cons(Configuration(Cons(5, Nil()), Map(T1() -> Some((Push(), Some(BigInt(5)), FinalState())))),
Cons(Configuration(Cons(5, Nil()), Map(T2() -> Some((Pop(), None(), InitState())), T1() -> Some((Push(), Some(BigInt(5)), FinalState())))),
Cons(Configuration(Cons(5, Nil()), Map(T2() -> Some((Pop(), None(), InitState())), T1() -> None())),
Cons(Configuration(Nil(), Map(T2() -> Some((Pop(), None(), ValueState(BigInt(5)))), T1() -> None())),
Cons(Configuration(Nil(), Map(T2() -> None(), T1() -> None())), Nil())))))) =>
"""([], {
T1 -> Push(5): ValueState(5)
})
([5], {
T1 -> Push(5): FinalState
})
([5], {
T2 -> Pop(): InitState;
T1 -> Push(5): FinalState
})
([5], {
T2 -> Pop(): InitState;
T1 -> idle
})
([], {
T2 -> Pop(): ValueState(5);
T1 -> idle
})
([], {
T2 -> idle;
T1 -> idle
})"""
}
}
/// Out of order configurationToString
def configurationToStringOOO(p: List[Configuration[StackTid, StackMethodName, Option[BigInt], StackState, List[BigInt]]]): String = {
???[String]
} ensuring {
res => (p, res) passes {
case Cons(Configuration(Nil(), Map(T1() -> Some((Push(), Some(BigInt(5)), ValueState(BigInt(5)))))),
Cons(Configuration(Cons(BigInt(5), Nil()), Map(T1() -> Some((Push(), Some(BigInt(5)), FinalState())))),
Cons(Configuration(Cons(BigInt(5), Nil()), Map(T2() -> Some((Pop(), None(), InitState())), T1() -> Some((Push(), Some(BigInt(5)), FinalState())))),
Cons(Configuration(Cons(BigInt(5), Nil()), Map(T2() -> Some((Pop(), None(), InitState())), T1() -> None())),
Cons(Configuration(Nil(), Map(T2() -> Some((Pop(), None(), ValueState(BigInt(5)))), T1() -> None())),
Cons(Configuration(Nil(), Map(T2() -> None(), T1() -> None())), Nil())))))) =>
"""([], {
T1 -> ValueState(5) in Push(5)
})
([5], {
T1 -> FinalState in Push(5)
})
([5], {
T2 -> InitState in Pop();
T1 -> FinalState in Push(5)
})
([5], {
T2 -> InitState in Pop();
T1 -> idle
})
([], {
T2 -> ValueState(5) in Pop();
T1 -> idle
})
([], {
T2 -> idle;
T1 -> idle
})"""
}
}*/
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment