Created
October 31, 2016 16:19
-
-
Save nrinaudo/04ce70c4194bd98b4e13f72cbd0c40fe to your computer and use it in GitHub Desktop.
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
292269008-10-31T10:04:47.327CET | |
292269008-10-31T10:04:48.332CET | |
------------- | |
47499839-07-08T00:00:00.000CET | |
47499839-07-08T00:00:00.000CET | |
------------- | |
2016-10-31T17:17:45.152CET | |
2016-10-31T17:17:46.153CET | |
------------- | |
153548454-10-22T19:38:09.274CEST | |
153548454-10-22T19:38:10.280CEST | |
------------- | |
148430443-05-19T13:11:35.732CEST | |
148430443-05-19T13:11:36.736CEST | |
------------- | |
248679200-02-29T17:17:48.167CET | |
248679200-02-29T17:17:49.171CET | |
------------- | |
2016-10-01T17:17:49.173CEST | |
2016-10-01T17:17:50.178CEST | |
------------- | |
172688176-02-29T17:17:50.179CET | |
172688176-02-29T17:17:51.181CET | |
------------- | |
211481045-09-30T23:59:59.059CEST | |
211481045-09-30T23:59:59.059CEST | |
------------- | |
292269008-10-02T10:04:56.378CET | |
292269008-10-02T10:04:57.379CET | |
------------- |
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
import org.scalatest.FunSuite | |
import org.scalatest.prop.GeneratorDrivenPropertyChecks | |
import java.text.SimpleDateFormat | |
import java.util.{Date, Locale} | |
import org.scalacheck._ | |
class Repr extends FunSuite with GeneratorDrivenPropertyChecks { | |
implicit val cogenDate: Cogen[Date] = Cogen(_.getTime) | |
implicit val formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz", Locale.ENGLISH) | |
test("reproduce") { | |
forAll { (i: Int, f: Int => String, g: String => Date) => | |
println(formatter.format(g(f(i)))) | |
Thread.sleep(1000) | |
println(formatter.format(g(f(i)))) | |
println("-------------") | |
} | |
} | |
} |
Can you additionally print the result of f(i)
during your test?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I must be doing something wrong - probably the
Cogen
instance, but I would have expectedg(f(i))
to evaluate to the same value for the samef
,g
andi
, regardless of the time at which the call is made.