17 lines
306 B
C++
17 lines
306 B
C++
|
#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);
|
||
|
}
|