void test_stream_filter_dup(void) { stream_t *st; st = stream_filter_dup(stream_range(1, 100, 1), stream_generic_filter_even, NULL); CU_ASSERT(stream_length(st) == 50); return; }
void test_stream_member(void) { stream_t *st; st = stream_range(1, 500000, 1); CU_ASSERT(stream_member(st, (void *)500000) == RET_BOOL_TRUE); return; }
void test_stream_range(void) { stream_t *st; st = stream_range(1, 1000, 1); CU_ASSERT(stream_length(st) == 1000); stream_reset(st); st = stream_range(2, 1000, 2); CU_ASSERT(stream_length(st) == 500); stream_reset(st); st = stream_range(1000, 1, 1); CU_ASSERT(stream_length(st) == 1000); stream_reset(st); return; }
void test_stream_drop(void) { stream_t *st; st = stream_range(1, 1000, 1); st = stream_drop(st, 10); CU_ASSERT(stream_length(st) == 990); return; }
void test_stream_filter(void) { stream_t *st; long count = 0; puts("Testing even filter (0-10):"); st = stream_range(0, 10, 1); while(!stream_empty(st)) { st = stream_filter(st, stream_generic_filter_even, NULL); if(!st) break; printf("\t%p\n", (void *)stream_head(st)); CU_ASSERT((void *)stream_head(st) == (void *)count); count += 2; st = stream_tail(st); } return; }
// -------------------------------------------------------- std::ostream& operator<<(std::ostream& s, const DoubleBoundingBox3D& data) { return stream_range(s, data.begin(), data.end()); }