Skip to content

Instantly share code, notes, and snippets.

View okaminu's full-sized avatar

Aurimas Degutis okaminu

View GitHub Profile
Feature: Answerer that knows everything about chickens
Background:
Given there is a answerer
And there is a user
Scenario: Answers why did robot chicken cross the road
When user asks the answerer "Why did the robot chicken cross the road?"
Then the answerer replies "Because it was programmed to"
Scenario: Answers why did the chicken cross the road
Feature: Answerer that knows everything about chickens
Scenario: Answers why did the chicken cross the road
Given there is a answerer
And there is a user
When user asks the answerer "Why did the chicken cross the road?"
Then the answerer replies "Because it wanted to fix a bug in the robot chicken"
Feature: Answerer that knows everything about chickens
Scenario: Answers why did robot chicken cross the road
Given there is a answerer
And there is a user
When user asks the answerer "Why did the robot chicken cross the road?"
Then the answerer replies "Because it was programmed to"
class Numbers {
def greaterThan(a: Int, b: Int): Boolean = {
sys.env.get("ACTIVE_MUTATION") match {
case Some("0") =>
a >= b
case Some("1") =>
a < b
case Some("2") =>
a == b
case _ =>
class Numbers {
def greaterThan(a: Int, b: Int): Boolean = {
a > b
// Mutant 1: a >= b
// Mutant 2: a < b
// Mutant 3: a == b
}
}
object Greeter {
def greet(likeAPirate: Boolean, age: Some[Int]): String =
if (likeAPirate && age.nonEmpty) {
if (age.get >= 18) "Care to join for a bottle of rum ?" else "Ahoy"
} else "Hello"
}
object Greeter {
def greet(likeAPirate: Boolean): String = if (likeAPirate) "Ahoy" else "Hello"
}
@okaminu
okaminu / GreeterSpec.scala
Last active October 1, 2020 07:48
Pirate Greeter Spec
class GreeterSpec extends org.specs2.mutable.Specification {
"Should greet like a pirate" >> {
Greeter.greet(true) must beEqualTo("Ahoy")
}
}