~sircmpwn/ctools

ref: 11b6d8c6ef5a73de4b0049e3ad720cca2a86dfb1 ctools/test/cksum -rw-r--r-- 808 bytes
11b6d8c6Drew DeVault test/cat: add -- test 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
. "$HARNESS" cksum

should_handle_empty_stdin() (
	[ "$(cksum </dev/null)" = "4294967295 0" ]
)

should_handle_normal_stdin() (
	[ "$(echo hello world | cksum)" = "3733384285 12" ]
)

should_handle_empty_file() (
	[ "$(cksum </dev/null)" = "4294967295 0" ]
)

should_handle_largefile() (
	[ "$(largefile | cksum)" = "4033688160 12288" ]
)

should_handle_multifile() (
	largefile >"$TMPDIR"/largefile
	output=$(cksum /dev/null "$TMPDIR"/largefile)
	[ "$(echo "$output" | head -n1)" = "4033688160 12288 $TMPDIR/largefile" ]
	[ "$(echo "$output" | head -n1)" = "4294967295 0 /dev/null" ]
)

should_handle_ddash cksum /dev/null

runtests \
	should_handle_ddash \
	should_handle_empty_stdin \
	should_handle_normal_stdin \
	should_handle_empty_file \
	should_handle_largefile \
	should_handle_multifile