From 32ff5441b1ed050611441e77faf8afb872e56606 Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Wed, 9 Sep 2015 10:05:24 +0200 Subject: [PATCH] Adding basic unit tests --- .../sasc/biopet/core/BiopetPipeTest.scala | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/core/BiopetPipeTest.scala diff --git a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/core/BiopetPipeTest.scala b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/core/BiopetPipeTest.scala new file mode 100644 index 000000000..bac6932dd --- /dev/null +++ b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/core/BiopetPipeTest.scala @@ -0,0 +1,45 @@ +package nl.lumc.sasc.biopet.core + +import org.scalatest.Matchers +import org.scalatest.testng.TestNGSuite +import org.testng.annotations.Test + +/** + * Created by pjvanthof on 09/09/15. + */ +class BiopetPipeTest extends TestNGSuite with Matchers { + class Pipe1 extends BiopetCommandLineFunction { + val root = null + def cmdLine = "pipe1" + + (if (!inputAsStdin) " input1 " else "") + + (if (!outputAsStsout) " output1 " + "") + } + + class Pipe2 extends BiopetCommandLineFunction { + val root = null + def cmdLine = "pipe2" + + (if (!inputAsStdin) " input2 " else "") + + (if (!outputAsStsout) " output2 " + "") + } + + @Test def testPipeCommands: Unit = { + val pipe1 = new Pipe1 + val pipe2 = new Pipe2 + pipe1.commandLine.contains("pipe1") shouldBe true + pipe1.commandLine.contains("input1") shouldBe true + pipe1.commandLine.contains("output1") shouldBe true + pipe2.commandLine.contains("pipe2") shouldBe true + pipe2.commandLine.contains("input2") shouldBe true + pipe2.commandLine.contains("output2") shouldBe true + } + + @Test def testPipe: Unit = { + val pipe = new Pipe1 | new Pipe2 + pipe.commandLine.contains("pipe1") shouldBe true + pipe.commandLine.contains("input1") shouldBe true + pipe.commandLine.contains("output1") shouldBe false + pipe.commandLine.contains("pipe2") shouldBe true + pipe.commandLine.contains("input2") shouldBe false + pipe.commandLine.contains("output2") shouldBe true + } +} -- GitLab