Commit 7f4ef76e authored by Andreas Schmidt's avatar Andreas Schmidt

Test if multiple runs on one coder succeed.

parent d4d123e5
Pipeline #1077 failed with stages
in 44 seconds
......@@ -32,7 +32,7 @@ protected:
TEST_F(PrrtBlockTest, VDMCode)
{
int i, j;
int i, j, q;
uint8_t k = 4;
uint8_t n = 7;
uint8_t r = n - k;
......@@ -42,58 +42,60 @@ TEST_F(PrrtBlockTest, VDMCode)
PrrtCoder_get_coder(&coder, n, k);
gf **src = (gf **) calloc(k, sizeof(gf *));
src[0] = (gf *) calloc(length, sizeof(gf));
src[0][0] = 1; src[0][2] = 3;
src[1] = (gf *) calloc(length, sizeof(gf));
src[1][0] = 2; src[1][2] = 7;
src[2] = (gf *) calloc(length, sizeof(gf));
src[2][0] = 3; src[2][2] = 6;
src[3] = (gf *) calloc(length, sizeof(gf));
src[3][0] = 4; src[3][1]= 9; src[3][2] = 5;
gf **encFec = (gf **) calloc(1, sizeof(gf *) * r);
for(j = 0; j < r; j++) {
encFec[j] = (gf *) calloc(length, sizeof(gf));
PrrtCoder_encode(coder, src, encFec[j], j + k, length);
}
for(q = 0; q < 4; q++) {
gf **src = (gf **) calloc(k, sizeof(gf *));
src[0] = (gf *) calloc(length, sizeof(gf));
src[0][0] = 1; src[0][2] = 3;
src[1] = (gf *) calloc(length, sizeof(gf));
src[1][0] = 2; src[1][2] = 7;
src[2] = (gf *) calloc(length, sizeof(gf));
src[2][0] = 3; src[2][2] = 6;
src[3] = (gf *) calloc(length, sizeof(gf));
src[3][0] = 4; src[3][1]= 9; src[3][2] = 5;
gf **decFec = (gf **) calloc(1, sizeof(gf *) * k);
int *idx_p = (int *) calloc(k, sizeof(int));
gf **encFec = (gf **) calloc(1, sizeof(gf *) * r);
for(j = 0; j < r; j++) {
encFec[j] = (gf *) calloc(length, sizeof(gf));
PrrtCoder_encode(coder, src, encFec[j], j + k, length);
}
for(i = 0; i < k; i++) {
decFec[i] = (gf *) calloc(length, sizeof(gf));
}
gf **decFec = (gf **) calloc(1, sizeof(gf *) * k);
int *idx_p = (int *) calloc(k, sizeof(int));
memcpy(decFec[0], src[0], length);
idx_p[0] = 0;
for(i = 0; i < k; i++) {
decFec[i] = (gf *) calloc(length, sizeof(gf));
}
memcpy(decFec[1], src[1], length);
idx_p[1] = 1;
memcpy(decFec[0], src[0], length);
idx_p[0] = 0;
memcpy(decFec[2], encFec[0], length);
idx_p[2] = 4;
memcpy(decFec[1], src[1], length);
idx_p[1] = 1;
memcpy(decFec[3], src[3], length);
idx_p[3] = 3;
memcpy(decFec[2], encFec[0], length);
idx_p[2] = 4;
PrrtCoder_decode(coder, decFec, idx_p, length);
memcpy(decFec[3], src[3], length);
idx_p[3] = 3;
ASSERT_EQ(1, decFec[0][0]);
ASSERT_EQ(0, decFec[0][1]);
ASSERT_EQ(3, decFec[0][2]);
PrrtCoder_decode(coder, decFec, idx_p, length);
ASSERT_EQ(2, decFec[1][0]);
ASSERT_EQ(0, decFec[1][1]);
ASSERT_EQ(7, decFec[1][2]);
ASSERT_EQ(1, decFec[0][0]);
ASSERT_EQ(0, decFec[0][1]);
ASSERT_EQ(3, decFec[0][2]);
ASSERT_EQ(3, decFec[2][0]);
ASSERT_EQ(0, decFec[2][1]);
ASSERT_EQ(6, decFec[2][2]);
ASSERT_EQ(2, decFec[1][0]);
ASSERT_EQ(0, decFec[1][1]);
ASSERT_EQ(7, decFec[1][2]);
ASSERT_EQ(4, decFec[3][0]);
ASSERT_EQ(9, decFec[3][1]);
ASSERT_EQ(5, decFec[3][2]);
ASSERT_EQ(3, decFec[2][0]);
ASSERT_EQ(0, decFec[2][1]);
ASSERT_EQ(6, decFec[2][2]);
ASSERT_EQ(4, decFec[3][0]);
ASSERT_EQ(9, decFec[3][1]);
ASSERT_EQ(5, decFec[3][2]);
}
PrrtCoder_destroy(coder);
}
......
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