Sha256: a5009e45ed3e4a68d519b4abfe953a67d31b5f4265d4a0fdb09eb1260a04d7f3

Contents?: true

Size: 1.46 KB

Versions: 384

Compression:

Stored size: 1.46 KB

Contents

import org.scalatest.{Matchers, FlatSpec}

class TrinaryTest extends FlatSpec with Matchers {
  it should "empty string should error" in {
    intercept[IllegalArgumentException] {
      Trinary.trinaryToInt("")
    }
  }

  it should "invalid trinary should error" in { 
    pending
    intercept[IllegalArgumentException] {
      Trinary.trinaryToInt("1239")
    }

    intercept[IllegalArgumentException] {
      Trinary.trinaryToInt("3")
    }

    intercept[IllegalArgumentException] {
      Trinary.trinaryToInt("FF")
    }
  }

  it should "handle zeros" in { 
    pending
    Trinary.trinaryToInt("0") should equal(0)
    Trinary.trinaryToInt("00000000") should equal(0)
  }

  it should "handle single digit" in { 
    pending
    Trinary.trinaryToInt("2") should equal(2)
  }

  it should "handle multiple digits" in { 
    pending
    Trinary.trinaryToInt("10") should equal(3)
    Trinary.trinaryToInt("12") should equal(5)
    Trinary.trinaryToInt("222") should equal(26)
    Trinary.trinaryToInt("1122000120") should equal(32091)
  }

  it should "handle Int 0" in { 
    pending
    Trinary.intToTrinary(0) should equal("0")
  }

  it should "handle Int to multi digit trinary" in { 
    pending
    Trinary.intToTrinary(4) should equal("11")
    Trinary.intToTrinary(26) should equal("222")
    Trinary.intToTrinary(32091) should equal("1122000120")
  }

  it should "handle Int to trinary with trailing zeros" in { 
    pending
    Trinary.intToTrinary(3) should equal("10")
  }
}

Version data entries

384 entries across 384 versions & 1 rubygems

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