Skip to content

Commit

Permalink
Add hello-world exercise (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored Nov 12, 2024
1 parent 8a13201 commit 81b45ed
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 17 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Install uiua
run: gh release download 0.13.0 --repo uiua-lang/uiua --dir /usr/local/bin --pattern uiua-bin-x86_64-unk
nown-linux-gnu-no-audio.zip
run: |
gh release download 0.13.0 --repo uiua-lang/uiua --pattern uiua-bin-x86_64-unknown-linux-gnu-no-audio.zip --output uiua.zip
unzip uiua.zip
echo "${PWD}" >> "${GITHUB_PATH}"
env:
GH_TOKEN: ${{ github.token }}

- name: Verify all exercises
run: bin/verify-exercises
17 changes: 2 additions & 15 deletions bin/verify-exercises
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,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
12 changes: 12 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
".meta/exemplar.ua"
]
},
"exercises": {
"practice": [
{
"slug": "hello-world",
"name": "Hello World",
"uuid": "46a9d758-fc46-408f-b31b-7dd4e33e3fbd",
"practices": [],
"prerequisites": [],
"difficulty": 1
}
]
},
"tags": [
"execution_mode/interpreted",
"paradigm/array",
Expand Down
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 81b45ed

Please sign in to comment.