question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Negate/Invert properties

See original GitHub issue

I 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:closed
  • Created a year ago
  • Comments:24 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jzabroskicommented, Aug 9, 2022

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.

1reaction
ploehcommented, Aug 9, 2022

Would you also write properties that test that the properties that test your generators work correctly?

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found