diff --git a/erlang/hello-world/.eunit/hello_world.erl b/erlang/hello-world/.eunit/hello_world.erl new file mode 100644 index 0000000..0707317 --- /dev/null +++ b/erlang/hello-world/.eunit/hello_world.erl @@ -0,0 +1,6 @@ +-module(hello_world). + +-export([hello/0]). + +hello() -> + "Goodbye, Mars!". diff --git a/erlang/hello-world/.eunit/hello_world_tests.erl b/erlang/hello-world/.eunit/hello_world_tests.erl new file mode 100644 index 0000000..06261b6 --- /dev/null +++ b/erlang/hello-world/.eunit/hello_world_tests.erl @@ -0,0 +1,34 @@ +%% Generated with 'testgen v0.2.0' +%% Revision 1 of the exercises generator was used +%% https://github.com/exercism/problem-specifications/raw/42dd0cea20498fd544b152c4e2c0a419bb7e266a/exercises/hello-world/canonical-data.json +%% This file is automatically generated from the exercises canonical data. + +-module(hello_world_tests). + +-include_lib("erl_exercism/include/exercism.hrl"). +-include_lib("eunit/include/eunit.hrl"). + + +-define(assertStringEqual(Expect, Expr), + begin ((fun () -> + __X = (Expect), + __Y = (Expr), + case string:equal(__X, __Y) of + true -> ok; + false -> erlang:error({assertStringEqual, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {expected, unicode:characters_to_list(__X)}, + {value, unicode:characters_to_list(__Y)}]}) + end + end)()) + end). + +-define(_assertStringEqual(Expect, Expr), ?_test(?assertStringEqual(Expect, Expr))). + + +'1_say_hi_test_'() -> + {"Say Hi!", + ?_assertStringEqual("Hello, World!", + hello_world:hello())}. diff --git a/erlang/hello-world/.exercism/config.json b/erlang/hello-world/.exercism/config.json new file mode 100644 index 0000000..113f8b6 --- /dev/null +++ b/erlang/hello-world/.exercism/config.json @@ -0,0 +1,30 @@ +{ + "blurb": "The classical introductory exercise. Just say \"Hello, World!\"", + "authors": [ + "barberj" + ], + "contributors": [ + "duffn", + "ErikSchierboom", + "iHiD", + "JordanAdams", + "juhlig", + "kytrinyx", + "NobbZ", + "tmcgilchrist", + "xymbol" + ], + "files": { + "solution": [ + "src/hello_world.erl" + ], + "test": [ + "test/hello_world_tests.erl" + ], + "example": [ + ".meta/example.erl" + ] + }, + "source": "This is an exercise to introduce users to using Exercism", + "source_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program" +} diff --git a/erlang/hello-world/.exercism/metadata.json b/erlang/hello-world/.exercism/metadata.json new file mode 100644 index 0000000..5408727 --- /dev/null +++ b/erlang/hello-world/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"erlang","exercise":"hello-world","id":"d3e91fc949c14f3b946bf72f8fabff37","url":"https://exercism.org/tracks/erlang/exercises/hello-world","handle":"JBiason","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/erlang/hello-world/.qc/hello_world.erl b/erlang/hello-world/.qc/hello_world.erl new file mode 100644 index 0000000..0707317 --- /dev/null +++ b/erlang/hello-world/.qc/hello_world.erl @@ -0,0 +1,6 @@ +-module(hello_world). + +-export([hello/0]). + +hello() -> + "Goodbye, Mars!". diff --git a/erlang/hello-world/.qc/hello_world_tests.erl b/erlang/hello-world/.qc/hello_world_tests.erl new file mode 100644 index 0000000..06261b6 --- /dev/null +++ b/erlang/hello-world/.qc/hello_world_tests.erl @@ -0,0 +1,34 @@ +%% Generated with 'testgen v0.2.0' +%% Revision 1 of the exercises generator was used +%% https://github.com/exercism/problem-specifications/raw/42dd0cea20498fd544b152c4e2c0a419bb7e266a/exercises/hello-world/canonical-data.json +%% This file is automatically generated from the exercises canonical data. + +-module(hello_world_tests). + +-include_lib("erl_exercism/include/exercism.hrl"). +-include_lib("eunit/include/eunit.hrl"). + + +-define(assertStringEqual(Expect, Expr), + begin ((fun () -> + __X = (Expect), + __Y = (Expr), + case string:equal(__X, __Y) of + true -> ok; + false -> erlang:error({assertStringEqual, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {expected, unicode:characters_to_list(__X)}, + {value, unicode:characters_to_list(__Y)}]}) + end + end)()) + end). + +-define(_assertStringEqual(Expect, Expr), ?_test(?assertStringEqual(Expect, Expr))). + + +'1_say_hi_test_'() -> + {"Say Hi!", + ?_assertStringEqual("Hello, World!", + hello_world:hello())}. diff --git a/erlang/hello-world/.rebar/erlcinfo b/erlang/hello-world/.rebar/erlcinfo new file mode 100644 index 0000000..a7b8698 Binary files /dev/null and b/erlang/hello-world/.rebar/erlcinfo differ diff --git a/erlang/hello-world/HELP.md b/erlang/hello-world/HELP.md new file mode 100644 index 0000000..5282e6a --- /dev/null +++ b/erlang/hello-world/HELP.md @@ -0,0 +1,36 @@ +# Help + +## Running the tests + +You can run the tests by running the following command from the exercise directory. + +```bash +$ rebar3 eunit +``` + +## Submitting your solution + +You can submit your solution using the `exercism submit src/hello_world.erl` command. +This command will upload your solution to the Exercism website and print the solution page's URL. + +It's possible to submit an incomplete solution which allows you to: + +- See how others have completed the exercise +- Request help from a mentor + +## Need to get help? + +If you'd like help solving the exercise, check the following pages: + +- The [Erlang track's documentation](https://exercism.org/docs/tracks/erlang) +- [Exercism's support channel on gitter](https://gitter.im/exercism/support) +- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) + +Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. + +To get help if you're having trouble, you can use one of the following resources: + +- [Exercism related BEAM support channel on gitter](https://gitter.im/exercism/xerlang) +- [Erlang Documentation](http://www.erlang.org/doc.html) +- [Learn You Some Erlang for Great Good](http://learnyousomeerlang.com) +- [StackOverflow](http://stackoverflow.com/) \ No newline at end of file diff --git a/erlang/hello-world/README.md b/erlang/hello-world/README.md new file mode 100644 index 0000000..9780e77 --- /dev/null +++ b/erlang/hello-world/README.md @@ -0,0 +1,42 @@ +# Hello World + +Welcome to Hello World on Exercism's Erlang Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## Instructions + +The classical introductory exercise. Just say "Hello, World!". + +["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is +the traditional first program for beginning programming in a new language +or environment. + +The objectives are simple: + +- Write a function that returns the string "Hello, World!". +- Run the test suite and make sure that it succeeds. +- Submit your solution and check it at the website. + +If everything goes well, you will be ready to fetch your first real exercise. + +## Source + +### Created by + +- @barberj + +### Contributed to by + +- @duffn +- @ErikSchierboom +- @iHiD +- @JordanAdams +- @juhlig +- @kytrinyx +- @NobbZ +- @tmcgilchrist +- @xymbol + +### Based on + +This is an exercise to introduce users to using Exercism - http://en.wikipedia.org/wiki/%22Hello,_world!%22_program \ No newline at end of file diff --git a/erlang/hello-world/rebar.config b/erlang/hello-world/rebar.config new file mode 100644 index 0000000..db5d907 --- /dev/null +++ b/erlang/hello-world/rebar.config @@ -0,0 +1,30 @@ +%% Erlang compiler options +{erl_opts, [debug_info, warnings_as_errors]}. + +{deps, [{erl_exercism, "0.1.2"}]}. + +{dialyzer, [ + {warnings, [underspecs, no_return]}, + {get_warnings, true}, + {plt_apps, top_level_deps}, % top_level_deps | all_deps + {plt_extra_apps, []}, + {plt_location, local}, % local | "/my/file/name" + {plt_prefix, "rebar3"}, + {base_plt_apps, [stdlib, kernel, crypto]}, + {base_plt_location, global}, % global | "/my/file/name" + {base_plt_prefix, "rebar3"} +]}. + +%% eunit:test(Tests) +{eunit_tests, []}. +%% Options for eunit:test(Tests, Opts) +{eunit_opts, [verbose]}. + +%% == xref == + +{xref_warnings, true}. + +%% xref checks to run +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, exports_not_used, + deprecated_function_calls, deprecated_functions]}. diff --git a/erlang/hello-world/src/hello_world.app.src b/erlang/hello-world/src/hello_world.app.src new file mode 100644 index 0000000..7da03b1 --- /dev/null +++ b/erlang/hello-world/src/hello_world.app.src @@ -0,0 +1,9 @@ +{application, hello_world, + [{description, "exercism.io - hello-world"}, + {vsn, "0.0.1"}, + {modules, []}, + {registered, []}, + {applications, [kernel, + stdlib]}, + {env, []} + ]}. diff --git a/erlang/hello-world/src/hello_world.erl b/erlang/hello-world/src/hello_world.erl new file mode 100644 index 0000000..faba9f9 --- /dev/null +++ b/erlang/hello-world/src/hello_world.erl @@ -0,0 +1,6 @@ +-module(hello_world). + +-export([hello/0]). + +hello() -> + "Hello, World!". diff --git a/erlang/hello-world/test/hello_world_tests.erl b/erlang/hello-world/test/hello_world_tests.erl new file mode 100644 index 0000000..06261b6 --- /dev/null +++ b/erlang/hello-world/test/hello_world_tests.erl @@ -0,0 +1,34 @@ +%% Generated with 'testgen v0.2.0' +%% Revision 1 of the exercises generator was used +%% https://github.com/exercism/problem-specifications/raw/42dd0cea20498fd544b152c4e2c0a419bb7e266a/exercises/hello-world/canonical-data.json +%% This file is automatically generated from the exercises canonical data. + +-module(hello_world_tests). + +-include_lib("erl_exercism/include/exercism.hrl"). +-include_lib("eunit/include/eunit.hrl"). + + +-define(assertStringEqual(Expect, Expr), + begin ((fun () -> + __X = (Expect), + __Y = (Expr), + case string:equal(__X, __Y) of + true -> ok; + false -> erlang:error({assertStringEqual, + [{module, ?MODULE}, + {line, ?LINE}, + {expression, (??Expr)}, + {expected, unicode:characters_to_list(__X)}, + {value, unicode:characters_to_list(__Y)}]}) + end + end)()) + end). + +-define(_assertStringEqual(Expect, Expr), ?_test(?assertStringEqual(Expect, Expr))). + + +'1_say_hi_test_'() -> + {"Say Hi!", + ?_assertStringEqual("Hello, World!", + hello_world:hello())}.