-
Notifications
You must be signed in to change notification settings - Fork 1
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
If and only if checks #76
Labels
Comments
kinto-b
added
Task: Enhancement
New feature or request
Effort: ⭐
Straightforward
labels
Jan 19, 2024
Simplest implementation, but perhaps not the best due to generating up to two failures expect_iff <- function(cond1, cond2, ...) {
cond1 <- rlang::enquo(cond1)
cond2 <- rlang::enquo(cond2)
testdat::expect_cond(!!cond1, !!cond2, ...)
testdat::expect_cond(!!cond2, !!cond1, ...)
} |
Some other logical relationships we might want to support more directly: # Not both (often used for not both blank)
expect_cond(foo, !bar)
expect_cond(bar, !foo)
# XOR (mostly covered by `expect_exclusive()`)
expect_cond(foo, !bar)
expect_cond(bar, !foo)
expect_cond(TRUE, foo | bar) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A relatively common formula is
This is a bit verbose, particularly so when
foo
andbar
are complicated expressions. We should allowor something like
The text was updated successfully, but these errors were encountered: