Skip to content

Commit f28c78b

Browse files
committed
adapt tests to implicit padding (partly revert previous commit)
1 parent fe1ec3a commit f28c78b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tests/test_solve.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ int test_pluq_solve_left(rci_t m, rci_t n, int offsetA, int offsetB) {
5353
return status;
5454
}
5555

56-
int test_solve_left_random(rci_t mA, rci_t nA, rci_t nB, int consistent, int inconsistency_check) {
57-
// check consistency if system is not consistent; otherwise mzd_solve_left is undefined
58-
if(!consistent) inconsistency_check=1;
59-
56+
int test_solve_left_random(rci_t mA, rci_t nA, rci_t nB, int consistent) {
6057
int mB = MAX(mA, nA);
6158
mzd_t *A = mzd_init(mA, nA);
6259
mzd_t *secret = mzd_init(nA, nB);
@@ -81,7 +78,7 @@ int test_solve_left_random(rci_t mA, rci_t nA, rci_t nB, int consistent, int inc
8178
// add rows to B, s.t. X fits into B
8279
if(B->nrows < mB) {
8380
mzd_t *padding = mzd_init(nA-mA, nB);
84-
if(!inconsistency_check)
81+
if(!consistent)
8582
mzd_randomize(padding);
8683
mzd_t *B_padded = mzd_stack(NULL, B, padding);
8784
mzd_free(B);
@@ -95,7 +92,7 @@ int test_solve_left_random(rci_t mA, rci_t nA, rci_t nB, int consistent, int inc
9592
assert(B->nrows == mB);
9693
assert(B->ncols == nB);
9794

98-
int consistency = !mzd_solve_left(A, B, 0, inconsistency_check);
95+
int consistency = !mzd_solve_left(A, B, 0, 1);
9996

10097
if (consistent && !consistency) {
10198
printf("failed (solution should have been found)\n");
@@ -132,16 +129,19 @@ int main() {
132129

133130
srandom(17);
134131

135-
for(int consistent = 0; consistent <= 1; consistent++) {
136-
for(int inconsistency_check = 0; inconsistency_check <= 1; inconsistency_check++) {
137-
status += test_solve_left_random(1100, 1000, 1000, consistent, inconsistency_check);
138-
status += test_solve_left_random(1000, 1000, 1000, consistent, inconsistency_check);
139-
status += test_solve_left_random(1100, 1100, 1000, consistent, inconsistency_check);
140-
status += test_solve_left_random(1000, 1000, 1100, consistent, inconsistency_check);
141-
status += test_solve_left_random(1100, 1000, 1100, consistent, inconsistency_check);
142-
status += test_solve_left_random(1000, 1100, 1000, consistent, inconsistency_check);
143-
}
144-
}
132+
status += test_solve_left_random(1100, 1000, 1000, 1);
133+
status += test_solve_left_random(1000, 1000, 1000, 1);
134+
status += test_solve_left_random(1100, 1100, 1000, 1);
135+
status += test_solve_left_random(1000, 1000, 1100, 1);
136+
status += test_solve_left_random(1100, 1000, 1100, 1);
137+
status += test_solve_left_random(1000, 1100, 1000, 1);
138+
139+
status += test_solve_left_random(1100, 1000, 1000, 0);
140+
status += test_solve_left_random(1000, 1000, 1000, 0);
141+
status += test_solve_left_random(1100, 1100, 1000, 0);
142+
status += test_solve_left_random(1000, 1000, 1100, 0);
143+
status += test_solve_left_random(1100, 1000, 1100, 0);
144+
status += test_solve_left_random(1000, 1100, 1000, 0);
145145

146146

147147
for (size_t i = 0; i < 100; i++) {

0 commit comments

Comments
 (0)