commit 6b89913b9474be8371af970f4b4ac3bd4c9b728b Author: Andrew Scott Date: Wed Jan 3 03:10:04 2024 -0500 first commit diff --git a/zig/hello-world/.exercism/config.json b/zig/hello-world/.exercism/config.json new file mode 100644 index 0000000..030a0bc --- /dev/null +++ b/zig/hello-world/.exercism/config.json @@ -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" +} diff --git a/zig/hello-world/.exercism/metadata.json b/zig/hello-world/.exercism/metadata.json new file mode 100644 index 0000000..97007c9 --- /dev/null +++ b/zig/hello-world/.exercism/metadata.json @@ -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} \ No newline at end of file diff --git a/zig/hello-world/HELP.md b/zig/hello-world/HELP.md new file mode 100644 index 0000000..d42a46f --- /dev/null +++ b/zig/hello-world/HELP.md @@ -0,0 +1,53 @@ +# Help + +## Running the tests + +Write your code in `.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 \ No newline at end of file diff --git a/zig/hello-world/README.md b/zig/hello-world/README.md new file mode 100644 index 0000000..f9e0fb1 --- /dev/null +++ b/zig/hello-world/README.md @@ -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 \ No newline at end of file diff --git a/zig/hello-world/hello_world.zig b/zig/hello-world/hello_world.zig new file mode 100644 index 0000000..14e7bb0 --- /dev/null +++ b/zig/hello-world/hello_world.zig @@ -0,0 +1,3 @@ +pub fn hello() []const u8 { + return "Goodbye, Mars!"; +} diff --git a/zig/hello-world/test_hello_world.zig b/zig/hello-world/test_hello_world.zig new file mode 100644 index 0000000..970b77b --- /dev/null +++ b/zig/hello-world/test_hello_world.zig @@ -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); +}