0529df0411
All checks were successful
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m10s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m13s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m21s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m21s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Successful in 1m33s
linux-mips64-gcc / linux-gcc-mips64el (push) Successful in 1m46s
linux-x64-gcc / linux-gcc (push) Successful in 2m4s
22 lines
506 B
C++
22 lines
506 B
C++
|
|
#include <gtest/gtest.h>
|
|
#include <any.h>
|
|
|
|
TEST(any, shared_ptr)
|
|
{
|
|
std::shared_ptr<int> ptr = std::make_shared<int>(1);
|
|
EXPECT_EQ(ptr.use_count(), 1);
|
|
{
|
|
nonstd::any int_any = ptr;
|
|
EXPECT_EQ(ptr.use_count(), 2);
|
|
}
|
|
EXPECT_EQ(ptr.use_count(), 1);
|
|
{
|
|
nonstd::any int_any = ptr;
|
|
EXPECT_EQ(ptr.use_count(), 2);
|
|
std::shared_ptr<int> ptr2 =
|
|
nonstd::any_cast<std::shared_ptr<int>>(int_any);
|
|
EXPECT_EQ(ptr2.use_count(), 3);
|
|
}
|
|
}
|