-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created an instance of Arbitrary[String] #13
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package com.danielasfregola.zucchini | ||
|
||
import org.scalacheck.{Arbitrary, Gen} | ||
|
||
import scala.io.Source | ||
|
||
object Dictionary extends App { | ||
|
@@ -16,6 +18,10 @@ object Dictionary extends App { | |
texts.flatMap(line => line.split("\\W+")) | ||
} | ||
|
||
println(extractUniqueWordsFromTextFile("BaconipSum.txt").mkString(",")) | ||
// println(extractUniqueWordsFromTextFile("BaconipSum.txt").mkString(",")) | ||
|
||
val words: Set[String] = extractUniqueWordsFromTextFile("BaconipSum.txt") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this is correct, you should change this so that the file name is given rather than fixed. Maybe, you could create a class that given a text file, gives you an Cheers, |
||
val word: Arbitrary[String] = Arbitrary { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well done! You can also just write |
||
Gen.oneOf(words) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this commented line