-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added instances of BitSet to allInstances (#1592)
* added instances of BitSet to allInstances * unnecessary show implementation * removed unused imports
- Loading branch information
1 parent
62af31f
commit 40194da
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cats.instances | ||
|
||
import scala.collection.immutable.BitSet | ||
import cats.Show | ||
|
||
trait BitSetInstances extends cats.kernel.instances.BitSetInstances { | ||
implicit def catsStdShowForBitSet: Show[BitSet] = Show.fromToString[BitSet] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cats.tests | ||
|
||
import org.scalacheck.Arbitrary | ||
import org.scalacheck.Arbitrary.arbitrary | ||
|
||
import scala.collection.immutable.BitSet | ||
|
||
class BitSetTests extends CatsSuite { | ||
implicit val arbitraryBitSet: Arbitrary[BitSet] = | ||
Arbitrary(arbitrary[List[Short]].map(ns => BitSet(ns.map(_ & 0xffff): _*))) | ||
|
||
test("show BitSet"){ | ||
BitSet(1, 1, 2, 3).show should === ("BitSet(1, 2, 3)") | ||
BitSet.empty.show should === ("BitSet()") | ||
|
||
forAll { fs: BitSet => | ||
fs.show should === (fs.toString) | ||
} | ||
} | ||
|
||
} |