Skip to content

Commit

Permalink
add hello-world exercise + format config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenad committed Jun 18, 2024
1 parent 49b0dd4 commit e3e8580
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 0 deletions.
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
20 changes: 20 additions & 0 deletions exercises/practice/hello-world/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"authors": [
"misicnenad"
],
"files": {
"solution": [
"src/lib.cairo",
"Scarb.toml"
],
"test": [
"src/tests.cairo"
],
"example": [
".meta/example.cairo"
]
},
"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"
}
3 changes: 3 additions & 0 deletions exercises/practice/hello-world/.meta/example.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn hello() -> ByteArray {
"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!"
4 changes: 4 additions & 0 deletions exercises/practice/hello-world/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "hello_world"
version = "0.1.0"
edition = "2023_11"
4 changes: 4 additions & 0 deletions exercises/practice/hello-world/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ByteArray is a string that's not limited to 31 characters, you'll learn more about this later
fn hello() -> ByteArray {
"Goodbye, Mars!"
}
7 changes: 7 additions & 0 deletions exercises/practice/hello-world/src/tests.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn hello_world() {
assert_eq!(hello_world::hello(), "Hello, World!");
}
}

0 comments on commit e3e8580

Please sign in to comment.