| 1069 | |
| 1070 | |
| 1071 | BOOLEAN kTest_TS(kStrategy strat) |
| 1072 | { |
| 1073 | int i, j; |
| 1074 | // BOOLEAN ret = TRUE; |
| 1075 | kFalseReturn(kTest(strat)); |
| 1076 | |
| 1077 | // test strat->R, strat->T[i].i_r |
| 1078 | for (i=0; i<=strat->tl; i++) |
| 1079 | { |
| 1080 | if (strat->T[i].i_r < 0 || strat->T[i].i_r > strat->tl) |
| 1081 | return dReportError("strat->T[%d].i_r == %d out of bounds", i, |
| 1082 | strat->T[i].i_r); |
| 1083 | if (strat->R[strat->T[i].i_r] != &(strat->T[i])) |
| 1084 | return dReportError("T[%d].i_r with R out of sync", i); |
| 1085 | } |
| 1086 | // test containment of S inT |
| 1087 | if ((strat->S != NULL)&&(strat->tl>=0)) |
| 1088 | { |
| 1089 | for (i=0; i<=strat->sl; i++) |
| 1090 | { |
| 1091 | j = kFindInT(strat->S[i], strat->T, strat->tl); |
| 1092 | if (j < 0) |
| 1093 | return dReportError("S[%d] not in T", i); |
| 1094 | if (strat->S_2_R[i] != strat->T[j].i_r) |
| 1095 | return dReportError("S_2_R[%d]=%d != T[%d].i_r=%d\n", |
| 1096 | i, strat->S_2_R[i], j, strat->T[j].i_r); |
| 1097 | } |
| 1098 | } |
| 1099 | // test strat->L[i].i_r1 |
| 1100 | #ifdef HAVE_SHIFTBBA |
| 1101 | if (!rIsLPRing(currRing)) // in the Letterplace ring we currently don't set/use i_r1 and i_r2 |
| 1102 | #endif |
| 1103 | if (strat->L!=NULL) |
| 1104 | { |
| 1105 | for (i=0; i<=strat->Ll; i++) |
| 1106 | { |
| 1107 | if (strat->L[i].p1 != NULL && strat->L[i].p2) |
| 1108 | { |
| 1109 | if (strat->L[i].i_r1 < 0 || |
| 1110 | strat->L[i].i_r1 > strat->tl || |
| 1111 | strat->L[i].T_1(strat)->p != strat->L[i].p1) |
| 1112 | return dReportError("L[%d].i_r1 out of sync", i); |
| 1113 | if (strat->L[i].i_r2 < 0 || |
| 1114 | strat->L[i].i_r2 > strat->tl || |
| 1115 | strat->L[i].T_2(strat)->p != strat->L[i].p2) |
| 1116 | return dReportError("L[%d].i_r2 out of sync", i); |
| 1117 | } |
| 1118 | else |
| 1119 | { |
| 1120 | if (strat->L[i].i_r1 != -1) |
| 1121 | return dReportError("L[%d].i_r1 out of sync", i); |
| 1122 | if (strat->L[i].i_r2 != -1) |
| 1123 | return dReportError("L[%d].i_r2 out of sync", i); |
| 1124 | } |
| 1125 | if (strat->L[i].i_r != -1) |
| 1126 | return dReportError("L[%d].i_r out of sync", i); |
| 1127 | } |
| 1128 | } |
no test coverage detected