https://codingchallenges.fyi/challenges/challenge-wc
- Run unit test
$ make test
- Run build
$ make build
- Clean folder
$ make clean
After building the tool successfully, there will be the executable file ccwc
in the root folder.
- Count bytes
$ ./ccwc -c test.txt
342190 test.txt
- Count lines
$ ./ccwc -l test.txt
7145 test.txt
- Count words
$ ./ccwc -w test.txt
58164 test.txt
- Count characters
$ ./ccwc -m test.txt
339292 test.txt
- Count characters
$ ./ccwc test.txt
7145 58164 342190 test.txt
- Count bytes
$ cat test.txt | ./ccwc -c
342190 test.txt
- Count lines
$ cat test.txt | ./ccwc -l
7145 test.txt
- Count words
$ cat test.txt | ./ccwc -w
58164 test.txt
- Count characters
$ cat test.txt | ./ccwc -m
339292 test.txt
- Count characters
$ cat test.txt | ./ccwc
7145 58164 342190 test.txt
ccwc
is a tool that tries to clone features from the Unix command wc
. Thus, the unit tests will use the output from wc
as the source of truth. Moreover, the outcome of count words method could be different on different environments.
Copyright (c) 2024-present, Tuan LE CONG