diff options
author | Dariusz Michaluk <d.michaluk@samsung.com> | 2024-02-13 15:44:51 +0100 |
---|---|---|
committer | Dariusz Michaluk <d.michaluk@samsung.com> | 2024-02-14 10:46:44 +0100 |
commit | c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335 (patch) | |
tree | 504a1953b56446487f4759d3a5f348bbeb925461 /tests/setof.c | |
parent | 1778d37a3eec1209d7c9c064318f3ff8c5132490 (diff) | |
parent | 031996ef501f8c3d0532f7df1c38cf2e540a4f11 (diff) | |
download | libtasn1-c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335.tar.gz libtasn1-c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335.tar.bz2 libtasn1-c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335.zip |
Upgrade to libtasn1 4.19.0HEADaccepted/tizen/unified/20240214.164006tizenaccepted/tizen_unified
Change-Id: I893fd2c90c487d6e13b0b10e25b2cafc408da180
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) |