https://github.com/iwdgo/largeoutput
Testing large outputs of ordinary exercises
https://github.com/iwdgo/largeoutput
go golang ordinary-exercises testing
Last synced: 12 months ago
JSON representation
Testing large outputs of ordinary exercises
- Host: GitHub
- URL: https://github.com/iwdgo/largeoutput
- Owner: iwdgo
- License: bsd-2-clause
- Created: 2018-05-08T14:20:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T06:21:11.000Z (almost 2 years ago)
- Last Synced: 2024-08-19T07:37:56.470Z (almost 2 years ago)
- Topics: go, golang, ordinary-exercises, testing
- Language: Go
- Homepage: https://pkg.go.dev/github.com/iwdgo/largeoutput
- Size: 109 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/iwdgo/largeoutput)
[](https://goreportcard.com/report/github.com/iwdgo/largeoutput)
[](https://codecov.io/gh/iwdgo/largeoutput)
[](https://cirrus-ci.com/github/iwdgo/largeoutput)
[](https://ci.appveyor.com/project/iwdgo/largeoutput)
[](https://github.com/iwdgo/largeoutput/actions/workflows/go.yml)
# Some ordinary exercises using modules
- **Binedit** : Produce a copy of a file named "data.bin" that does not fit in memory, while deleting every seventh byte.
- **Modulo37** : Output numbers following some rules. The module outputs sequentially the integers from 1 to 99.
- **Sumofconverts** : Convert a set of strings which contains numbers. It returns the sum of the items representing numbers and skips others.
A recursive and non-recursive version are benchmarked.
More documentation in each package.
# Testing
An ordinary exercise may have a large output for which the easy `// Output:`
becomes unreadable. In this case, output of reduced set of data to a file for which content
can be evaluated is more convenient. It is usable even without access to the original code.
Piping `Stdout` to a file is easier. A helper to compare the file to a reference file.
Comparison is done using module [github.com/iwdgo/testingfiles](https://github.com/iwdgo/testingfiles) which
returns errors usable by the `testing` package.
The original code for piping output is from the commit history of `golang.go/src/testing/example.go` was using
unexported routines. It is adapted to these cases.