Browse Source

Exercism: Hello world

master
Julio Biason 3 years ago
parent
commit
2520c46a2a
  1. 6
      erlang/hello-world/.eunit/hello_world.erl
  2. 34
      erlang/hello-world/.eunit/hello_world_tests.erl
  3. 30
      erlang/hello-world/.exercism/config.json
  4. 1
      erlang/hello-world/.exercism/metadata.json
  5. 6
      erlang/hello-world/.qc/hello_world.erl
  6. 34
      erlang/hello-world/.qc/hello_world_tests.erl
  7. BIN
      erlang/hello-world/.rebar/erlcinfo
  8. 36
      erlang/hello-world/HELP.md
  9. 42
      erlang/hello-world/README.md
  10. 30
      erlang/hello-world/rebar.config
  11. 9
      erlang/hello-world/src/hello_world.app.src
  12. 6
      erlang/hello-world/src/hello_world.erl
  13. 34
      erlang/hello-world/test/hello_world_tests.erl

6
erlang/hello-world/.eunit/hello_world.erl

@ -0,0 +1,6 @@
-module(hello_world).
-export([hello/0]).
hello() ->
"Goodbye, Mars!".

34
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())}.

30
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"
}

1
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}

6
erlang/hello-world/.qc/hello_world.erl

@ -0,0 +1,6 @@
-module(hello_world).
-export([hello/0]).
hello() ->
"Goodbye, Mars!".

34
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())}.

BIN
erlang/hello-world/.rebar/erlcinfo

Binary file not shown.

36
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/)

42
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

30
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]}.

9
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, []}
]}.

6
erlang/hello-world/src/hello_world.erl

@ -0,0 +1,6 @@
-module(hello_world).
-export([hello/0]).
hello() ->
"Hello, World!".

34
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())}.
Loading…
Cancel
Save