8 #include "solverdebug.h"
14 fprintf(ex ? stderr : stdout, "Usage: testsolv <testcase>\n");
19 main(int argc, char **argv)
33 while ((c = getopt(argc, argv, "vrh")) >= 0)
53 for (; optind < argc; optind++)
56 pool_setdebuglevel(pool, debuglevel);
58 fp = fopen(argv[optind], "r");
69 solv = testcase_read(pool, fp, argv[optind], &job, &result, &resultflags);
76 if (!multijob && !feof(fp))
80 printf("test %d:\n", multijob++);
81 if (result || writeresult)
83 char *myresult, *resultdiff;
84 solver_solve(solv, &job);
86 resultflags = TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS;
87 myresult = testcase_solverresult(solv, resultflags);
97 char *p2 = strchr(p, '\n');
98 p2 = p2 ? p2 + 1 : p + strlen(p);
99 printf("#>%.*s", (int)(p2 - p), p);
104 printf("%s", myresult);
109 resultdiff = testcase_resultdiff(result, myresult);
112 printf("Results differ:\n%s", resultdiff);
114 solv_free(resultdiff);
122 if (solver_solve(solv, &job))
124 int problem, solution, pcnt, scnt;
125 pcnt = solver_problem_count(solv);
126 printf("Found %d problems:\n", pcnt);
127 for (problem = 1; problem <= pcnt; problem++)
129 printf("Problem %d:\n", problem);
130 solver_printprobleminfo(solv, problem);
132 scnt = solver_solution_count(solv, problem);
133 for (solution = 1; solution <= scnt; solution++)
135 printf("Solution %d:\n", solution);
136 solver_printsolution(solv, problem, solution);
143 Transaction *trans = solver_create_transaction(solv);
144 printf("Transaction summary:\n\n");
145 transaction_print(trans);
146 transaction_free(trans);