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
a5974865
Commit
a5974865
authored
Jan 10, 2019
by
Nicolas Denoyelle
Browse files
add test split
parent
dd20ee78
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/excit_tleaf.c
View file @
a5974865
...
@@ -43,6 +43,46 @@ static void tleaf_test_round_robin_policy(excit_t tleaf)
...
@@ -43,6 +43,46 @@ static void tleaf_test_round_robin_policy(excit_t tleaf)
assert
(
excit_next
(
tleaf
,
&
value
)
==
EXCIT_STOPIT
);
assert
(
excit_next
(
tleaf
,
&
value
)
==
EXCIT_STOPIT
);
}
}
static
void
tleaf_test_round_robin_split
(
excit_t
tleaf
,
const
ssize_t
depth
,
const
ssize_t
*
arities
)
{
ssize_t
i
,
value
,
size
,
cut_size
;
ssize_t
ncut
=
arities
[
0
];
assert
(
excit_size
(
tleaf
,
&
size
)
==
EXCIT_SUCCESS
);
cut_size
=
size
/
ncut
;
excit_t
*
split
=
malloc
(
sizeof
(
*
split
)
*
ncut
);
assert
(
split
!=
NULL
);
int
err
=
tleaf_it_split
(
tleaf
,
0
,
ncut
,
split
);
assert
(
err
==
EXCIT_SUCCESS
);
ssize_t
*
cut_sizes
=
malloc
(
sizeof
(
*
cut_sizes
)
*
ncut
);
assert
(
cut_sizes
!=
NULL
);
for
(
i
=
0
;
i
<
ncut
;
i
++
)
{
assert
(
excit_size
(
split
[
i
],
cut_sizes
+
i
)
==
EXCIT_SUCCESS
);
assert
(
cut_sizes
[
i
]
==
cut_size
);
}
for
(
i
=
0
;
i
<
size
;
i
++
)
{
excit_t
it
=
split
[
i
*
ncut
/
size
];
assert
(
excit_next
(
it
,
&
value
)
==
EXCIT_SUCCESS
);
assert
(
value
==
i
);
}
for
(
i
=
0
;
i
<
ncut
;
i
++
)
excit_free
(
split
[
i
]);
free
(
split
);
free
(
cut_sizes
);
}
static
void
tleaf_test_scatter_policy_no_split
(
excit_t
tleaf
,
static
void
tleaf_test_scatter_policy_no_split
(
excit_t
tleaf
,
const
ssize_t
depth
,
const
ssize_t
depth
,
const
ssize_t
*
arities
)
const
ssize_t
*
arities
)
...
@@ -73,6 +113,7 @@ void run_tests(const ssize_t depth, const ssize_t *arities)
...
@@ -73,6 +113,7 @@ void run_tests(const ssize_t depth, const ssize_t *arities)
create_test_tleaf
(
depth
,
arities
,
TLEAF_POLICY_ROUND_ROBIN
,
NULL
);
create_test_tleaf
(
depth
,
arities
,
TLEAF_POLICY_ROUND_ROBIN
,
NULL
);
assert
(
rrobin
!=
NULL
);
assert
(
rrobin
!=
NULL
);
tleaf_test_round_robin_split
(
rrobin
,
depth
,
arities
);
tleaf_test_round_robin_policy
(
rrobin
);
tleaf_test_round_robin_policy
(
rrobin
);
excit_free
(
rrobin
);
excit_free
(
rrobin
);
...
...
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