Skip to content

Commit

Permalink
Added readme for the first example.
Browse files Browse the repository at this point in the history
  • Loading branch information
しずえ committed Oct 25, 2021
1 parent fd4e8be commit 0ee8404
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions _examples/01_bad_sort/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Example 1. Bad sort

This example demonstrates the highlighting capabilities of scold.

`inputs.txt` specifies the test cases for a program that sorts integers in ascending order. The test program, however, sorts integers as if they were strings -- in a lexicographical order.

Run the example using:
```
$ go build bad_sort.go
$ scold bad_sort
```

Or, since ver2.01a, you can just do
```
$ scold go run bad_sort.go
```

The output will look like this:

![scold's output for example 1](output.png)

1. Note that in the first test case there is a mismatch between 10 and 11, and, even though, the first characters (`'1'`) match, the numbers are highlighted fully.
2. In the second test case, there is a mismatch between 20 and -20, but only the *sign* is highlighted.
3. scold intentionally ignores presentation differences. The +0 and 00 seem different as strings, but truly *are* zeros, so no mismatch is found.
Binary file added _examples/01_bad_sort/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0ee8404

Please sign in to comment.