Sample Programs Repo Now Supports Testing
Tags: showdev, github, opensource, testing
Published: 2019-04-15 14:33:34

---
title: Sample Programs Repo Now Supports Testing
published: true
tags: showdev, github, opensource, testing
canonical_url: https://therenegadecoder.com/updates/sample-programs-repo-now-supports-testing/
description: Thanks to one of its contributors, Sample Programs now supports testing. It's time to celebrate!
cover_image: https://thepracticaldev.s3.amazonaws.com/i/f8k318ilhxkywt2jgsst.jpeg
---

With just over a year into the Sample Programs project, we now support testing! For a project that features over 2,300 commits, 250 code snippets, 120 stars, 100 languages, 80 forks, and 60 contributors, it’s about time.

## Credit Where Credit Is Due

In case it’s your first time hearing about the [Sample Programs][1] project, let me explain. Sample Programs is a collection of code snippets in as many languages as possible. Currently, we support 106 languages, and we’re excited to watch that number grow.

Being able to test code from such a variety of languages and projects is an amazing feat, but I have to be honest: I didn’t come up with the idea or even implement it. All the credit goes to Parker Johansen ([Auroq][2]) who is our resident polyglot and Docker expert.

In an incredibly short amount of time, Parker put together a testing framework which we can easily augment and extend every time a new project or language comes along. All I did was tie the framework into our continuous integration, so new snippets are tested whenever they arrive.

We’re now able to ensure future code snippets are valid without having to test them by hand like I was doing. Go ahead, *give the new framework a test*.

## Current Support

At the time of writing this article (March 29th), [we released support for ten languages][3] including:

- Bash
- C++
- Go
- Java
- JavaScript
- Julia
- Haskell
- Perl
- Python
- Ruby

In addition, the framework could comfortably support over 10 projects including:

- [Baklava][4]
- [Bubble Sort][5]
- [Even Odd][6]
- [Factorial][7]
- [Fizz Buzz][8]
- [Hello World][9]
- [Insertion Sort][10]
- [Merge Sort][11]
- [Quick Sort][12]
- [Quine][13]
- [Reverse a String][14]
- [Selection Sort][15]

Each project features several tests which can be found in the official project documentation.

I expect this framework to expand rapidly as I find testing and automation enjoyable. I’ll definitely be looking for ways to expand our capabilities.

## Future Work

If this project sounds interesting, there are now several ways to help out:

- Documentation
- Languages
- Projects
- Testing

From a documentation point of view, we need people to start writing articles which explain how each code snippet works. You’re welcome to write your own articles or edit existing ones. Also, for all you web devs out there, we’d love for someone to come along and improve the documentation site.

In terms of languages, we’re always looking to expand our collection. At the time of writing, there were 106 languages represented in the repo. Feel free to [check out the wiki][16] to see what we have.

Likewise, we’re always looking for ways to expand our project collection. At the time of writing, we had support for 22 projects which include various sorting algorithms and other fun challenges like prime number detection and factorial calculation. You’re welcome to [browse the list of projects][17] to see where you could make some additions.

Finally, we’d love to expand our testing capabilities (as mentioned already). I won’t dig into the specifics too much more, but you’re welcome to [browse our issues][18] to see if there’s anything else you could help with.

In the future, I plan to put together an article explaining how the testing system works, so look out for that. In the meantime, why not let me know how it sounds in the comments. If you know anyone who would enjoy this project, let them know by sharing this article with them. Word of mouth is a great way to grow a project like this, and we appreciate the help.

[1]: https://github.com/TheRenegadeCoder/sample-programs
[2]: https://github.com/auroq
[3]: https://github.com/TheRenegadeCoder/sample-programs/releases/tag/10-lang-test
[4]: https://sample-programs.therenegadecoder.com/projects/baklava/
[5]: https://sample-programs.therenegadecoder.com/projects/bubble-sort/
[6]: https://sample-programs.therenegadecoder.com/projects/even-odd/
[7]: https://sample-programs.therenegadecoder.com/projects/factorial/
[8]: https://sample-programs.therenegadecoder.com/projects/fizz-buzz/
[9]: https://sample-programs.therenegadecoder.com/projects/hello-world/
[10]: https://sample-programs.therenegadecoder.com/projects/insertion-sort/
[11]: https://sample-programs.therenegadecoder.com/projects/merge-sort/
[12]: https://sample-programs.therenegadecoder.com/projects/quick-sort/
[13]: https://sample-programs.therenegadecoder.com/projects/quine/
[14]: https://sample-programs.therenegadecoder.com/projects/reverse-a-string/
[15]: https://sample-programs.therenegadecoder.com/projects/selection-sort/
[16]: https://github.com/TheRenegadeCoder/sample-programs/wiki/Alphabetical-Language-Catalog
[17]: https://sample-programs.therenegadecoder.com/projects/
[18]: https://github.com/TheRenegadeCoder/sample-programs/issues