|
Scala example source code file (BooleanTest.scala)
The BooleanTest.scala Scala example source code
package scalaz
import org.scalacheck.Prop.forAll
object BooleanTest extends SpecLite {
"boolean functions" in {
import scalaz.std.{boolean => b}
"and" ! forAll { (p:Boolean, q:Boolean) =>
b.conjunction(p, q) == (p && q)
}
"or" ! forAll { (p:Boolean, q:Boolean) =>
b.disjunction(p, q) == (p || q)
}
"nand" ! forAll { (p:Boolean, q:Boolean) =>
b.nand(p, q) == !(p && q)
}
"nor" ! forAll { (p:Boolean, q:Boolean) =>
b.nor(p, q) == !(p || q)
}
"conditional" ! forAll { (p:Boolean, q:Boolean) =>
b.conditional(p, q) == (!p || q)
}
"inverse conditional" ! forAll { (p:Boolean, q:Boolean) =>
b.inverseConditional(p, q) == (p || !q)
}
"negate conditional" ! forAll { (p:Boolean, q:Boolean) =>
b.negConditional(p, q) == (p && !q)
}
"negate inverse conditional" ! forAll { (p:Boolean, q:Boolean) =>
b.negInverseConditional(p, q) == (!p && q)
}
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala BooleanTest.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.