Sha256: 65dba66329eb0978731a657e226b8b4984df38931a7b917c20ddbc7213eba290

Contents?: true

Size: 1.23 KB

Versions: 136

Compression:

Stored size: 1.23 KB

Contents

import org.scalatest.{FunSuite, Matchers}

class RailFenceCipherTest extends FunSuite with Matchers {

  // Encode test cases
  test("test to encode with two rails") {
    val encoded = RailFenceCipher.encode("XOXOXOXOXOXOXOXOXO", 2)
    encoded should be ("XXXXXXXXXOOOOOOOOO")
  }

  test("test to encode with three rails") {
    pending
    val encoded = RailFenceCipher.encode("WEAREDISCOVEREDFLEEATONCE", 3)
    encoded should be ("WECRLTEERDSOEEFEAOCAIVDEN")
  }

  test("test to encode with ending in the middle") {
    pending
    val encoded = RailFenceCipher.encode("EXERCISES", 4)
    encoded should be ("ESXIEECSR")
  }

  // Decode test cases
  test("test to decode with three rails") {
    pending
    val decoded = RailFenceCipher.decode("TEITELHDVLSNHDTISEIIEA", 3)
    decoded should be ("THEDEVILISINTHEDETAILS")
  }

  test("test to decode with five rails") {
    pending
    val decoded = RailFenceCipher.decode("EIEXMSMESAORIWSCE", 5)
    decoded should be ("EXERCISMISAWESOME")
  }

  test("test to decode with six rails") {
    pending
    val decoded = RailFenceCipher.decode("133714114238148966225439541018335470986172518171757571896261", 6)
    decoded should be ("112358132134558914423337761098715972584418167651094617711286")
  }

}

Version data entries

136 entries across 136 versions & 1 rubygems

Version Path
trackler-2.0.8.16 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.15 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.14 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.13 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.12 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.11 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.10 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.9 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.8 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.7 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.6 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.5 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.4 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.3 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.2 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
trackler-2.0.8.1 tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala