summaryrefslogtreecommitdiff
path: root/test/liberasurecode_test.c
diff options
context:
space:
mode:
authorEric Lambert <eric_lambert@xyratex.com>2014-08-06 12:19:55 -0700
committerEric Lambert <eric_lambert@xyratex.com>2014-08-06 12:19:55 -0700
commit9f8865d4798ed6959aa8ba9cb862eb440dd51d2d (patch)
tree0a15a5f170003aea0a9759b69a228723eceb5bc6 /test/liberasurecode_test.c
parentef8c9f9c20f086f5bf52e9bcf1c4d825c6f6f87c (diff)
downloadliberasurecode-9f8865d4798ed6959aa8ba9cb862eb440dd51d2d.tar.gz
Added reconstruct test cases
Diffstat (limited to 'test/liberasurecode_test.c')
-rw-r--r--test/liberasurecode_test.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index e718024..dbea79c 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -204,9 +204,19 @@ static void reconstruct_test_impl(const char *backend,
{
continue;
}
+ char *cmp = NULL;
+ if (i < args->k)
+ {
+ cmp = encoded_data[i];
+ }
+ else
+ {
+ cmp = encoded_parity[i - args->k];
+ }
memset(out, 0, encoded_fragment_len);
rc = liberasurecode_reconstruct_fragment(desc, avail_frags, num_avail_frags, encoded_fragment_len, i, out);
assert(rc == 0);
+ assert(memcmp(out, cmp, encoded_fragment_len) == 0);
}
}
@@ -282,10 +292,14 @@ static void test_simple_encode_decode(const char *backend,
static void test_simple_reconstruct(const char *backend,
struct ec_args *args)
{
- int *skip = create_skips_array(args,-1);
- assert(skip != NULL);
- reconstruct_test_impl(backend, args, skip);
- free(skip);
+ int i = 0;
+ for (i = 0; i < args->k + args->m; i++)
+ {
+ int *skip = create_skips_array(args,i);
+ assert(skip != NULL);
+ reconstruct_test_impl(backend, args, skip);
+ free(skip);
+ }
}
struct ec_args null_args = {
@@ -379,6 +393,10 @@ struct testcase testcases[] = {
test_decode_with_missing_multi_parity,
"jerasure_rs_vand", &jerasure_rs_vand_args,
.skip = false},
+ {"simple_reconstruct_jerasure_rs_vand",
+ test_simple_reconstruct,
+ "jerasure_rs_vand", &jerasure_rs_vand_args,
+ .skip = false},
// Jerasure RS Cauchy tests
{"simple_encode_jerasureFlat XOR tests_rs_cauchy",
test_simple_encode_decode,
@@ -396,6 +414,10 @@ struct testcase testcases[] = {
test_decode_with_missing_multi_parity,
"jerasure_rs_cauchy", &jerasure_rs_cauchy_args,
.skip = false},
+ {"simple_reconstruct_jerasureFlat XOR tests_rs_cauch",
+ test_simple_reconstruct,
+ "jerasure_rs_cauchy", &jerasure_rs_cauchy_args,
+ .skip = false},
{ NULL, NULL, NULL, NULL, false },
};