add data compression and decompression
This commit is contained in:
+6
-7
@@ -1,8 +1,7 @@
|
||||
#include "test_chunk.h"
|
||||
#include "chunk.h"
|
||||
#include "utils.h"
|
||||
#include "test_utils.h"
|
||||
#include <stdlib.h>
|
||||
#include "utils.h"
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -37,7 +36,7 @@ static void test_file_receive_operations() {
|
||||
char *data = str_dup("receive data content");
|
||||
unsigned long long size = strlen(data);
|
||||
|
||||
DataFragment *df = data_fragment_create(data, size);
|
||||
Data *df = data_create(data, size);
|
||||
EXPECT_NOT_NULL(df);
|
||||
EXPECT_EQ_INT((int)df->size, (int)size);
|
||||
EXPECT_EQ_STR(df->data, "receive data content");
|
||||
@@ -80,10 +79,10 @@ static void test_chunk_operations() {
|
||||
Data *formatted = chunk_format(chunk);
|
||||
EXPECT_NOT_NULL(formatted);
|
||||
|
||||
unsigned long long expected_size =
|
||||
(sizeof(int) + strlen(path1) + sizeof(unsigned long long) + len1) +
|
||||
(sizeof(int) + strlen(path2) + sizeof(unsigned long long) + len2);
|
||||
EXPECT_EQ_INT((int)formatted->data_size, (int)expected_size);
|
||||
unsigned long long expected_size =
|
||||
(sizeof(int) + strlen(path1) + sizeof(unsigned long long) + len1) +
|
||||
(sizeof(int) + strlen(path2) + sizeof(unsigned long long) + len2);
|
||||
EXPECT_EQ_INT((int)formatted->size, (int)expected_size);
|
||||
|
||||
char *ptr = (char *)formatted->data;
|
||||
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@
|
||||
|
||||
static void test_config_lifecycle() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("/dst"),
|
||||
true, true, false, false, 4);
|
||||
true, true, false, false, 1, 4);
|
||||
EXPECT_NOT_NULL(cfg);
|
||||
EXPECT_EQ_STR(cfg->version, "1.0");
|
||||
EXPECT_EQ_STR(cfg->send_directory, "/src");
|
||||
@@ -23,7 +23,7 @@ static void test_config_lifecycle() {
|
||||
|
||||
static void test_pipeline_sender_lifecycle() {
|
||||
Config *cfg = config_create(str_dup("2.0"), str_dup("/src2"),
|
||||
str_dup("/dst2"), false, false, true, true, 8);
|
||||
str_dup("/dst2"), false, false, true, true, 1, 8);
|
||||
Queue *q1 = queue_create(5, NULL);
|
||||
Queue *q2 = queue_create(15, NULL);
|
||||
|
||||
@@ -40,7 +40,7 @@ static void test_pipeline_sender_lifecycle() {
|
||||
|
||||
static void test_pipeline_receiver_lifecycle() {
|
||||
Config *cfg = config_create(str_dup("3.0"), str_dup("/src3"),
|
||||
str_dup("/dst3"), true, true, true, true, 2);
|
||||
str_dup("/dst3"), true, true, true, true, 1, 2);
|
||||
Queue *q = queue_create(20, NULL);
|
||||
|
||||
PipelineContextReceiver *pcr = pipeline_context_receiver_create(cfg, q, 42);
|
||||
|
||||
Reference in New Issue
Block a user