This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Greeter { | |
def greet(likeAPirate: Boolean): String = if (likeAPirate) "Ahoy" else "Hello" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GreeterSpec extends org.specs2.mutable.Specification { | |
"Should greet like a pirate" >> { | |
Greeter.greet(true) must beEqualTo("Ahoy") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Numbers { | |
def greaterThan(a: Int, b: Int): Boolean = { | |
a > b | |
// Mutant 1: a >= b | |
// Mutant 2: a < b | |
// Mutant 3: a == b | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 _ => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Answerer that knows everything about chickens | |
Scenario Outline: | |
Given there is a answerer | |
And there is a user | |
When user ask the answerer <question> | |
Then the answerer replies <answer> | |
Examples: | |
| question | answer | | |
| "Why did the robot chicken cross the road?" | "Because it was programmed to"| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Chicken Collecting Insects Calculator | |
Scenario: Chicken collects insects for several minutes | |
Given a chicken collects 3 insects per minute | |
When chicken has searched insects for 5 minutes | |
Then the chicken has found 15 insects | |
Scenario: Chicken collects insects for several hours | |
Given a chicken collects 2 insects per minute | |
When chicken has searched insects for 2 hours |
OlderNewer