first commit

This commit is contained in:
Andrew Scott 2024-01-03 03:10:04 -05:00
commit 6b89913b94
Signed by: a
GPG key ID: 7CD5A5977E4931C1
6 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,19 @@
{
"authors": [
"massivelivefun"
],
"files": {
"solution": [
"hello_world.zig"
],
"test": [
"test_hello_world.zig"
],
"example": [
".meta/example.zig"
]
},
"blurb": "The classical 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"
}

View file

@ -0,0 +1 @@
{"track":"zig","exercise":"hello-world","id":"42c2ec86d7da4c2f87f10f0004ff63d2","url":"https://exercism.org/tracks/zig/exercises/hello-world","handle":"Chomp1295","is_requester":true,"auto_approve":false}

53
zig/hello-world/HELP.md Normal file
View file

@ -0,0 +1,53 @@
# Help
## Running the tests
Write your code in `<exercise_name>.zig`.
To run the tests for an exercise, run:
```bash
zig test test_exercise_name.zig
```
in the exercise's root directory (replacing `exercise_name` with the name of the exercise).
## Submitting your solution
You can submit your solution using the `exercism submit hello_world.zig` 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 [Zig track's documentation](https://exercism.org/docs/tracks/zig)
- The [Zig track's programming category on the forum](https://forum.exercism.org/c/programming/zig)
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
- [The Zig Programming Language Documentation][documentation] is a great overview of all of the language features that Zig provides to those who use it.
- [Zig Learn][zig-learn] is an excellent primer that explains the language features that Zig has to offer.
- [Ziglings][ziglings] is highly recommended.
Learn Zig by fixing tiny broken programs.
- [The Zig Programming Language Discord][discord-zig] is the main [Discord][discord].
It provides a great way to get in touch with the Zig community at large, and get some quick, direct help for any Zig related problem.
- [#zig][irc] on irc.freenode.net is the main Zig IRC channel.
- [/r/Zig][reddit] is the main Zig subreddit.
- [Stack Overflow][stack-overflow] can be used to discover code snippets and solutions to problems that may have already asked and maybe solved by others.
[discord]: https://discordapp.com
[discord-zig]: https://discord.com/invite/gxsFFjE
[documentation]: https://ziglang.org/documentation/master
[irc]: https://webchat.freenode.net/?channels=%23zig
[reddit]: https://www.reddit.com/r/Zig
[stack-overflow]: https://stackoverflow.com/questions/tagged/zig
[zig-learn]: https://ziglearn.org/
[ziglings]: https://github.com/ratfactor/ziglings

31
zig/hello-world/README.md Normal file
View file

@ -0,0 +1,31 @@
# Hello, World!
Welcome to Hello, World! on Exercism's Zig 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!"][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
## Source
### Created by
- @massivelivefun
### Based on
This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program

View file

@ -0,0 +1,3 @@
pub fn hello() []const u8 {
return "Goodbye, Mars!";
}

View file

@ -0,0 +1,10 @@
const std = @import("std");
const testing = std.testing;
const hello_world = @import("hello_world.zig");
test "say hi!" {
const expected = "Hello, World!";
const actual = hello_world.hello();
try testing.expectEqualStrings(expected, actual);
}