From 17fe2f1b66f69aa91eef5eb7a8132ca8f929584f Mon Sep 17 00:00:00 2001 From: Mikhail Zelenyy Date: Wed, 6 Nov 2019 16:08:21 +0300 Subject: [PATCH] Split test for Tagged and Tagless format. Tagless test failed. --- .../hep/dataforge/io/FileEnvelopeTest.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileEnvelopeTest.kt b/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileEnvelopeTest.kt index ba7f7cc5..46643ef2 100644 --- a/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileEnvelopeTest.kt +++ b/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileEnvelopeTest.kt @@ -28,4 +28,37 @@ class FileEnvelopeTest { val restored: Envelope = Global.io.readEnvelopeFile(tmpPath) assertTrue { envelope.contentEquals(restored) } } + + @Test + fun testFileWriteTagged() { + val tmpPath = Files.createTempFile("dataforge_test", ".df") + Global.io.writeEnvelopeFile(tmpPath, envelope) + assertTrue { tmpPath.toFile().length() > 0 } + } + + @Test + fun testFileWriteReadTagged() { + val tmpPath = Files.createTempFile("dataforge_test", ".df") + Global.io.writeEnvelopeFile(tmpPath, envelope) + println(tmpPath.toUri()) + val restored: Envelope = Global.io.readEnvelopeFile(tmpPath) + assertTrue { envelope.contentEquals(restored) } + } + + @Test + fun testFileWriteTagless() { + val tmpPath = Files.createTempFile("dataforge_test", ".df") + Global.io.writeEnvelopeFile(tmpPath, envelope, formatFactory = TaglessEnvelopeFormat) + assertTrue { tmpPath.toFile().length() > 0 } + } + + @Test + fun testFileWriteReadTagless() { + val tmpPath = Files.createTempFile("dataforge_test", ".df") + Global.io.writeEnvelopeFile(tmpPath, envelope, formatFactory = TaglessEnvelopeFormat) + println(tmpPath.toUri()) + val restored: Envelope = Global.io.readEnvelopeFile(tmpPath, formatFactory = TaglessEnvelopeFormat) + assertTrue { envelope.contentEquals(restored) } + } + } \ No newline at end of file