Merge branches/quickjs to trunk. This is the way.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3621 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-01-02 18:10:00 +00:00
parent d293637741
commit 79022e1e1f
703 changed files with 419987 additions and 30640 deletions

37
deps/base64c/test/test003.c vendored Normal file
View File

@@ -0,0 +1,37 @@
#include "../include/base64c.h"
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
unsigned char in[10] = "Hello Wor";
size_t in_len = 9;
unsigned char enc[32];
size_t enc_len = 32;
unsigned char out[12];
size_t out_len = 12;
printf("Encoding %lu - %s\n", in_len, in);
size_t enc_result = base64c_encode(in, in_len, enc, enc_len);
printf("Encoded %lu - %s\n", enc_result, enc);
size_t dec_result = base64c_decode(enc, enc_result, out, out_len);
if ((long)dec_result < 0) {
printf("Decode failed with code %ld\n", (long)dec_result);
return 1;
}
printf("Decoded %lu - %s\n", dec_result, out);
if (dec_result != in_len) {
printf("in length %ld not equal to out length %ld", in_len, dec_result);
return 3;
}
if (strncmp((char*)in, (char*)out, in_len)) {
printf("roundtrip encoding failed\n");
return 2;
}
}