diff --git a/src/tests/util/lazy_list.cpp b/src/tests/util/lazy_list.cpp index 4ddca2087..8ee167302 100644 --- a/src/tests/util/lazy_list.cpp +++ b/src/tests/util/lazy_list.cpp @@ -168,11 +168,33 @@ static void tst4() { list({ 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16 })); } +class gen { + unsigned m_next; +public: + gen():m_next(0) {} + unsigned next() { unsigned r = m_next; m_next++; return r; } +}; + +lazy_list mk_gen(std::shared_ptr const & g) { + return mk_lazy_list([=]() { return some(mk_pair(g->next(), mk_gen(g))); }); +} + +lazy_list mk_gen() { + return mk_gen(std::make_shared()); +} + +void tst5() { + auto l = mk_gen(); + display(take(10, l)); + display(take(10, l)); +} + int main() { save_stack_info(); tst1(); tst2(); tst3(); tst4(); + tst5(); return has_violations() ? 1 : 0; }