-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add spec test for the mountain car example #176
base: main
Are you sure you want to change the base?
Conversation
src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala
Show resolved
Hide resolved
src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala
Outdated
Show resolved
Hide resolved
src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala
Outdated
Show resolved
Hide resolved
val positions = Gen.choose[Double] (-1.2, 0.5) | ||
val velocities = Gen.choose[Double] (-1.5,1.5) | ||
val negPos = Gen.choose[Double] (-1.2, -1.1) | ||
val actions = Gen.oneOf (MountainCar.instances.enumAction.membersAscending) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead val use given
for actions
// Tests | ||
|
||
"Achieving goal state from state (0.0, 0.0) is impossible" in check { | ||
forAll (actions) { a => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove (actions)
src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala
Outdated
Show resolved
Hide resolved
src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala
Outdated
Show resolved
Hide resolved
src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala
Outdated
Show resolved
Hide resolved
} | ||
|
||
"moving to the left bound of position is possible" in check { | ||
forAllNoShrink (velocities, actions) { (v, a) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forAll
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, write for specific values of v, p, a to make the test more efficient.
cab5e53
to
623ef54
Compare
There was a bug in the step function that is corrected now. It was a swapped position and velocity values. #166