package problems import org.scalatest._ class SolutionsSpecs extends FlatSpec with Matchers { "P01_Last" should "behave fine" in { Solutions.last(List()) should be(None) Solutions.last(List(0)) should be(Some(0)) Solutions.last(List(0, 1)) should be(Some(1)) } "P02_Penultimate" should "behave fine" in { Solutions.penultimate(List()) should be(None) Solutions.penultimate(List(0)) should be(None) Solutions.penultimate(List(0, 1)) should be(Some(0)) Solutions.penultimate(List(0, 1, 2)) should be(Some(1)) } "P03_Nth" should "behave fine" in { Solutions.nth(-1, List(0)) should be(None) Solutions.nth(2, List()) should be(None) Solutions.nth(1, List(0)) should be(None) Solutions.nth(1, List(0, 1, 2)) should be(Some(1)) } "P04_Length" should "behave fine" in { Solutions.length(List()) should be(0) Solutions.length(List(0, 1)) should be(2) } "P05_Reverse" should "behave fine" in { Solutions.reverse(List()) should be(List()) Solutions.reverse(List(0)) should be(List(0)) Solutions.reverse(List(0, 1)) should be(List(1, 0)) } }