Skip to content

Commit f220087

Browse files
author
Fede Fernández
authored
Improves formatting and makes consistent the use of braces (#7)
1 parent c1995eb commit f220087

2 files changed

Lines changed: 29 additions & 15 deletions

File tree

src/main/scala/scalachecklib/GeneratorsSection.scala

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ object GeneratorsSection extends Checkers with Matchers with org.scalaexercises.
6060

6161
val validChars: Seq[Char] = res0
6262

63-
check(forAll(vowel) { v =>
64-
validChars.contains(v)
65-
})
63+
check {
64+
forAll(vowel) { v =>
65+
validChars.contains(v)
66+
}
67+
}
6668
}
6769

6870
/** The distribution is uniform, but if you want to control it you can use the frequency combinator:
@@ -98,9 +100,13 @@ object GeneratorsSection extends Checkers with Matchers with org.scalaexercises.
98100
import org.scalacheck.Gen.{alphaChar, posNum, listOfN}
99101
import org.scalacheck.Prop.forAll
100102

101-
check(forAll(alphaChar)(_.isDigit == res0))
103+
check {
104+
forAll(alphaChar)(_.isDigit == res0)
105+
}
102106

103-
check(forAll(posNum[Int])(n => (n > 0) == res1))
107+
check {
108+
forAll(posNum[Int])(n => (n > 0) == res1)
109+
}
104110

105111
check {
106112
forAll(listOfN(10, posNum[Int])) { list =>
@@ -125,7 +131,9 @@ object GeneratorsSection extends Checkers with Matchers with org.scalaexercises.
125131

126132
val smallEvenInteger = Gen.choose(0,200) suchThat (_ % 2 == 0)
127133

128-
check(forAll(smallEvenInteger)(_ % 2 == res0))
134+
check {
135+
forAll(smallEvenInteger)(_ % 2 == res0)
136+
}
129137
}
130138

131139
/** ==Case class Generators==
@@ -146,9 +154,11 @@ object GeneratorsSection extends Checkers with Matchers with org.scalaexercises.
146154
charValue <- Gen.alphaChar
147155
} yield Foo(intValue, charValue)
148156

149-
check(forAll(fooGen) {
150-
foo => foo.intValue > 0 && foo.charValue.isDigit == res0
151-
})
157+
check {
158+
forAll(fooGen) {
159+
foo => foo.intValue > 0 && foo.charValue.isDigit == res0
160+
}
161+
}
152162
}
153163

154164
/** ==Sized Generators==
@@ -179,10 +189,12 @@ object GeneratorsSection extends Checkers with Matchers with org.scalaexercises.
179189
} yield (size, posNumList, negNumList)
180190
}
181191

182-
check(forAll(myGen) {
183-
case (genSize, posN, negN) =>
184-
posN.length == genSize / res0 && negN.length == genSize * res1 / 3
185-
})
192+
check {
193+
forAll(myGen) {
194+
case (genSize, posN, negN) =>
195+
posN.length == genSize / res0 && negN.length == genSize * res1 / 3
196+
}
197+
}
186198
}
187199

188200
/** ==Generating Containers==
@@ -214,7 +226,9 @@ object GeneratorsSection extends Checkers with Matchers with org.scalaexercises.
214226

215227
val validNumbers: List[Int] = res0
216228

217-
check(forAll(genIntList)(_ forall (elem => validNumbers.contains(elem))))
229+
check {
230+
forAll(genIntList)(_ forall (elem => validNumbers.contains(elem)))
231+
}
218232
}
219233

220234
}

src/main/scala/scalachecklib/PropertiesSection.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ object PropertiesSection extends Checkers with Matchers with org.scalaexercises.
136136

137137
check {
138138
forAll(smallInteger) { n => (n > 100) == res0 } &&
139-
forAll(smallInteger) { n => (n >= 0) == res1 }
139+
forAll(smallInteger) { n => (n >= 0) == res1 }
140140
}
141141

142142
}

0 commit comments

Comments
 (0)