Skip to content

Commit

Permalink
elixir - set 1 challange 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Foryah committed Dec 12, 2015
1 parent 1ec851f commit 2c46cc9
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 115 deletions.
28 changes: 28 additions & 0 deletions elixir/set1.exs
@@ -0,0 +1,28 @@
defmodule Set1 do
def hex_to_str(hex_input) do
hex_input
|> Base.decode16!(case: :lower)
end

def hex_to_b64(hex_input) do
hex_input
|> hex_to_str
|> Base.encode64()
end
end


# TODO: Find a way to put the tests in another file
ExUnit.start

defmodule TestSet1 do
use ExUnit.Case

test "Hex to String" do
assert Set1.hex_to_str("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d") == "I'm killing your brain like a poisonous mushroom"
end

test "Hex to Base64" do
assert Set1.hex_to_b64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d") == "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"
end
end
5 changes: 0 additions & 5 deletions elxr/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions elxr/README.md

This file was deleted.

30 changes: 0 additions & 30 deletions elxr/config/config.exs

This file was deleted.

19 changes: 0 additions & 19 deletions elxr/lib/elxr.ex

This file was deleted.

33 changes: 0 additions & 33 deletions elxr/mix.exs

This file was deleted.

8 changes: 0 additions & 8 deletions elxr/test/elxr_test.exs

This file was deleted.

1 change: 0 additions & 1 deletion elxr/test/test_helper.exs

This file was deleted.

0 comments on commit 2c46cc9

Please sign in to comment.