Skip to content

Commit

Permalink
Add hello-world exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Nov 12, 2024
1 parent b51fe5b commit 704a22a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 27 deletions.
17 changes: 2 additions & 15 deletions bin/verify-exercises
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,12 @@ copy_example_or_examplar_to_solution() {

unskip_tests() {
jq -r '.files.test[]' .meta/config.json | while read -r test_file; do
noop # TODO: replace this with the command to unskip the tests.
# Note: this function runs from within an exercise directory.
# Note: the exercise directory is a temporary directory, so feel
# free to modify its (test) files as needed.
# Note: ignore this function if either:
# - skipping tests is not supported, or
# - skipping tests does not require modifying the test files.
# Example: sed -i 's/test.skip/test/g' "${test_file}"
: # TODO: unskip tests one we've come up with a nice way to do so
done
}

run_tests() {
noop # TODO: replace this with the command to run the tests for the exercise.
# Note: this function runs from within an exercise directory.
# Note: the exercise directory is a temporary directory, so feel
# free to modify its files as needed.
# Note: return a zero exit code if all tests pass, otherwise non-zero.
# Example: `npm test`
# Example: `python3 -m pytest two_fer_test.py`
uiua tests.ua
}

verify_exercise() {
Expand Down
38 changes: 26 additions & 12 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,40 @@
"indent_size": 2
},
"files": {
"solution": ["%{kebab_slug}.ua"],
"test": ["tests.ua"],
"example": [".meta/example.ua"],
"exemplar": [".meta/exemplar.ua"]
"solution": [
"%{kebab_slug}.ua"
],
"test": [
"tests.ua"
],
"example": [
".meta/example.ua"
],
"exemplar": [
".meta/exemplar.ua"
]
},
"exercises": {
"concept": [],
"practice": []
"practice": [
{
"slug": "hello-world",
"name": "Hello World",
"uuid": "46a9d758-fc46-408f-b31b-7dd4e33e3fbd",
"practices": [],
"prerequisites": [],
"difficulty": 1
}
]
},
"concepts": [],
"key_features": [],
"tags": [
"execution_mode/interpreted",
"paradigm/array",
"paradigm/stack_oriented",
"typing/dynamic",
"execution_mode/interpreted",
"platform/windows",
"platform/mac",
"platform/linux",
"platform/mac",
"platform/windows",
"runtime/language_specific",
"typing/dynamic",
"used_for/scripts"
]
}
Empty file removed exercises/practice/.keep
Empty file.
16 changes: 16 additions & 0 deletions exercises/practice/hello-world/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Instructions

The classical introductory exercise.
Just say "Hello, World!".

["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.

The objectives are simple:

- Modify the provided code so that it produces 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.

[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
19 changes: 19 additions & 0 deletions exercises/practice/hello-world/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"authors": [
"erikschierboom"
],
"files": {
"solution": [
"hello-world.ua"
],
"test": [
"tests.ua"
],
"example": [
".meta/example.ua"
]
},
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
"source": "This is an exercise to introduce users to using Exercism",
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
}
1 change: 1 addition & 0 deletions exercises/practice/hello-world/.meta/example.ua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello ← |0 "Hello, World!"
13 changes: 13 additions & 0 deletions exercises/practice/hello-world/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[af9ffe10-dc13-42d8-a742-e7bdafac449d]
description = "Say Hi!"
1 change: 1 addition & 0 deletions exercises/practice/hello-world/hello-world.ua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello ← |0 "Goodbye, Mars!"
3 changes: 3 additions & 0 deletions exercises/practice/hello-world/tests.ua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
~ "hello-world.ua" ~ Hello

⍤⤙≍ "Hello, World!" Hello

0 comments on commit 704a22a

Please sign in to comment.