-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.c
42 lines (30 loc) · 845 Bytes
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
#include <string.h>
#include "aldc.h"
int round_trip(char *s)
{
char *compressed;
size_t compressed_len;
char *decompressed;
size_t decompressed_len;
int r;
r = EncodeAldcString(s, strlen(s), &compressed, &compressed_len);
printf("Compressed to %lu bytes.\nCompressed Data:", compressed_len);
/* fwrite(compressed, 1, compressed_len, stdout); */
r = DecodeAldcString(compressed, compressed_len, &decompressed, &decompressed_len);
free(compressed);
printf("\nDecompressed to %lu bytes.\ndecompressed Data:", decompressed_len);
fwrite(decompressed, 1, decompressed_len, stdout);
return 0;
}
char big_s[99999999];
int main()
{
round_trip( "I am a string.\n");
round_trip( "");
round_trip( "a");
memset(big_s, 'a', 99999999);
big_s[99999998] = 0;
round_trip(big_s);
return 0;
}