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.119 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.118 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.117 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.116 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.115 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.114 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.113 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.111 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.110 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.109 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.108 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.107 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.106 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.105 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.104 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.103 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.102 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.101 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.100 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala
trackler-2.2.1.99 tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala