diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/t-printf.c | 25 | ||||
-rw-r--r-- | tests/t-strerror.c | 5 |
2 files changed, 29 insertions, 1 deletions
diff --git a/tests/t-printf.c b/tests/t-printf.c index c261838..c1ad0b0 100644 --- a/tests/t-printf.c +++ b/tests/t-printf.c @@ -489,6 +489,30 @@ check_fprintf_sf (void) gpgrt_fclose (stream); } +static void +check_fwrite (void) +{ + gpgrt_stream_t stream; + const char *expect; + char *result; + + stream = gpgrt_fopenmem (0, "w+b"); + if (!stream) + die ("fopenmem failed at line %d\n", __LINE__); + + gpgrt_fwrite ("Has the dog Buddha-nature or not?", 1, 33, stream); + expect = "Has the dog Buddha-nature or not?"; + result = stream_to_string (stream); + if (strcmp (result, expect)) + { + show ("expect: '%s'\n", expect); + show ("result: '%s'\n", result); + fail ("fprintf_sf failed at %d\n", __LINE__); + } + free (result); + gpgrt_fclose (stream); +} + int main (int argc, char **argv) @@ -535,6 +559,7 @@ main (int argc, char **argv) run_tests (); check_snprintf (); check_fprintf_sf (); + check_fwrite (); #ifdef __GLIBC__ return !!errorcount; diff --git a/tests/t-strerror.c b/tests/t-strerror.c index 9289066..5c38fca 100644 --- a/tests/t-strerror.c +++ b/tests/t-strerror.c @@ -49,7 +49,10 @@ main (int argc, char *argv[]) gpg_err_source_t src; gpg_err_code_t code; } list[] = { { 0, 0 }, { 1, 201 }, { 2, 2 }, { 3, 102 }, - { 4, 100 }, { 5, 99 }, { 6, 110 }, { 7, 7 }, { 8, 888 } }; + { 4, 100 }, { 5, 99 }, { 6, 110 }, { 7, 7 }, { 8, 888 }, + { 1, GPG_ERR_SYSTEM_ERROR | 1 }, + { 1, GPG_ERR_SYSTEM_ERROR | 35 }, + { 1, GPG_ERR_SYSTEM_ERROR | 81 } }; int i = 0; while (i < sizeof (list) / sizeof (list[0])) |