47degrees / scalacheck-toolbox Goto Github PK
View Code? Open in Web Editor NEWA helping hand for generating sensible data with ScalaCheck
Home Page: https://47degrees.github.io/scalacheck-toolbox/
License: Apache License 2.0
A helping hand for generating sensible data with ScalaCheck
Home Page: https://47degrees.github.io/scalacheck-toolbox/
License: Apache License 2.0
We need to migrate new releases to the group id com.47deg
Hi, first of all thanks for saving us the trouble to deal with random date generation.
From time to time we run into an 'Illegal instant due to time zone offset transition' exception due to generating a date which happens to "not exist".
Should be easy to reproduce like this:
import com.fortysevendeg.scalacheck.datetime.joda.ArbitraryJoda._
import org.scalacheck.Arbitrary.arbitrary
import org.joda.time.DateTime
(1 to 10000).map(_ => arbitrary[DateTime].sample)
sometimes results in e.g.
org.joda.time.IllegalInstantException: Illegal instant due to time zone offset transition (daylight savings time 'gap'): 173829578-03-26T02:52:52.521 (Europe/Berlin)
at org.joda.time.chrono.ZonedChronology.localToUTC(ZonedChronology.java:157)
at org.joda.time.chrono.ZonedChronology.getDateTimeMillis(ZonedChronology.java:122)
at org.joda.time.chrono.AssembledChronology.getDateTimeMillis(AssembledChronology.java:133)
at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:257)
at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:198)
at org.joda.time.DateTime.<init>(DateTime.java:476)
[....]
The link above has more details on the cause and some ideas on mitigating it, though I am not sure what steps would be appropriate in this case to still have completely random dates. Thanks!
Automatically rebuilt from https://github.com/minimaxir/big-list-of-naughty-strings
Currently, we have JDK 8 time and Joda Time for the Date generators. Are there any plans to support ThreetenBP?
Actual version: 0.9.3
Patch: 0.9.4
Minor: -
Major: -
These shouldn't be hard to implement - all we need is a conversion to some concrete representation. For example, for LocalDate
we can use Cogen[Long].contramap(_.toEpochDay)
.
As for the motivation, cats makes extensive use of Cogen
s in cats-laws
.
genZonedDateTime has very big space for year which is preventing strict date formatting like yyyyMMdd.
year <- Gen.choose(-292278994, 292278994)
With above range below filter mostly fails
year <- Gen.choose(-292278994, 292278994) suchThat{r => r.getYear()>1970 && r.getYear()<3000}
I know the range is due to
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
Timestamp t1 = new Timestamp(Long.MIN_VALUE);
assertEquals("292278994-08-17 07:12:55.192", t1.toString());
However, it is better if library can provide some way to constraint year range for rational generator
With modules for
Create a logo for the library, prior to releaes
We need to integrate sbt-org-policies.
Hi Noel,
I need full set of the these things.
I'm willing to do this in next day or two if you'd like but wanted to check no current work in progress
We're using the library in tapir, would be great to enable also these tests for Scala3. Thanks!
Log message:
[info] ! Java 8 Generators.arbitrary generation with a granularity generates appropriate ZonedDateTimes: Falsified after 58167 passed tests.
[info] > Labels of failing property:
[info] Hours: +45746443-09-27T04:00+13:45[NZ-CHAT]
[info] > ARG_0: (com.fortysevendeg.scalacheck.datetime.jdk8.granularity.package$$anon$3@2c86bf85,com.fortysevendeg.scalacheck.datetime.jdk8.GenJdk8Properties$$$Lambda$2144/1142872265@35fcbed8)
[info] > ARG_1: +45746443-09-27T04:00+13:45[NZ-CHAT]
Include typical usage, helpful patterns etc
This needs to be defined and implemented before v1
Including tagging
We are unfortunately blocked by this to upgrade to 2.13. When is a 2.13 release planned?
I did some work on the sbt-org-policies
project as well to support 2.13:
Afterwards I would hope that scalacheck-toolbox
could be released as well
After updating sbt-microsites
version up to 1.1.2
the microsite configuration for sbt-microsites
should include the micrositeTheme := "pattern"
setting to keep the style given when the website was redesign.
I often have use cases where I need to test dates within a specific time zone. It's probably fairly simple to adapt scalacheck-datetime
's Gen
instances to my need - just map into it and set the desired timezone - but then I need to make sure this still falls within the expected date boundaries.
Would it be possible to, say, add a new time zone parameter to genDateTimeWithinRange
? Might be implicit (probably not a great idea), might have a default value of UTC if you don't want to break backwards compatibility...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.