tmpbuf_tr takes an input string and 2 sets of characters plus a default character. It produces a output string with all characters from the first set translated to the correspondending character in the 2nd set, similar to the shell 'tr' util.
55 lines
750 B
Text
55 lines
750 B
Text
|
|
TESTING "Safe clib and tools" ./test-safeclib
|
|
|
|
TEST "Allocating 0 bytes" allocation0 <<END
|
|
return: 134
|
|
END
|
|
|
|
TEST "Allocating some memory" allocation1024 <<END
|
|
return: 0
|
|
END
|
|
|
|
# seems that exit codes are not table here, was
|
|
# return: 134 before, needs to be fixed with improved testsuite
|
|
TEST "Allocation error" allocationtoobig <<END
|
|
return: 139
|
|
END
|
|
|
|
|
|
TEST "string equal check" streq <<END
|
|
return: 0
|
|
END
|
|
|
|
|
|
TEST "temporary buffers" tmpbuf <<END
|
|
return: 0
|
|
END
|
|
|
|
|
|
TEST "tr0 success" tr0 123abcABC456 <<END
|
|
out: 123ABCABC456
|
|
return: 0
|
|
END
|
|
|
|
|
|
TEST "tr0 fail" tr0 123abcABC456_ <<END
|
|
out: failed
|
|
return: 0
|
|
END
|
|
|
|
|
|
TEST "tr" tr 123abcABC456_ <<END
|
|
out: 123ABCABC456
|
|
return: 0
|
|
END
|
|
|
|
|
|
TEST "tr_" tr_ 123abc_/?ABC456_ <<END
|
|
out: 123ABC___ABC456_
|
|
return: 0
|
|
END
|
|
|
|
|
|
|
|
|
|
|