int main(int argc, char **argv) { test_ins(); test_has(); test_del(); test_seq(); test_union(); test_intersection(); test_diff(); test_subset(); puts("Success"); }
int main(int argc, char** argv) { unsigned int ns[] = {1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456}; unsigned int ps[] = {1, 2, 4, 8, 16, 32, 38, 56}; for(unsigned int i = 0; i < 9; i++) { test_seq(ns[i]); for(unsigned int j = 0; j < 8; j++) { test_par(ns[i], ps[j]); } } return (EXIT_SUCCESS); }
std::vector<size_t> find_pds(size_t p) { std::vector<size_t> result; for (size_t a = 0; a < p; ++a) { for (size_t b = 0; b < p; ++b) { if (b == 0 && a == 0) continue; for (size_t c = 1; c < p; ++c) { if (test_seq(a,b,c,p,result)) { return result; } } } } return result; }
// Find maximum adjacency count of a sequence where one value must be inverted // Algorithm : iterate over complete sequence, invert value at iterator and run FindMaximumAdjacencyCount() over created sequence int FindMaximumAdjacencyCountWithOneElementInvertedSimple(const tIntVec& inSeq) { tIntVec test_seq(inSeq); int max_seq(0); for (auto s_it(test_seq.begin()); s_it != test_seq.end(); ++s_it) { // Invert one item int val(*s_it); *s_it = (val == 0) ? 1 : 0; max_seq = std::max(max_seq, FindMaximumAdjacencyCount(test_seq)); *s_it = val; } return max_seq; }
int main(int argc, char **argv) { OM_uint32 maj_stat; int i, failed = 0; for (i = 0; i < sizeof(pl)/sizeof(pl[0]); i++) { maj_stat = test_seq(i, pl[i].flags, pl[i].start_seq, pl[i].pattern, pl[i].pattern_len); if (maj_stat != pl[i].error_code) { printf("test pattern %d failed with %d (should have been %d)\n", i, maj_stat, pl[i].error_code); failed++; } } if (failed) printf("FAILED %d tests\n", failed); return failed != 0; }