@@ -6,7 +6,7 @@ import org.scalatest.matchers.should.Matchers
6
6
class CurryingUnitTest extends Matchers {
7
7
8
8
@ Test
9
- def givenMultipleArgumentsFunction_whenCurried_thenReturnCurriedFunction () {
9
+ def givenMultipleArgumentsFunction_whenCurried_thenReturnCurriedFunction () = {
10
10
val sum : (Int , Int ) => Int = (x, y) => x + y
11
11
val curriedSum : Int => Int => Int = sum.curried
12
12
@@ -15,7 +15,7 @@ class CurryingUnitTest extends Matchers {
15
15
}
16
16
17
17
@ Test
18
- def givenMultipleArgumentsMethod_whenCurried_thenReturnCurriedFunction () {
18
+ def givenMultipleArgumentsMethod_whenCurried_thenReturnCurriedFunction () = {
19
19
def sum (x : Int , y : Int ): Int = x + y
20
20
21
21
val curriedSum : Int => Int => Int = (sum _).curried
@@ -25,7 +25,7 @@ class CurryingUnitTest extends Matchers {
25
25
}
26
26
27
27
@ Test
28
- def givenMultipleArgumentListsMethod_whenCurried_thenReturnCurriedFunction () {
28
+ def givenMultipleArgumentListsMethod_whenCurried_thenReturnCurriedFunction () = {
29
29
def sum (x : Int )(y : Int ): Int = x + y
30
30
31
31
val curriedSum : Int => Int => Int = sum
@@ -35,15 +35,15 @@ class CurryingUnitTest extends Matchers {
35
35
}
36
36
37
37
@ Test
38
- def givenCurriedFunction_whenPartialApplied_thenReturnLowerArityFunction () {
38
+ def givenCurriedFunction_whenPartialApplied_thenReturnLowerArityFunction () = {
39
39
val sum : Int => Int => Int = x => y => x + y
40
40
val increment : Int => Int = sum(1 )
41
41
42
42
increment(1 ) shouldBe 2
43
43
}
44
44
45
45
@ Test
46
- def givenMultipleArgumentListsMethod_whenPartialApplied_thenReturnLowerArityMethod () {
46
+ def givenMultipleArgumentListsMethod_whenPartialApplied_thenReturnLowerArityMethod () = {
47
47
def sum (x : Int )(y : Int ): Int = x + y
48
48
49
49
val increment : Int => Int = sum(1 )
@@ -52,7 +52,7 @@ class CurryingUnitTest extends Matchers {
52
52
}
53
53
54
54
@ Test
55
- def givenMultipleArgumentsFindMethod_whenCalled_thenPredicateFunctionNeedsExplicitType () {
55
+ def givenMultipleArgumentsFindMethod_whenCalled_thenPredicateFunctionNeedsExplicitType () = {
56
56
def find [A ](xs : List [A ], predicate : A => Boolean ): Option [A ] = {
57
57
xs match {
58
58
case Nil => None
@@ -65,7 +65,7 @@ class CurryingUnitTest extends Matchers {
65
65
}
66
66
67
67
@ Test
68
- def givenMultipleArgumentListFindMethod_whenCalled_thenPredicateFunctionDoesNotNeedExplicitType () {
68
+ def givenMultipleArgumentListFindMethod_whenCalled_thenPredicateFunctionDoesNotNeedExplicitType () = {
69
69
def find [A ](xs : List [A ])(predicate : A => Boolean ): Option [A ] = {
70
70
xs match {
71
71
case Nil => None
@@ -78,7 +78,7 @@ class CurryingUnitTest extends Matchers {
78
78
}
79
79
80
80
@ Test
81
- def givenGenericMultipleArgumentListSumMethod_whenPartialApplied_thenReturnSimpleMethods () {
81
+ def givenGenericMultipleArgumentListSumMethod_whenPartialApplied_thenReturnSimpleMethods () = {
82
82
def sumF (f : Int => Int )(x : Int , y : Int ): Int = f(x) + f(y)
83
83
val sum : (Int , Int ) => Int = sumF(identity)
84
84
val sumSquare : (Int , Int ) => Int = sumF(x => x * x)
@@ -92,15 +92,15 @@ class CurryingUnitTest extends Matchers {
92
92
}
93
93
94
94
@ Test
95
- def givenMultipleArgumentsFunction_whenUseItAsOneArgumentFunction_thenNeedsExplicitArgumentPassing () {
95
+ def givenMultipleArgumentsFunction_whenUseItAsOneArgumentFunction_thenNeedsExplicitArgumentPassing () = {
96
96
val sum : (Int , Int ) => Int = (x, y) => x + y
97
97
val numbers : List [Int ] = List (1 , 2 , 3 )
98
98
99
99
numbers.map(n => sum(1 , n)) shouldBe List (2 , 3 , 4 )
100
100
}
101
101
102
102
@ Test
103
- def givenCurriedFunction_whenUseItAsOneArgumentFunction_thenDoesNotNeedExplicitArgumentPassing () {
103
+ def givenCurriedFunction_whenUseItAsOneArgumentFunction_thenDoesNotNeedExplicitArgumentPassing () = {
104
104
val curriedSum : Int => Int => Int = x => y => x + y
105
105
val numbers : List [Int ] = List (1 , 2 , 3 )
106
106
0 commit comments