Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mokiat/hacktherank
Tool for quickly testing your hackerrank solutions
https://github.com/mokiat/hacktherank
go golang hackerrank testing tool
Last synced: 22 days ago
JSON representation
Tool for quickly testing your hackerrank solutions
- Host: GitHub
- URL: https://github.com/mokiat/hacktherank
- Owner: mokiat
- License: mit
- Created: 2020-07-26T18:54:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-21T21:48:11.000Z (almost 2 years ago)
- Last Synced: 2024-11-09T01:25:33.384Z (3 months ago)
- Topics: go, golang, hackerrank, testing, tool
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hack The Rank
![Build Status](https://github.com/mokiat/hacktherank/workflows/Go/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/mokiat/hacktherank)](https://goreportcard.com/report/github.com/mokiat/hacktherank)A tool that should make it easier to write and test Go solutions for HackerRank challenges.
The `hacktherank` tool allows you to run a set of test data samples against your source code.## Usage
1. Install the tool
```sh
go install github.com/mokiat/hacktherank@latest
```1. Create a test data file
This is a file which contains the input lines to test with and the expected output lines. It is possible to specify multiple test scenarios (or samples) within a single file. Following is an example for a sum challenge.
```
input:
3 5
output:
8
input:
10 20
output:
30```
**Note:** Make sure that all relevant new-line symbols are added and that no unexpected blank space characters are inserted. The tool matches lines exactly - without trimming.
1. Write your solution
You should create a `main.go` file somwhere and add your Go implementation to it.
1. Test your solution with the `hacktherank` tool
Following is a demonstration using the example folder of this project.
```sh
hacktherank -main example/main.go -data example/data.txt
```1. Iterate over your solution
Once you start tackling more complicated challenges, it is unlikely that you will be able to solve them on the first try.
Make adjustments to your `main.go` file and just rerun the command to see if you have solved it.