[iter][test] Add another test for hb_reduce

Different initial and accumulator types
This commit is contained in:
Ebrahim Byagowi 2019-04-02 20:25:06 +04:30 committed by GitHub
parent bfa02bef45
commit afdbf960d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -181,6 +181,12 @@ main (int argc, char **argv)
;
// The result should be something like 0->10, 1->11, ..., 9->19
assert (hb_map_get (result, 9) == 19);
unsigned int temp3 = 0;
+ hb_iter(src)
| hb_map([&] (int i) -> int { return ++temp3; })
| hb_reduce([&] (float acc, int value) -> float { return acc + value + .05; }, 0)
;
hb_map_destroy (result);
+ hb_iter (src)