Proposal: Negate/Invert properties
See original GitHub issueI am currently in the situation where I wrote a complex property and want to test that a specific value does not match it. I’m unsure if there is currently a way to do this. Here is an example of what I would have in mind:
let prop1 thing = ...
let prop2 thing = ...
let bothProps thing = (prop1 thing) .&. (prop2 thing) // True if both prop1 and prop2 are true
let notBothProps thing = Prop.not (bothProps thing) // Invert the property so it is true if either prop1 or prop2 fail
My suggestion is in the last line. I would love a Prop.not
, Prop.negate
or Prop.invert
to flip properties. Could also add an operator such as .!
.
Edit: If there is already a way to do this, I could not find it in the documentation. In that case, I request that it be documented somewhere.
Thanks
Issue Analytics
- State:
- Created a year ago
- Comments:24 (8 by maintainers)
Top Results From Across the Web
Proposed Properties: home
Our team works with builders, contractors, real estate agents, and lenders on a streamlined approach to take out the headaches in building or...
Read more >Notice: This .Material
common characteristics is also proposed. ... The goal of this dissertation is to propose a classification scheme for code ... negate/invert.
Read more >Digital Logic Design
Semiconductor material is given special properties by a chemical process ... Negate (Invert) every bit including sign bit to obtain the negative number....
Read more >Opcode - man pages section 3: Library Interfaces and ...
Opcode - Disable named opcodes when compiling perl code.
Read more >Forth 200x Standardisation Committee Forth 2012 RC2 ...
If a proposal does not propose extensions or changes to the Forth language, ... the physical properties and implementation of storage.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A related concern to
then Some (Age 0)
with “testing your tests” is Gettier Problems in Justified-True-Belief theory. Justified-True-Belief theory is a theory of how we know things, dating back to Plato and Socrates. A Gettier Problem was a counter-example that showed how our justifications might be true but erroneous in the context of proving what we believe is knowledge. This can happen in programming - imagine you test a “concurrent design” using linear, serial, deterministic inputs only. The tests always pass, and so you believe you have correctly designed a concurrent system. Yet, you overlook the fact that you mocked a key detail that controls non-deterministic choice to always return a certain value without delay. Your system works correctly, but not for the reasons you’ve justified to yourself and codified in tests.Would you also write properties that test that the properties that test your generators work correctly?