Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mohsen-ghaffari1992
Copy link
Collaborator

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

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

Choose a reason for hiding this comment

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

remove (actions)

}

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

Choose a reason for hiding this comment

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

forAll

Copy link
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.

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