int main(int argc, char **argv) { test_ins(); test_has(); test_del(); test_seq(); test_union(); test_intersection(); test_diff(); test_subset(); puts("Success"); }
/* * Test sum and difference of triples */ static void test_add_diff(dl_vartable_t *table) { uint32_t i, j, n; dl_triple_t test; dl_triple_t test2; poly_buffer_t buffer; init_poly_buffer(&buffer); q_init(&test.constant); q_init(&test2.constant); n = table->nvars; for (i=0; i<n; i++) { for (j=0; j<n; j++) { printf("Testing sum: var!%"PRIu32" + var!%"PRIu32":\n", i, j); printf("--> var!%"PRIu32" : ", i); print_dl_triple(dl_var_triple(table, i)); printf("\n"); printf("--> var!%"PRIu32" : ", j); print_dl_triple(dl_var_triple(table, j)); printf("\n"); test_sum_buffer(table, &buffer, i, j, &test2); test_sum(table, i, j, &test); printf("\n"); printf("Testing diff: var!%"PRIu32" - var!%"PRIu32":\n", i, j); printf("--> var!%"PRIu32" : ", i); print_dl_triple(dl_var_triple(table, i)); printf("\n"); printf("--> var!%"PRIu32" : ", j); print_dl_triple(dl_var_triple(table, j)); printf("\n"); test_diff_buffer(table, &buffer, i, j, &test2); test_diff(table, i, j, &test); printf("\n"); } } q_clear(&test.constant); q_clear(&test2.constant); delete_poly_buffer(&buffer); }
void Checker::get_request() { char ch; std::cout << "What kind of operation would you like? (S)um, (D)iff, (M)ult" << std::endl; do ch = getchar(); while (ch != 'S' && ch != 'D' && ch != 'M'); std::string s1, s2, s3; std::cout << "Input first number" << std::endl; getline(std::cin, s1); getline(std::cin, s1); std::cout << "Input second number" << std::endl; getline(std::cin, s2); std::cout << "Input result" << std::endl; getline(std::cin, s3); switch (ch) { case 'S': test_sum(BigInteger(s1), BigInteger(s2), BigInteger(s3)); break; case 'D': test_diff(BigInteger(s1), BigInteger(s2), BigInteger(s3)); break; case 'M': test_mult(BigInteger(s1), BigInteger(s2), BigInteger(s3)); break; } }