Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argo
excit
Commits
8d70786e
Commit
8d70786e
authored
Jan 10, 2019
by
Brice Videau
Browse files
Finished repeat test.
parent
1f5c380d
Changes
3
Show whitespace changes
Inline
Side-by-side
tests/excit_product.c
View file @
8d70786e
...
...
@@ -76,6 +76,7 @@ void test_next_product_helper(int count, excit_t it, excit_t *its,
indexes1
,
indexes2
,
cindexes2
+
dim
);
}
excit_free
(
cit
);
}
}
...
...
tests/excit_repeat.c
View file @
8d70786e
...
...
@@ -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
;
}
tests/excit_test.c
View file @
8d70786e
...
...
@@ -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
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment