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.0.0.5 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.0.0.4 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.0.0.3 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala
trackler-2.0.0.2 tracks/scala/exercises/octal/src/test/scala/OctalTest.scala