diff --git a/test-src/Ex1Spec.scala b/test-src/Ex1Spec.scala new file mode 100644 index 0000000000000000000000000000000000000000..b6087778887ad75ae0cfa04971262c71d8cac4ef --- /dev/null +++ b/test-src/Ex1Spec.scala @@ -0,0 +1,28 @@ +package ex1 + +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec + +class Ex1Spec extends AnyWordSpec with Matchers { + "The first function" must { + "create a list of numbers which are consecutive multiples of 3" in { + One() should be(List(3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, + 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81)) + } + } + "The second function" must { + "generate a new list where each element is tripled" in { + Two(List(3, 5, 2, 3, 9, 4, 2)) should be(List(9, 15, 6, 9, 27, 12, 6)) + } + } + "The third function" must { + "keep only elements with decimal part > 0.5" in { + Three(List(45.6, 23.1, 22.7, 32.2)) should be(List(45.6, 22.7)) + } + } + "The fourth function" must { + "map to (capitalized, length) then filter start with 'L' and finally show biggest" in { + Four(List("jim", "lara", "linda", "john", "barry")) should be(5) + } + } +} diff --git a/test-src/Ex1Suite.scala b/test-src/Ex1Suite.scala deleted file mode 100644 index e73605f79e87bff8626e88f1c5fb1bc9449bc68a..0000000000000000000000000000000000000000 --- a/test-src/Ex1Suite.scala +++ /dev/null @@ -1,21 +0,0 @@ -package ex1 - -import org.scalatest.funsuite.AnyFunSuite - -class Ex1Suite extends AnyFunSuite { - test("1. Create a list of numbers which are consecutive multiples of 3") { - assert( - One() == List(3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, - 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81) - ) - } - test("2. Generate a new list where each element is tripled") { - assert(Two(List(3, 5, 2, 3, 9, 4, 2)) == List(9, 15, 6, 9, 27, 12, 6)) - } - test("3. Keep only elements with decimal > 0.5") { - assert(Three(List(45.6, 23.1, 22.7, 32.2)) == List(45.6, 22.7)) - } - test("4. To map (capitalized, length), filter start with L, show biggest") { - assert(Four(List("jim", "lara", "linda", "john", "barry")) == 5) - } -}