ulib/tests/3party/nonstd/lazy_unittest.cpp

17 lines
306 B
C++
Raw Normal View History

2024-01-26 11:22:30 +08:00
#include <gtest/gtest.h>
#include <lazy.h>
TEST(Lazy, Base)
{
bool flag = false;
int cnt = 0;
auto lazy = ulib::Lazy<int>([&]() {
flag = true;
++cnt;
return std::make_tuple(cnt);
});
EXPECT_EQ(flag, false);
EXPECT_EQ(*lazy, 1);
EXPECT_EQ(flag, true);
}