Sha256: 729baa90b0b2bb0c03f63f029097cc5de7d01491a454c02a1bdb793da2453c9d

Contents?: true

Size: 1.22 KB

Versions: 384

Compression:

Stored size: 1.22 KB

Contents

import org.scalatest.{Matchers, FlatSpec}

class OctalTest extends FlatSpec with Matchers {
  it should "empty string should error" in {
    intercept[IllegalArgumentException] {
      Octal.octalToInt("")
    }
  }

  it should "invalid octal should error" in {
    pending
    intercept[IllegalArgumentException] {
      Octal.octalToInt("1239")
    }

    intercept[IllegalArgumentException] {
      Octal.octalToInt("FF")
    }
  }

  it should "handle zeros" in {
    pending
    Octal.octalToInt("00000000") should equal(0)
  }

  it should "handle single digit" in {
    pending
    Octal.octalToInt("0") should equal(0)
    Octal.octalToInt("7") should equal(7)
  }

  it should "handle multiple digits" in {
    pending
    Octal.octalToInt("10") should equal(8)
    Octal.octalToInt("17") should equal(15)
    Octal.octalToInt("1234567") should equal(342391)
  }

  it should "handle Int 0" in {
    pending
    Octal.intToOctal(0) should equal("0")
  }

  it should "handle Int to multi digit octal" in {
    pending
    Octal.intToOctal(9) should equal("11")
    Octal.intToOctal(342391) should equal("1234567")
  }

  it should "handle Int to octal with trailing zeros" in {
    pending
    Octal.intToOctal(8) should equal("10")
  }
}

Version data entries

384 entries across 384 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.179 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.178 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.177 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.176 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.175 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.174 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.173 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.172 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.171 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.170 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.169 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.167 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.166 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.165 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.164 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.163 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.162 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.161 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.2.1.160 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala