aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-09-17 08:45:25 +0200
committerlaforge <laforge@osmocom.org>2021-09-21 19:57:56 +0000
commitd075e3ae23ceae236a9cb4a3081856e0b38039e1 (patch)
tree6f16569b71799ba7eba78e1f134f2eac9d137f72 /tests
parent292f9e7014056125f9abadd8df1b2850141bc6c0 (diff)
base64: reformat using Lindent to conform to our coding style
Diffstat (limited to 'tests')
-rw-r--r--tests/base64/base64_test.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/tests/base64/base64_test.c b/tests/base64/base64_test.c
index e85f6490..79ec212a 100644
--- a/tests/base64/base64_test.c
+++ b/tests/base64/base64_test.c
@@ -1,17 +1,17 @@
#include <osmocom/core/base64.h>
#include <stdio.h>
#include <string.h>
-
-static const unsigned char base64_test_dec[64] =
-{
- 0x24, 0x48, 0x6E, 0x56, 0x87, 0x62, 0x5A, 0xBD,
- 0xBF, 0x17, 0xD9, 0xA2, 0xC4, 0x17, 0x1A, 0x01,
- 0x94, 0xED, 0x8F, 0x1E, 0x11, 0xB3, 0xD7, 0x09,
- 0x0C, 0xB6, 0xE9, 0x10, 0x6F, 0x22, 0xEE, 0x13,
- 0xCA, 0xB3, 0x07, 0x05, 0x76, 0xC9, 0xFA, 0x31,
- 0x6C, 0x08, 0x34, 0xFF, 0x8D, 0xC2, 0x6C, 0x38,
- 0x00, 0x43, 0xE9, 0x54, 0x97, 0xAF, 0x50, 0x4B,
- 0xD1, 0x41, 0xBA, 0x95, 0x31, 0x5A, 0x0B, 0x97
+#include <stdlib.h>
+
+static const unsigned char base64_test_dec[64] = {
+ 0x24, 0x48, 0x6E, 0x56, 0x87, 0x62, 0x5A, 0xBD,
+ 0xBF, 0x17, 0xD9, 0xA2, 0xC4, 0x17, 0x1A, 0x01,
+ 0x94, 0xED, 0x8F, 0x1E, 0x11, 0xB3, 0xD7, 0x09,
+ 0x0C, 0xB6, 0xE9, 0x10, 0x6F, 0x22, 0xEE, 0x13,
+ 0xCA, 0xB3, 0x07, 0x05, 0x76, 0xC9, 0xFA, 0x31,
+ 0x6C, 0x08, 0x34, 0xFF, 0x8D, 0xC2, 0x6C, 0x38,
+ 0x00, 0x43, 0xE9, 0x54, 0x97, 0xAF, 0x50, 0x4B,
+ 0xD1, 0x41, 0xBA, 0x95, 0x31, 0x5A, 0x0B, 0x97
};
static const unsigned char base64_test_enc[] =
@@ -23,35 +23,33 @@ static const unsigned char base64_test_enc[] =
*/
int main(int argc, char **argv)
{
- size_t len;
- const unsigned char *src;
- unsigned char buffer[128];
+ size_t len;
+ const unsigned char *src;
+ unsigned char buffer[128];
- printf( " Base64 encoding test: " );
+ printf(" Base64 encoding test: ");
- src = base64_test_dec;
+ src = base64_test_dec;
- if( osmo_base64_encode( buffer, sizeof( buffer ), &len, src, 64 ) != 0 ||
- memcmp( base64_test_enc, buffer, 88 ) != 0 )
- {
- printf( "failed\n" );
+ if (osmo_base64_encode(buffer, sizeof(buffer), &len, src, 64) != 0 ||
+ memcmp(base64_test_enc, buffer, 88) != 0) {
+ printf("failed\n");
- return( 1 );
- }
+ exit(1);
+ }
- printf( "passed\n Base64 decoding test: " );
+ printf("passed\n Base64 decoding test: ");
- src = base64_test_enc;
+ src = base64_test_enc;
- if( osmo_base64_decode( buffer, sizeof( buffer ), &len, src, 88 ) != 0 ||
- memcmp( base64_test_dec, buffer, 64 ) != 0 )
- {
- printf( "failed\n" );
+ if (osmo_base64_decode(buffer, sizeof(buffer), &len, src, 88) != 0 ||
+ memcmp(base64_test_dec, buffer, 64) != 0) {
+ printf("failed\n");
- return( 1 );
- }
+ exit(1);
+ }
- printf( "passed\n\n" );
+ printf("passed\n\n");
- return( 0 );
+ exit(0);
}