Commit c86c02b2 authored by Andreas Schmidt's avatar Andreas Schmidt

Remove tester.

parent aec080cf
......@@ -17,7 +17,5 @@ add_subdirectory(tests)
add_executable(sender sender.c)
add_executable(receiver receiver.c)
add_executable(tester tester.c)
target_link_libraries(sender LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(receiver LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(tester LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
\ No newline at end of file
target_link_libraries(receiver LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
\ No newline at end of file
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include "prrt/packet.h"
#include "defines.h"
#include "util/common.h"
#include "prrt/vdmcode/block_code.h"
int main() {
char* msg = "This is a test message.";
int j;
int n = 7;
int k = 4;
int length = 3;
printf("Start\n");
PrrtCoder* coder = NULL;
PrrtCoder_get_coder(&coder, n, k);
gf** src = malloc(sizeof(gf*) * k);
for (j = 0; j < k; j++) {
src[j] = malloc(sizeof(gf) * length);
memset(src[j], 0, sizeof(gf) * length);
}
src[0][0] = 1; src[0][1] = 2; src[0][2] = 1;
src[1][0] = 0; src[1][1] = 2; src[1][2] = 1;
src[2][0] = 4; src[2][1] = 1; src[2][2] = 6;
for (j = 0; j < k; j++) {
print_gf(src[j], length);
}
printf("---- ENC ----\n");
gf** fec = malloc(sizeof(gf*) * n);
for(j = 0; j < n; j++) {
fec[j] = malloc(sizeof(gf) * length);
memset(fec[j], 0, sizeof(gf) * length);
PrrtCoder_encode(coder, src, fec[j], j, length); // gf **src, gf *fec, int index, int sz
print_gf(fec[j], length);
}
// TODO: introduce missing packets
printf("---- DEC ----\n");
int *idx_p = malloc(k * sizeof(int));
for(j = 0; j < k; j++) {
idx_p[j] = j;
}
memcpy(fec[0], fec[6], sizeof(gf) * length);
idx_p[0] = 6;
PrrtCoder_decode(coder, fec, idx_p, length);
for(j = 0; j < k; j++) {
printf("Dec (%d) ", idx_p[j]);
print_gf(fec[j], length);
}
return 0;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment