package ixee.cryptopals.test import com.ixee.IxeeSpec import org.scalatest._ class ConversionUtilsSpec extends FreeSpec with MustMatchers { import ixee.cryptopals.utils.ConversionUtils._ "ConversionUtils" - { ".hexStr2Bytes" - { "converts a hexadecimal string to an equivalent iterator of bytes" in { hexStr2Bytes("12348765").toArray must equal( Array[Byte]( 0x12.toByte, 0x34.toByte, 0x87.toByte, 0x65.toByte ) ) } "when the string is not an even length" - { "prepends a 0" in { hexStr2Bytes("123").toArray must equal(hexStr2Bytes("0123").toArray) } } } } }