Coder Social home page Coder Social logo

Comments (4)

eiriniar avatar eiriniar commented on May 9, 2024

This is actually not true. PropEr postconditions should be expressed in terms of the state prior to command execution (i.e. State, not State2).

The idea of "postcondition(S, C, Result) -> X" is to express constraints of the form:
when being in state S and performing call C, postcondition X should hold for the Result of the call.

from proper.

davisp avatar davisp commented on May 9, 2024

Oh. Weird. Although I think I see what you mean. For instance, [1] is some code to test basical add/lookup operations on a btree. Currently the postcondition for the add call is checking that the KVs added are present in the state (which seemed reasonable and lead me to think proper had the bug).

Given your comment, it sounds more like I should really only be making assertions about Result in that call. Plus one could argue that the current thing is really testing dict more than the btree I think. Does that sound right?

[1] https://gist.github.com/1364115

from proper.

eiriniar avatar eiriniar commented on May 9, 2024

I see what you mean, your assumption is reasonable. But then, it is also reasonable that you may want to check the Result of a call, given the context (i.e. state) in which that call was performed, not given the resulting state.
So in our approach, we assume that an error will be detected as an unexpected result of a call. Even if this is not captured
by a false postcondition right after the call, chances are high that it will become obvious sooner or later because of some state inconsistency. And then shrinking helps you identify it.

from proper.

davisp avatar davisp commented on May 9, 2024

Yeah, I'm pretty sure I see the zen there. I just had my initial assumption and then looked at the code and saw the post condition being evaluated after the state was updated and assumed it was a bug. I just needed that slight tweak to my understanding of what postcondition was for. Thanks again.

from proper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.