Skip to content

Add spec test for the mountain car example#176

Open
mohsen-ghaffari1992 wants to merge 3 commits into
mainfrom
mountainCarSpec_branch
Open

Add spec test for the mountain car example#176
mohsen-ghaffari1992 wants to merge 3 commits into
mainfrom
mountainCarSpec_branch

Conversation

@mohsen-ghaffari1992

@mohsen-ghaffari1992 mohsen-ghaffari1992 commented Nov 10, 2022

Copy link
Copy Markdown
Collaborator

There was a bug in the step function that is corrected now. It was a swapped position and velocity values. #166

@wasowski wasowski changed the title Spec test for mountain car Add spec test for the mountain car example Nov 15, 2022
Comment thread src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala Outdated
Comment thread src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala Outdated
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)

Copy link
Copy Markdown
Member

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 =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove (actions)

Comment thread src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala Outdated
Comment thread src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala Outdated
Comment thread src/test/scala/symsim/examples/concrete/mountaincar/MountainCarSpec.scala Outdated
}

"moving to the left bound of position is possible" in check {
forAllNoShrink (velocities, actions) { (v, a) =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forAll

Copy link
Copy Markdown
Member

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.

@wasowski wasowski force-pushed the mountainCarSpec_branch branch from cab5e53 to 623ef54 Compare November 15, 2022 12:21
@wasowski wasowski added the paper label Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants