-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a996dc
commit 1875ddf
Showing
5 changed files
with
36 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# FizzBadd | ||
|
||
**TODO: Add description** | ||
A shitty Fizz Buzz implementation generator. | ||
|
||
## Installation | ||
|
||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
defmodule FizzBadd.FizzBuzz do | ||
@moduledoc """ | ||
Fizz Buzz implementation for internal use. | ||
""" | ||
|
||
@doc """ | ||
Produce the n-th value in the Fizz Buzz sequence. | ||
## Examples | ||
iex> FizzBadd.FizzBuzz.fizz_buzz(1) | ||
"1" | ||
iex> FizzBadd.FizzBuzz.fizz_buzz(3) | ||
"Fizz" | ||
iex> FizzBadd.FizzBuzz.fizz_buzz(5) | ||
"Buzz" | ||
iex> FizzBadd.FizzBuzz.fizz_buzz(15) | ||
"Fizz Buzz" | ||
""" | ||
def fizz_buzz(n) when rem(n, 15) == 0, do: "Fizz Buzz" | ||
def fizz_buzz(n) when rem(n, 5) == 0, do: "Buzz" | ||
def fizz_buzz(n) when rem(n, 3) == 0, do: "Fizz" | ||
def fizz_buzz(n), do: Integer.to_string(n) | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule FizzBaddTest.FizzBuzzTest do | ||
use ExUnit.Case | ||
|
||
alias FizzBadd.FizzBuzz, as: FizzBuzz | ||
|
||
doctest FizzBuzz | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
defmodule FizzBaddTest do | ||
use ExUnit.Case | ||
doctest FizzBadd | ||
|
||
test "the truth" do | ||
assert 1 + 1 == 2 | ||
end | ||
end |