summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2015-04-09 17:06:55 -0700
committerKevin Greenan <kmg@box.com>2015-04-09 17:08:35 -0700
commitac434453c506732ede554655d5ef30aaf857f402 (patch)
treefde4c5336eb65da273dabf1111b401893ad0ee81 /test
parent1c85fcfca65f6f38a8fdf05ba94c9988e91c52db (diff)
downloadliberasurecode-ac434453c506732ede554655d5ef30aaf857f402.tar.gz
Adding a new HD XOR code for k=3, m=3, hd=3
Also added additional test to test_xor_code to do an exhaustive decode test (all possible 1 and 2 disk failures) and changed teh default liberasurecode test to test (3, 3, 3).
Diffstat (limited to 'test')
-rw-r--r--test/builtin/xor_codes/test_xor_hd_code.c10
-rw-r--r--test/builtin/xor_codes/test_xor_hd_code.h2
-rw-r--r--test/liberasurecode_test.c6
3 files changed, 15 insertions, 3 deletions
diff --git a/test/builtin/xor_codes/test_xor_hd_code.c b/test/builtin/xor_codes/test_xor_hd_code.c
index 497b052..f40621b 100644
--- a/test/builtin/xor_codes/test_xor_hd_code.c
+++ b/test/builtin/xor_codes/test_xor_hd_code.c
@@ -238,6 +238,11 @@ int run_test(int k, int m, int hd)
fprintf(stderr, "Running (%d, %d, %d):\n", k, m, hd);
switch(k+m) {
+ case 6:
+ if (hd == 3) {
+ ret = test_hd_code(code_desc, NUM_6_3_COMBS, failure_combs_6_3);
+ }
+ break;
case 10:
if (hd == 3) {
ret = test_hd_code(code_desc, NUM_10_3_COMBS, failure_combs_10_3);
@@ -348,6 +353,11 @@ int main()
{
int ret = 0;
int i;
+
+ ret = run_test(3, 3, 3);
+ if (ret != 0) {
+ return ret;
+ }
for (i=6; i < 16; i++) {
ret = run_test(i, 6, 3);
diff --git a/test/builtin/xor_codes/test_xor_hd_code.h b/test/builtin/xor_codes/test_xor_hd_code.h
index eb96d05..9a1676f 100644
--- a/test/builtin/xor_codes/test_xor_hd_code.h
+++ b/test/builtin/xor_codes/test_xor_hd_code.h
@@ -22,6 +22,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define NUM_6_3_COMBS 21
+int failure_combs_6_3[NUM_6_3_COMBS][4] = {{0, -1, -1, -1}, {1, -1, -1, -1}, {2, -1, -1, -1}, {3, -1, -1, -1}, {4, -1, -1, -1}, {5, -1, -1, -1}, {0, 1, -1, -1}, {0, 2, -1, -1}, {0, 3, -1, -1}, {0, 4, -1, -1}, {0, 5, -1, -1}, {1, 2, -1, -1}, {1, 3, -1, -1}, {1, 4, -1, -1}, {1, 5, -1, -1}, {2, 3, -1, -1}, {2, 4, -1, -1}, {2, 5, -1, -1}, {3, 4, -1, -1}, {3, 5, -1, -1}, {4, 5, -1, -1}} ;
#define NUM_10_3_COMBS 55
int failure_combs_10_3[NUM_10_3_COMBS][4] = {{0, -1, -1, -1}, {1, -1, -1, -1}, {2, -1, -1, -1}, {3, -1, -1, -1}, {4, -1, -1, -1}, {5, -1, -1, -1}, {6, -1, -1, -1}, {7, -1, -1, -1}, {8, -1, -1, -1}, {9, -1, -1, -1}, {0, 1, -1, -1}, {0, 2, -1, -1}, {0, 3, -1, -1}, {0, 4, -1, -1}, {0, 5, -1, -1}, {0, 6, -1, -1}, {0, 7, -1, -1}, {0, 8, -1, -1}, {0, 9, -1, -1}, {1, 2, -1, -1}, {1, 3, -1, -1}, {1, 4, -1, -1}, {1, 5, -1, -1}, {1, 6, -1, -1}, {1, 7, -1, -1}, {1, 8, -1, -1}, {1, 9, -1, -1}, {2, 3, -1, -1}, {2, 4, -1, -1}, {2, 5, -1, -1}, {2, 6, -1, -1}, {2, 7, -1, -1}, {2, 8, -1, -1}, {2, 9, -1, -1}, {3, 4, -1, -1}, {3, 5, -1, -1}, {3, 6, -1, -1}, {3, 7, -1, -1}, {3, 8, -1, -1}, {3, 9, -1, -1}, {4, 5, -1, -1}, {4, 6, -1, -1}, {4, 7, -1, -1}, {4, 8, -1, -1}, {4, 9, -1, -1}, {5, 6, -1, -1}, {5, 7, -1, -1}, {5, 8, -1, -1}, {5, 9, -1, -1}, {6, 7, -1, -1}, {6, 8, -1, -1}, {6, 9, -1, -1}, {7, 8, -1, -1}, {7, 9, -1, -1}, {8, 9, -1, -1}} ;
#define NUM_10_4_COMBS 175
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index 548d070..6291be5 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -58,9 +58,9 @@ struct ec_args null_args = {
};
struct ec_args flat_xor_hd_args = {
- .k = 10,
- .m = 6,
- .hd = 4,
+ .k = 3,
+ .m = 3,
+ .hd = 3,
.ct = CHKSUM_NONE,
};