1*cf5a6c84SAndroid Build Coastguard Worker#!/bin/bash 2*cf5a6c84SAndroid Build Coastguard Worker 3*cf5a6c84SAndroid Build Coastguard Worker[ -f testing.sh ] && . testing.sh 4*cf5a6c84SAndroid Build Coastguard Worker 5*cf5a6c84SAndroid Build Coastguard Worker#testing "name" "command" "result" "infile" "stdin" 6*cf5a6c84SAndroid Build Coastguard Worker 7*cf5a6c84SAndroid Build Coastguard Workertesting "stdin" "strings" "foobar\n" "" "foobar\n" 8*cf5a6c84SAndroid Build Coastguard Workertesting "file" "strings input" "foobar\n" "foobar\n" "" 9*cf5a6c84SAndroid Build Coastguard Workertesting "string to the end" "strings input" "foobar\n" "foobar" "" 10*cf5a6c84SAndroid Build Coastguard Workertesting "short strings" "strings input" "" "foo\nbar\n" "" 11*cf5a6c84SAndroid Build Coastguard Workertesting "-n6" "strings -n6 input" "foobar\n" "foobar\nbaz\n" "" 12*cf5a6c84SAndroid Build Coastguard Workertesting "string and nulls" "strings input" "foobar\nbazfoo\n" \ 13*cf5a6c84SAndroid Build Coastguard Worker "\0foobar\0\0bazfoo\0foo" "" 14*cf5a6c84SAndroid Build Coastguard Workertesting "-f" "strings -f input" "input: foobar\n" "foobar\n" "" 15*cf5a6c84SAndroid Build Coastguard Workertesting "-o" "strings -o input | sed 's/^ *//'" "6 foobar\n" \ 16*cf5a6c84SAndroid Build Coastguard Worker "\0\0\0\0\0\0foobar\n" "" 17*cf5a6c84SAndroid Build Coastguard Workertesting "-o, multiple strings" "strings -n3 -o input | sed 's/^ *//'" \ 18*cf5a6c84SAndroid Build Coastguard Worker "1 foo\n7 bar\n" "\0foo\0b\0bar\n" "" 19*cf5a6c84SAndroid Build Coastguard Workertesting "-fo" "strings -fo input | sed 's/: */: /'" "input: 6 foobar\n" \ 20*cf5a6c84SAndroid Build Coastguard Worker "\0\0\0\0\0\0foobar\n" "" 21*cf5a6c84SAndroid Build Coastguard Worker 22*cf5a6c84SAndroid Build Coastguard WorkerOFFSET_10="\0\0\0\0\0\0\0\0\0\0foobar\n" 23*cf5a6c84SAndroid Build Coastguard Workertesting "-t o" "strings -t o | sed 's/^ *//'" "12 foobar\n" "" $OFFSET_10 24*cf5a6c84SAndroid Build Coastguard Workertesting "-t d" "strings -t d | sed 's/^ *//'" "10 foobar\n" "" $OFFSET_10 25*cf5a6c84SAndroid Build Coastguard Workertesting "-t x" "strings -t x | sed 's/^ *//'" "a foobar\n" "" $OFFSET_10 26