Skip to content

Commit

Permalink
Expand the type signatures exercise with instanceof checks for a clas…
Browse files Browse the repository at this point in the history
…s and a trait (#89)
  • Loading branch information
jakzal authored and juanpedromoreno committed Jun 19, 2017
1 parent e3989df commit c4bdf29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/stdlib/TypeSignatures.scala
Expand Up @@ -62,7 +62,7 @@ object TypeSignatures extends FlatSpec with Matchers with org.scalaexercises.def

/** `isInstanceOf[className]` is used to determine if an object reference is an instance of a given class:
*/
def isInstanceOfFunctionTypeSignatures(res0: Boolean) {
def isInstanceOfFunctionTypeSignatures(res0: Boolean, res1: Boolean, res2: Boolean) {
trait Randomizer[A] {
def draw(): A
}
Expand All @@ -75,7 +75,9 @@ object TypeSignatures extends FlatSpec with Matchers with org.scalaexercises.def
}

val intRand = new IntRandomizer
intRand.draw.isInstanceOf[Int] should be(res0)
intRand.isInstanceOf[IntRandomizer] should be(res0)
intRand.isInstanceOf[Randomizer[Int]] should be(res1)
intRand.draw.isInstanceOf[Int] should be(res2)
}

}
2 changes: 1 addition & 1 deletion src/test/scala/stdlib/TypeSignaturesSpec.scala
Expand Up @@ -43,7 +43,7 @@ class TypeSignaturesSpec extends Spec with Checkers {
check(
Test.testSuccess(
TypeSignatures.isInstanceOfFunctionTypeSignatures _,
true :: HNil
true :: true :: true :: HNil
)
)
}
Expand Down

0 comments on commit c4bdf29

Please sign in to comment.