3 ms·
Here is some actual test code, based on scalacheck: property("to and from file") = forAllNoShrink(genArrayForSeries)( data => { withTempDir(f => {
by yummyfajitas 12y ago
Here is some actual test code, based on scalacheck:
property("to and from file") = forAllNoShrink(genArrayForSeries)( data => {
withTempDir(f => {
val (stagingDir, dataDir) = mkdirs(f)
val s = SequentialBinaryV1Storage(dataDir, stagingDir)
val id = SeriesIdent(UUID.randomUUID().toString)
val oldSeries = BufferedSeries(id, data._1, data._2)
s.write(oldSeries)
val newSeries = s.read(id).get
((oldSeries.ident == newSeries.ident) :| "identities do not match") &&
((oldSeries.data == newSeries.data) :| "data series do not match")
})
})
Not much DSL, though there are a few helper functions handling stuff like creating a tempdir for the test and deleting when finished.