Skip to content

Instantly share code, notes, and snippets.

@davidallsopp
davidallsopp / Shrinking.scala
Last active January 30, 2024 13:25
Solutions to the ScalaCheck problem that shrinking failing values may generate invalid values, because the constraints of the generator are not respected. This is for using ScalaCheck from within ScalaTest.
import org.scalatest._
import prop._
import org.scalacheck.Arbitrary._
import org.scalacheck.Gen
/**
* Solutions to the ScalaCheck problem that shrinking failing values may generate
* invalid values, because the constraints of the generator are not respected.
*
* See also http://stackoverflow.com/questions/20037900/scalacheck-wont-properly-report-the-failing-case
@MishaelRosenthal
MishaelRosenthal / DirectedGraphTraversals.scala
Created May 15, 2014 11:02
Directed Graph Traversals Implementations are tail recursive and uses only immutable data structures. These implementations are not more efficient than non tail recursive implementations.
package com.liveperson.predictivedialer.examples.misc
import scala.annotation.tailrec
import scala.util.Try
/**
* Created with IntelliJ IDEA.
* User: mishaelr
* Date: 5/14/14
* Time: 5:18 PM