String { guard number > 0 else { return "out of range” } switch number { case let n where n % 15 == 0: return "FizzBuzz" case let n where n % 5 == 0: return "Buzz" case let n where n % 3 == 0: return "Fizz" default: return String(number) } } }
3") { expect(FizzBuzz.fizzBuzz(3)).to(equal("Fizz")) } it("should return Buzz when given multiples of 5") { expect(FizzBuzz.fizzBuzz(5)).to(equal("Buzz")) } it("should return FizzBuzz when given multiples of both 3 and 5") { expect(FizzBuzz.fizzBuzz(15)).to(equal("FizzBuzz")) } ɾ ɾ ɾ
3") { expect(FizzBuzz.fizzBuzz(3)).to(equal("Fizz")) } it("should return Buzz when given multiples of 5") { expect(FizzBuzz.fizzBuzz(5)).to(equal("Buzz")) } it("should return FizzBuzz when given multiples of both 3 and 5") { expect(FizzBuzz.fizzBuzz(15)).to(equal("FizzBuzz")) } ɾ ɾ ɾ 3ͷഒͷ࣌ -> “Fizz”
3") { expect(FizzBuzz.fizzBuzz(3)).to(equal("Fizz")) } it("should return Buzz when given multiples of 5") { expect(FizzBuzz.fizzBuzz(5)).to(equal("Buzz")) } it("should return FizzBuzz when given multiples of both 3 and 5") { expect(FizzBuzz.fizzBuzz(15)).to(equal("FizzBuzz")) } ɾ ɾ ɾ 5ͷഒͷ࣌ -> “Buzz”
3") { expect(FizzBuzz.fizzBuzz(3)).to(equal("Fizz")) } it("should return Buzz when given multiples of 5") { expect(FizzBuzz.fizzBuzz(5)).to(equal("Buzz")) } it("should return FizzBuzz when given multiples of both 3 and 5") { expect(FizzBuzz.fizzBuzz(15)).to(equal("FizzBuzz")) } ɾ ɾ ɾ 3ͱ5ͷެഒͷ࣌ -> “FizzBuzz”