Skip to content

Instantly share code, notes, and snippets.

@sapanparikh18
Created October 24, 2018 08:01
Show Gist options
  • Save sapanparikh18/2a2bdd4e2c995354553d6e7c13685d93 to your computer and use it in GitHub Desktop.
Save sapanparikh18/2a2bdd4e2c995354553d6e7c13685d93 to your computer and use it in GitHub Desktop.
Created with Copy to Gist
package primefactors
import spock.lang.Specification
class PrimeFactorsSpec extends Specification{
def "api to t test nothing"(){
expect: "nothing" == "nothing"
}
def "API to test prime factors of given integer"(){
expect: "factorsOf(n) will return list with n's prime factors"
factorsOf(n) == lst
where:
n | lst
1 | []
2 | [2]
}
List<Integer> factorsOf(int n){
List<Integer> factors = []
if(n>1) {
factors << 2
}
return factors
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment