diff options
author | Dariusz Michaluk <d.michaluk@samsung.com> | 2024-02-13 15:38:29 +0100 |
---|---|---|
committer | Dariusz Michaluk <d.michaluk@samsung.com> | 2024-02-13 15:38:29 +0100 |
commit | 031996ef501f8c3d0532f7df1c38cf2e540a4f11 (patch) | |
tree | 27217d793b273edadc969aa3110378aac3c36e9c /tests/setof.c | |
parent | 26bea900a531662c6028ecc06f4adea825658434 (diff) | |
download | libtasn1-031996ef501f8c3d0532f7df1c38cf2e540a4f11.tar.gz libtasn1-031996ef501f8c3d0532f7df1c38cf2e540a4f11.tar.bz2 libtasn1-031996ef501f8c3d0532f7df1c38cf2e540a4f11.zip |
Imported Upstream version 4.19.0upstream/4.19.0upstream
Diffstat (limited to 'tests/setof.c')
-rw-r--r-- | tests/setof.c | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/tests/setof.c b/tests/setof.c index ea4de9b..7065958 100644 --- a/tests/setof.c +++ b/tests/setof.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2018 Free Software Foundation, Inc. + * Copyright (C) 2002-2022 Free Software Foundation, Inc. * * This file is part of LIBTASN1. * @@ -91,58 +91,64 @@ main (int argc, char *argv[]) } result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "?LAST.val", "\x00\x02", 2); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); - result = asn1_write_value (asn1_element, "?LAST.val", "\x00\x01\x00\x00", 4); - assert(result == ASN1_SUCCESS); + result = + asn1_write_value (asn1_element, "?LAST.val", "\x00\x01\x00\x00", 4); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); - result = asn1_write_value (asn1_element, "?LAST.val", "\x00\x00\x00\x00", 4); - assert(result == ASN1_SUCCESS); + result = + asn1_write_value (asn1_element, "?LAST.val", "\x00\x00\x00\x00", 4); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); - result = asn1_write_value (asn1_element, "?LAST.val", "\x00\x00\x00\x02", 4); - assert(result == ASN1_SUCCESS); + result = + asn1_write_value (asn1_element, "?LAST.val", "\x00\x00\x00\x02", 4); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); - result = asn1_write_value (asn1_element, "?LAST.val", "\x00\x00\x00\x01", 4); - assert(result == ASN1_SUCCESS); + result = + asn1_write_value (asn1_element, "?LAST.val", "\x00\x00\x00\x01", 4); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); - result = asn1_write_value (asn1_element, "?LAST.val", "\x01\x00\x00\x00", 4); - assert(result == ASN1_SUCCESS); + result = + asn1_write_value (asn1_element, "?LAST.val", "\x01\x00\x00\x00", 4); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); - result = asn1_write_value (asn1_element, "?LAST.val", "\x01\x01\x00\x00", 4); - assert(result == ASN1_SUCCESS); + result = + asn1_write_value (asn1_element, "?LAST.val", "\x01\x01\x00\x00", 4); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "?LAST.val", "\x05", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "", "NEW", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); result = asn1_write_value (asn1_element, "?LAST.val", "\x01", 1); - assert(result == ASN1_SUCCESS); + assert (result == ASN1_SUCCESS); /* Clear the definition structures */ @@ -157,25 +163,29 @@ main (int argc, char *argv[]) asn1_delete_structure (&asn1_element); asn1_delete_structure (&definitions); - if (data_size != sizeof(expected_der) || memcmp(data, expected_der, data_size) != 0) + if (data_size != sizeof (expected_der) + || memcmp (data, expected_der, data_size) != 0) { - fprintf(stderr, "encoded data differ to expected [%d - %d]!\n", data_size, (int)sizeof(expected_der)); - printf("static unsigned char got[] = {\n"); - for (i=0;i<(unsigned)data_size;i++) { - printf("0x%.2x, ", (unsigned)data[i]); - if ((i+1) % 8 == 0) - printf("\n"); - } - printf("};\n"); - - printf("static unsigned char expected[] = {\n"); - for (i=0;i<(unsigned)sizeof(expected_der);i++) { - printf("0x%.2x, ", (unsigned)expected_der[i]); - if ((i+1) % 8 == 0) - printf("\n"); - } - printf("};\n"); - exit(1); + fprintf (stderr, "encoded data differ to expected [%d - %d]!\n", + data_size, (int) sizeof (expected_der)); + printf ("static unsigned char got[] = {\n"); + for (i = 0; i < (unsigned) data_size; i++) + { + printf ("0x%.2x, ", (unsigned) data[i]); + if ((i + 1) % 8 == 0) + printf ("\n"); + } + printf ("};\n"); + + printf ("static unsigned char expected[] = {\n"); + for (i = 0; i < (unsigned) sizeof (expected_der); i++) + { + printf ("0x%.2x, ", (unsigned) expected_der[i]); + if ((i + 1) % 8 == 0) + printf ("\n"); + } + printf ("};\n"); + exit (1); } if (verbose) |