GitLab maintenance scheduled for Today, 2019-04-24, from 12:00 to 13:00 CDT - Services will be unavailable during this time.

Commit 8d70786e authored by Brice Videau's avatar Brice Videau

Finished repeat test.

parent 1f5c380d
......@@ -76,6 +76,7 @@ void test_next_product_helper(int count, excit_t it, excit_t *its,
indexes1, indexes2,
cindexes2 + dim);
}
excit_free(cit);
}
}
......
......@@ -71,12 +71,45 @@ void test_next_repeat(int repeat, excit_t sit)
excit_free(new_sit);
}
void test_repeat_split(int repeat, excit_t sit)
{
excit_t new_sits[3], new_its[3];
excit_t it = create_test_repeat(repeat, sit);
ssize_t *indexes1, *indexes2;
ssize_t dim;
assert(excit_dimension(it, &dim) == ES);
indexes1 = (ssize_t *)malloc(dim * sizeof(ssize_t));
indexes2 = (ssize_t *)malloc(dim * sizeof(ssize_t));
assert( excit_split(sit, 3, new_sits) == ES );
assert( excit_repeat_split(it, 3, new_its) == ES );
for (int i = 0; i < 3; i++) {
while (excit_next(new_sits[i], indexes1) == ES) {
for (int j = 0; j < repeat; j++) {
assert(excit_next(new_its[i], indexes2) == ES);
assert(memcmp(indexes1, indexes2, dim * sizeof(ssize_t)) == 0);
}
}
assert(excit_next(new_its[i], indexes2) == EXCIT_STOPIT);
excit_free(new_sits[i]);
excit_free(new_its[i]);
}
free(indexes1);
free(indexes2);
excit_free(it);
}
void test_repeat_iterator(int repeat, excit_t sit)
{
test_alloc_init_repeat(repeat, sit);
test_next_repeat(repeat, sit);
test_repeat_split(repeat, sit);
int i = 0;
while (synthetic_tests[i]) {
excit_t it = create_test_repeat(repeat, sit);
......@@ -90,9 +123,20 @@ void test_repeat_iterator(int repeat, excit_t sit)
int main(int argc, char *argv[])
{
excit_t it;
excit_t it1, it2, it3;
it1 = create_test_range(0, 3, 1);
test_repeat_iterator(3, it1);
it2 = create_test_range(-15, 14, 2);
test_repeat_iterator(3, it2);
it3 = excit_alloc_test(EXCIT_PRODUCT);
assert(excit_product_add_copy(it3, it1) == ES);
assert(excit_product_add_copy(it3, it2) == ES);
test_repeat_iterator(4, it3);
it = create_test_range(0, 3, 1);
test_repeat_iterator(3, it);
excit_free(it1);
excit_free(it2);
excit_free(it3);
return 0;
}
......@@ -277,11 +277,9 @@ void test_split(excit_t it) {
indexes2 = (ssize_t *)malloc(buff_dim);
assert(excit_split(it, num_split, its) == ES);
fprintf(stderr, "-----------------\n");
for(int i = 0; i < num_split; i++) {
while(excit_next(its[i], indexes2) == ES) {
assert(excit_next(it, indexes1) == ES);
fprintf(stderr, "%ld %ld\n", indexes1[0], indexes2[0]);
assert(memcmp(indexes1, indexes2, buff_dim) == 0);
}
excit_free(its[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment