Modernization + AZStd::function compare fix. (#3680)

* Modernization + small fix.

Modernize ( `bool`/`override`/other) code in AzCore, AzFramework, AzQtComponents, AzToolsFramework, etc.
Replaced a `bind` or two, use `using` in a few places as well.

Fix nullptr comparison of AZStd::function.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Apply review-based changes

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
Artur K
2021-09-02 21:55:09 +02:00
committed by GitHub
parent b3c8b0f5f3
commit 567c0ae24d
150 changed files with 865 additions and 847 deletions
@@ -41,12 +41,12 @@ namespace UnitTest
AZ_TEST_ASSERT(strcmp(myalloc.get_name(), newName) == 0);
AZStd::allocator::pointer_type data = myalloc.allocate(100, 1);
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
myalloc.deallocate(data, 100, 1);
data = myalloc.allocate(50, 128);
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
myalloc.deallocate(data, 50, 128);
@@ -153,7 +153,7 @@ namespace UnitTest
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
buffer_alloc_type::pointer_type data = myalloc.allocate(100, 1);
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100);
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100);
@@ -172,7 +172,7 @@ namespace UnitTest
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
data = myalloc.allocate(50, 64);
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50);
AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50);
@@ -198,7 +198,7 @@ namespace UnitTest
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
int* data = reinterpret_cast<int*>(myalloc.allocate(sizeof(int), 1));
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - 1) * sizeof(int));
AZ_TEST_ASSERT(myalloc.get_allocated_size() == sizeof(int));
@@ -209,7 +209,7 @@ namespace UnitTest
for (int i = 0; i < numNodes; ++i)
{
data = reinterpret_cast<int*>(myalloc.allocate(sizeof(int), 1));
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - (i + 1)) * sizeof(int));
AZ_TEST_ASSERT(myalloc.get_allocated_size() == (i + 1) * sizeof(int));
}
@@ -231,7 +231,7 @@ namespace UnitTest
aligned_int_node_pool_type myaligned_pool;
aligned_int_type* aligned_data = reinterpret_cast<aligned_int_type*>(myaligned_pool.allocate(sizeof(aligned_int_type), dataAlignment));
AZ_TEST_ASSERT(aligned_data != 0);
AZ_TEST_ASSERT(aligned_data != nullptr);
AZ_TEST_ASSERT(((AZStd::size_t)aligned_data & (dataAlignment - 1)) == 0);
AZ_TEST_ASSERT(myaligned_pool.get_max_size() == (numNodes - 1) * sizeof(aligned_int_type));
AZ_TEST_ASSERT(myaligned_pool.get_allocated_size() == sizeof(aligned_int_type));
@@ -267,14 +267,14 @@ namespace UnitTest
AZ_TEST_ASSERT(ref_allocator2.get_allocator() == ref_allocator1.get_allocator());
ref_allocator_type::pointer_type data1 = ref_allocator1.allocate(10, 1);
AZ_TEST_ASSERT(data1 != 0);
AZ_TEST_ASSERT(data1 != nullptr);
AZ_TEST_ASSERT(ref_allocator1.get_max_size() == bufferSize - 10);
AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() == 10);
AZ_TEST_ASSERT(shared_allocator.get_max_size() == bufferSize - 10);
AZ_TEST_ASSERT(shared_allocator.get_allocated_size() == 10);
ref_allocator_type::pointer_type data2 = ref_allocator2.allocate(10, 1);
AZ_TEST_ASSERT(data2 != 0);
AZ_TEST_ASSERT(data2 != nullptr);
AZ_TEST_ASSERT(ref_allocator2.get_max_size() <= bufferSize - 20);
AZ_TEST_ASSERT(ref_allocator2.get_allocated_size() >= 20);
AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20);
@@ -283,14 +283,14 @@ namespace UnitTest
shared_allocator.reset();
data1 = ref_allocator1.allocate(10, 32);
AZ_TEST_ASSERT(data1 != 0);
AZ_TEST_ASSERT(data1 != nullptr);
AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 10);
AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 10);
AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 10);
AZ_TEST_ASSERT(shared_allocator.get_allocated_size() >= 10);
data2 = ref_allocator2.allocate(10, 32);
AZ_TEST_ASSERT(data2 != 0);
AZ_TEST_ASSERT(data2 != nullptr);
AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 20);
AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 20);
AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20);
@@ -316,7 +316,7 @@ namespace UnitTest
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
stack_allocator::pointer_type data = myalloc.allocate(100, 1);
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100);
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100);
@@ -329,7 +329,7 @@ namespace UnitTest
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
data = myalloc.allocate(50, 64);
AZ_TEST_ASSERT(data != 0);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50);
AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50);
@@ -975,13 +975,13 @@ namespace UnitTest
A obj(T(0));
bool b0 = obj.is_lock_free();
((void)b0); // mark as unused
EXPECT_TRUE(obj == T(0));
EXPECT_TRUE(obj == T(nullptr));
AZStd::atomic_init(&obj, T(1));
EXPECT_TRUE(obj == T(1));
AZStd::atomic_init(&obj, T(2));
EXPECT_TRUE(obj == T(2));
obj.store(T(0));
EXPECT_TRUE(obj == T(0));
EXPECT_TRUE(obj == T(nullptr));
obj.store(T(1), AZStd::memory_order_release);
EXPECT_TRUE(obj == T(1));
EXPECT_TRUE(obj.load() == T(1));
@@ -1001,11 +1001,11 @@ namespace UnitTest
EXPECT_TRUE(obj.compare_exchange_strong(x, T(1)) == true);
EXPECT_TRUE(obj == T(1));
EXPECT_TRUE(x == T(2));
EXPECT_TRUE(obj.compare_exchange_strong(x, T(0)) == false);
EXPECT_TRUE(obj.compare_exchange_strong(x, T(nullptr)) == false);
EXPECT_TRUE(obj == T(1));
EXPECT_TRUE(x == T(1));
EXPECT_TRUE((obj = T(0)) == T(0));
EXPECT_TRUE(obj == T(0));
EXPECT_TRUE((obj = T(nullptr)) == T(nullptr));
EXPECT_TRUE(obj == T(nullptr));
obj = T(2 * sizeof(X));
EXPECT_TRUE((obj += AZStd::ptrdiff_t(3)) == T(5 * sizeof(X)));
EXPECT_TRUE(obj == T(5 * sizeof(X)));
@@ -1015,7 +1015,7 @@ namespace UnitTest
{
alignas(A) char storage[sizeof(A)] = { 23 };
A& zero = *new (storage) A();
EXPECT_TRUE(zero == T(0));
EXPECT_TRUE(zero == T(nullptr));
zero.~A();
}
}
+2 -2
View File
@@ -127,7 +127,7 @@ namespace UnitTest
AZStd::bitset<32> m_bitset1;
AZStd::bitset<32> m_bitset2;
};
TEST_P(BitsetUnsignedLongPairTests, BitwiseANDOperator_MatchesUnsignedLongAND)
{
EXPECT_EQ((m_bitset1 & m_bitset2).to_ulong(), m_unsignedLong1 & m_unsignedLong2);
@@ -316,7 +316,7 @@ namespace UnitTest
{
for (unsigned long value2 : testCases)
{
testCasePairs.push_back(AZStd::pair<unsigned long, unsigned long>(value1, value2));
testCasePairs.emplace_back(value1, value2);
}
}
return testCasePairs;
@@ -219,7 +219,7 @@ class OtherClass
double rubbish; // to ensure this class has non-zero size.
public:
virtual ~OtherClass() {}
virtual void UnusedVirtualFunction(void) { (void)rubbish; }
virtual void UnusedVirtualFunction() { (void)rubbish; }
virtual void TrickyVirtualFunction(int num, char* str) = 0;
};
@@ -268,7 +268,7 @@ namespace UnitTest
// Assignment to an empty function
v1 = five;
AZ_TEST_ASSERT(v1 != 0);
AZ_TEST_ASSERT(v1 != nullptr);
// Invocation of a function
global_int = 0;
@@ -277,7 +277,7 @@ namespace UnitTest
// clear() method
v1.clear();
AZ_TEST_ASSERT(v1 == 0);
AZ_TEST_ASSERT(v1 == nullptr);
// Assignment to an empty function
v1 = three;
@@ -303,12 +303,12 @@ namespace UnitTest
AZ_TEST_ASSERT(global_int == 5);
// clear
v1 = 0;
AZ_TEST_ASSERT(0 == v1);
v1 = nullptr;
AZ_TEST_ASSERT(nullptr == v1);
// Assignment to an empty function from a free function
v1 = AZSTD_FUNCTION_TARGET_FIX(&) write_five;
AZ_TEST_ASSERT(0 != v1);
AZ_TEST_ASSERT(nullptr != v1);
// Invocation
global_int = 0;
@@ -697,9 +697,9 @@ namespace UnitTest
AZ_TEST_ASSERT(global_int == 2);
// Test construction from 0 and comparison to 0
func_void_type v9(0);
AZ_TEST_ASSERT(v9 == 0);
AZ_TEST_ASSERT(0 == v9);
func_void_type v9(nullptr);
AZ_TEST_ASSERT(v9 == nullptr);
AZ_TEST_ASSERT(nullptr == v9);
// Test return values
typedef function<int ()> func_int_type;
@@ -941,7 +941,7 @@ namespace UnitTest
TEST_F(Function, FunctionWithNonAZStdAllocatorDestructsSuccessfully)
{
// 64 Byte buffer is used to prevent AZStd::function for storing the
// 64 Byte buffer is used to prevent AZStd::function for storing the
// lambda internal storage using the small buffer optimization
// Therefore causing the supplied allocator to be used
[[maybe_unused]] AZStd::aligned_storage_t<64, 1> bufferToAvoidSmallBufferOptimization;
@@ -994,7 +994,7 @@ namespace UnitTest
return static_cast<double>(lhs) + rhs;
}
// Make sure the functor have a specific size so
// Make sure the functor have a specific size so
// that it can be used to test both the AZStd::function small_object_optimization path
// and the heap allocated function object path
AZStd::aligned_storage_t<FunctorSize, 1> m_functorPadding;
@@ -1044,7 +1044,7 @@ namespace UnitTest
TestFunctor testFunctor;
AZStd::function<double(int, double)> testFunction2(AZStd::move(testFunctor));
EXPECT_GT(s_functorMoveConstructorCount, 0);
double testFunc2Result = testFunction2(16, 4.0);
EXPECT_DOUBLE_EQ(20, testFunc2Result);
@@ -1068,7 +1068,7 @@ namespace UnitTest
AZStd::function<double(int, double)> testFunction2;
testFunction2 = AZStd::move(testFunctor);
EXPECT_GT(s_functorMoveConstructorCount + s_functorMoveAssignmentCount, 0);
double testFunc2Result = testFunction2(16, 4.0);
EXPECT_DOUBLE_EQ(20, testFunc2Result);
@@ -1643,7 +1643,7 @@ namespace UnitTest
AZStd::reference_wrapper<uint64_t> refTimeStamp(timeStamp);
double result = nestedFunc(32, refTimeStamp, 64.0);
EXPECT_EQ(512, timeStamp);
constexpr double expectedResult = static_cast<double>(32 + 16 + 128.0 + 512);
EXPECT_DOUBLE_EQ(expectedResult, result);
}
+15 -15
View File
@@ -195,7 +195,7 @@ namespace UnitTest
void test_thread_id_for_running_thread_is_not_default_constructed_id()
{
const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : nullptr;
AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc);
AZ_TEST_ASSERT(t.get_id() != AZStd::thread::id());
t.join();
@@ -203,8 +203,8 @@ namespace UnitTest
void test_different_threads_have_different_ids()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr;
AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1);
AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2);
AZ_TEST_ASSERT(t.get_id() != t2.get_id());
@@ -214,9 +214,9 @@ namespace UnitTest
void test_thread_ids_have_a_total_order()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0;
const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr;
const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : nullptr;
AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1);
AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2);
@@ -313,7 +313,7 @@ namespace UnitTest
void test_thread_id_of_running_thread_returned_by_this_thread_get_id()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
AZStd::thread::id id;
AZStd::thread t(AZStd::bind(&Parallel_Thread::get_thread_id, this, &id), desc1);
@@ -366,7 +366,7 @@ namespace UnitTest
void test_move_on_construction()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
AZStd::thread::id the_id;
AZStd::thread x;
x = AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, &the_id), desc1);
@@ -377,7 +377,7 @@ namespace UnitTest
AZStd::thread make_thread(AZStd::thread::id* the_id)
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
return AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, the_id), desc1);
}
@@ -430,7 +430,7 @@ namespace UnitTest
void do_test_creation()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
m_data = 0;
AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1);
t.join();
@@ -445,7 +445,7 @@ namespace UnitTest
void do_test_id_comparison()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
AZStd::thread::id self = this_thread::get_id();
AZStd::thread thrd(AZStd::bind(&Parallel_Thread::comparison_thread, this, self), desc1);
thrd.join();
@@ -476,7 +476,7 @@ namespace UnitTest
void do_test_creation_through_reference_wrapper()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
non_copyable_functor f;
AZStd::thread thrd(AZStd::ref(f), desc1);
@@ -491,8 +491,8 @@ namespace UnitTest
void test_swap()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr;
AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1);
AZStd::thread t2(AZStd::bind(&Parallel_Thread::simple_thread, this), desc2);
AZStd::thread::id id1 = t.get_id();
@@ -512,7 +512,7 @@ namespace UnitTest
void run()
{
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0;
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
// We need to have at least one processor
AZ_TEST_ASSERT(AZStd::thread::hardware_concurrency() >= 1);
+119 -119
View File
@@ -137,7 +137,7 @@ namespace UnitTest
static void deleter(int* p)
{
EXPECT_TRUE(p == 0);
EXPECT_TRUE(p == nullptr);
}
struct deleter2
@@ -158,7 +158,7 @@ namespace UnitTest
{
void operator()(incomplete* p)
{
EXPECT_TRUE(p == 0);
EXPECT_TRUE(p == nullptr);
}
};
@@ -331,7 +331,7 @@ namespace UnitTest
AZStd::shared_ptr<void> pv;
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_EQ(0, pv.get());
EXPECT_EQ(nullptr, pv.get());
EXPECT_EQ(0, pv.use_count());
}
@@ -355,35 +355,35 @@ namespace UnitTest
TEST_F(SmartPtr, SharedPtrCtorIntPtr)
{
m_sharedPtr->TestType(static_cast<int*>(0));
m_sharedPtr->TestType(static_cast<int const*>(0));
m_sharedPtr->TestType(static_cast<int volatile*>(0));
m_sharedPtr->TestType(static_cast<int const volatile*>(0));
m_sharedPtr->TestType(static_cast<int*>(nullptr));
m_sharedPtr->TestType(static_cast<int const*>(nullptr));
m_sharedPtr->TestType(static_cast<int volatile*>(nullptr));
m_sharedPtr->TestType(static_cast<int const volatile*>(nullptr));
}
TEST_F(SmartPtr, SharedPtrCtorConstIntPtr)
{
m_sharedPtr->TestNull<int const>(static_cast<int*>(0));
m_sharedPtr->TestNull<int volatile>(static_cast<int*>(0));
m_sharedPtr->TestNull<void>(static_cast<int*>(0));
m_sharedPtr->TestNull<void const>(static_cast<int*>(0));
m_sharedPtr->TestNull<int const>(static_cast<int*>(nullptr));
m_sharedPtr->TestNull<int volatile>(static_cast<int*>(nullptr));
m_sharedPtr->TestNull<void>(static_cast<int*>(nullptr));
m_sharedPtr->TestNull<void const>(static_cast<int*>(nullptr));
}
TEST_F(SmartPtr, SharedPtrCtorX)
{
m_sharedPtr->TestType(static_cast<SharedPtr::test::X*>(0));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X const*>(0));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X volatile*>(0));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X const volatile*>(0));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X*>(nullptr));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X const*>(nullptr));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X volatile*>(nullptr));
m_sharedPtr->TestType(static_cast<SharedPtr::test::X const volatile*>(nullptr));
}
TEST_F(SmartPtr, SharedPtrCtorXConvert)
{
m_sharedPtr->TestNull<SharedPtr::test::X const>(static_cast<SharedPtr::test::X*>(0));
m_sharedPtr->TestNull<SharedPtr::test::X>(static_cast<SharedPtr::test::Y*>(0));
m_sharedPtr->TestNull<SharedPtr::test::X const>(static_cast<SharedPtr::test::Y*>(0));
m_sharedPtr->TestNull<void>(static_cast<SharedPtr::test::X*>(0));
m_sharedPtr->TestNull<void const>(static_cast<SharedPtr::test::X*>(0));
m_sharedPtr->TestNull<SharedPtr::test::X const>(static_cast<SharedPtr::test::X*>(nullptr));
m_sharedPtr->TestNull<SharedPtr::test::X>(static_cast<SharedPtr::test::Y*>(nullptr));
m_sharedPtr->TestNull<SharedPtr::test::X const>(static_cast<SharedPtr::test::Y*>(nullptr));
m_sharedPtr->TestNull<void>(static_cast<SharedPtr::test::X*>(nullptr));
m_sharedPtr->TestNull<void const>(static_cast<SharedPtr::test::X*>(nullptr));
}
TEST_F(SmartPtr, SharedPtrCtorIntValue)
@@ -518,15 +518,15 @@ namespace UnitTest
TEST_F(SmartPtr, SharedPtrCtorNullDeleter)
{
{
AZStd::shared_ptr<int> pi(static_cast<int*>(0), &SharedPtr::test::deleter);
AZStd::shared_ptr<int> pi(static_cast<int*>(nullptr), &SharedPtr::test::deleter);
m_sharedPtr->TestPtr<int, int>(pi, nullptr);
}
{
AZStd::shared_ptr<void> pv(static_cast<int*>(0), &SharedPtr::test::deleter);
AZStd::shared_ptr<void> pv(static_cast<int*>(nullptr), &SharedPtr::test::deleter);
m_sharedPtr->TestPtr<void, int>(pv, nullptr);
}
{
AZStd::shared_ptr<void const> pv(static_cast<int*>(0), &SharedPtr::test::deleter);
AZStd::shared_ptr<void const> pv(static_cast<int*>(nullptr), &SharedPtr::test::deleter);
m_sharedPtr->TestPtr<void const, int>(pv, nullptr);
}
}
@@ -589,21 +589,21 @@ namespace UnitTest
EXPECT_EQ(pi2, pi);
EXPECT_FALSE(pi2);
EXPECT_TRUE(!pi2);
EXPECT_EQ(0, pi2.get());
EXPECT_EQ(nullptr, pi2.get());
EXPECT_EQ(pi2.use_count(), pi.use_count());
AZStd::shared_ptr<void> pi3(pi);
EXPECT_EQ(pi3, pi);
EXPECT_FALSE(pi3);
EXPECT_TRUE(!pi3);
EXPECT_EQ(0, pi3.get());
EXPECT_EQ(nullptr, pi3.get());
EXPECT_EQ(pi3.use_count(), pi.use_count());
AZStd::shared_ptr<void> pi4(pi3);
EXPECT_EQ(pi4, pi3);
EXPECT_FALSE(pi4);
EXPECT_TRUE(!pi4);
EXPECT_EQ(0, pi4.get());
EXPECT_EQ(nullptr, pi4.get());
EXPECT_EQ(pi4.use_count(), pi3.use_count());
}
@@ -615,7 +615,7 @@ namespace UnitTest
EXPECT_EQ(pv2, pv);
EXPECT_FALSE(pv2);
EXPECT_TRUE(!pv2);
EXPECT_EQ(0, pv2.get());
EXPECT_EQ(nullptr, pv2.get());
EXPECT_EQ(pv2.use_count(), pv.use_count());
}
@@ -628,26 +628,26 @@ namespace UnitTest
EXPECT_EQ(px, px2);
EXPECT_FALSE(px2);
EXPECT_TRUE(!px2);
EXPECT_EQ(0, px2.get());
EXPECT_EQ(nullptr, px2.get());
EXPECT_EQ(px.use_count(), px2.use_count());
AZStd::shared_ptr<void> px3(px);
EXPECT_EQ(px, px3);
EXPECT_FALSE(px3);
EXPECT_TRUE(!px3);
EXPECT_EQ(0, px3.get());
EXPECT_EQ(nullptr, px3.get());
EXPECT_EQ(px.use_count(), px3.use_count());
}
TEST_F(SmartPtr, SharedPtrCopyCtorIntVoidSharedOwnershipTest)
{
AZStd::shared_ptr<int> pi(static_cast<int*>(0));
AZStd::shared_ptr<int> pi(static_cast<int*>(nullptr));
AZStd::shared_ptr<int> pi2(pi);
EXPECT_EQ(pi, pi2);
EXPECT_FALSE(pi2);
EXPECT_TRUE(!pi2);
EXPECT_EQ(0, pi2.get());
EXPECT_EQ(nullptr, pi2.get());
EXPECT_EQ(2, pi2.use_count());
EXPECT_FALSE(pi2.unique());
EXPECT_EQ(pi.use_count(), pi2.use_count());
@@ -657,7 +657,7 @@ namespace UnitTest
EXPECT_EQ(pi, pi3);
EXPECT_FALSE(pi3);
EXPECT_TRUE(!pi3);
EXPECT_EQ(0, pi3.get());
EXPECT_EQ(nullptr, pi3.get());
EXPECT_EQ(3, pi3.use_count());
EXPECT_FALSE(pi3.unique());
EXPECT_EQ(pi.use_count(), pi3.use_count());
@@ -667,7 +667,7 @@ namespace UnitTest
EXPECT_EQ(pi2, pi4);
EXPECT_FALSE(pi4);
EXPECT_TRUE(!pi4);
EXPECT_EQ(0, pi4.get());
EXPECT_EQ(nullptr, pi4.get());
EXPECT_EQ(4, pi4.use_count());
EXPECT_FALSE(pi4.unique());
EXPECT_EQ(pi2.use_count(), pi4.use_count());
@@ -680,13 +680,13 @@ namespace UnitTest
TEST_F(SmartPtr, SharedPtrCopyCtorClassSharedOwnershipTest)
{
using X = SharedPtr::test::X;
AZStd::shared_ptr<X> px(static_cast<X*>(0));
AZStd::shared_ptr<X> px(static_cast<X*>(nullptr));
AZStd::shared_ptr<X> px2(px);
EXPECT_EQ(px, px2);
EXPECT_FALSE(px2);
EXPECT_TRUE(!px2);
EXPECT_EQ(0, px2.get());
EXPECT_EQ(nullptr, px2.get());
EXPECT_EQ(2, px2.use_count());
EXPECT_FALSE(px2.unique());
EXPECT_EQ(px.use_count(), px2.use_count());
@@ -696,7 +696,7 @@ namespace UnitTest
EXPECT_EQ(px, px3);
EXPECT_FALSE(px3);
EXPECT_TRUE(!px3);
EXPECT_EQ(0, px3.get());
EXPECT_EQ(nullptr, px3.get());
EXPECT_EQ(3, px3.use_count());
EXPECT_FALSE(px3.unique());
EXPECT_EQ(px.use_count(), px3.use_count());
@@ -706,7 +706,7 @@ namespace UnitTest
EXPECT_EQ(px2, px4);
EXPECT_FALSE(px4);
EXPECT_TRUE(!px4);
EXPECT_EQ(0, px4.get());
EXPECT_EQ(nullptr, px4.get());
EXPECT_EQ(4, px4.use_count());
EXPECT_FALSE(px4.unique());
EXPECT_EQ(px2.use_count(), px4.use_count());
@@ -871,11 +871,11 @@ namespace UnitTest
{
AZStd::shared_ptr<Y> p2(wp);
EXPECT_EQ(wp.use_count(), p2.use_count());
EXPECT_EQ(0, p2.get());
EXPECT_EQ(nullptr, p2.get());
AZStd::shared_ptr<X> p3(wp);
EXPECT_EQ(wp.use_count(), p3.use_count());
EXPECT_EQ(0, p3.get());
EXPECT_EQ(nullptr, p3.get());
}
}
@@ -927,7 +927,7 @@ namespace UnitTest
EXPECT_EQ(p1, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<incomplete> p2;
@@ -936,7 +936,7 @@ namespace UnitTest
EXPECT_EQ(p2, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<incomplete> p3(p1);
@@ -945,7 +945,7 @@ namespace UnitTest
EXPECT_EQ(p3, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
}
TEST_F(SmartPtr, SharedPtrCopyAssignVoid)
@@ -959,7 +959,7 @@ namespace UnitTest
EXPECT_EQ(p1, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<void> p2;
@@ -968,7 +968,7 @@ namespace UnitTest
EXPECT_EQ(p2, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<void> p3(p1);
@@ -977,7 +977,7 @@ namespace UnitTest
EXPECT_EQ(p3, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<void> p4(new int);
EXPECT_EQ(1, p4.use_count());
@@ -1007,7 +1007,7 @@ namespace UnitTest
EXPECT_EQ(p1, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<X> p2;
@@ -1016,7 +1016,7 @@ namespace UnitTest
EXPECT_EQ(p2, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<X> p3(p1);
@@ -1025,7 +1025,7 @@ namespace UnitTest
EXPECT_EQ(p3, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1065,7 +1065,7 @@ namespace UnitTest
EXPECT_EQ(p2, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
AZStd::shared_ptr<int> p4(new int);
EXPECT_EQ(1, p4.use_count());
@@ -1098,7 +1098,7 @@ namespace UnitTest
EXPECT_EQ(p2, p1);
EXPECT_FALSE(p1);
EXPECT_TRUE(!p1);
EXPECT_EQ(0, p1.get());
EXPECT_EQ(nullptr, p1.get());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
EXPECT_EQ(0, m_sharedPtr->m_test.m_yInstances);
@@ -1144,17 +1144,17 @@ namespace UnitTest
pi.reset();
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 0);
}
TEST_F(SmartPtr, SharedPtrResetNullInt)
{
AZStd::shared_ptr<int> pi(static_cast<int*>(0));
AZStd::shared_ptr<int> pi(static_cast<int*>(nullptr));
pi.reset();
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 0);
}
@@ -1164,7 +1164,7 @@ namespace UnitTest
pi.reset();
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 0);
}
@@ -1175,7 +1175,7 @@ namespace UnitTest
px.reset();
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 0);
}
@@ -1187,7 +1187,7 @@ namespace UnitTest
px.reset();
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 0);
}
@@ -1198,7 +1198,7 @@ namespace UnitTest
px.reset();
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 0);
}
@@ -1211,7 +1211,7 @@ namespace UnitTest
px.reset();
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 0);
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
}
@@ -1222,7 +1222,7 @@ namespace UnitTest
pv.reset();
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 0);
}
@@ -1235,7 +1235,7 @@ namespace UnitTest
pv.reset();
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 0);
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
}
@@ -1244,10 +1244,10 @@ namespace UnitTest
{
AZStd::shared_ptr<int> pi;
pi.reset(static_cast<int*>(0));
pi.reset(static_cast<int*>(nullptr));
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 1);
EXPECT_TRUE(pi.unique());
@@ -1259,10 +1259,10 @@ namespace UnitTest
EXPECT_TRUE(pi.use_count() == 1);
EXPECT_TRUE(pi.unique());
pi.reset(static_cast<int*>(0));
pi.reset(static_cast<int*>(nullptr));
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 1);
EXPECT_TRUE(pi.unique());
}
@@ -1273,10 +1273,10 @@ namespace UnitTest
using Y = SharedPtr::test::Y;
AZStd::shared_ptr<X> px;
px.reset(static_cast<X*>(0));
px.reset(static_cast<X*>(nullptr));
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1290,10 +1290,10 @@ namespace UnitTest
EXPECT_TRUE(px.unique());
EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances);
px.reset(static_cast<X*>(0));
px.reset(static_cast<X*>(nullptr));
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1309,10 +1309,10 @@ namespace UnitTest
EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances);
EXPECT_EQ(1, m_sharedPtr->m_test.m_yInstances);
px.reset(static_cast<Y*>(0));
px.reset(static_cast<Y*>(nullptr));
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1325,10 +1325,10 @@ namespace UnitTest
using Y = SharedPtr::test::Y;
AZStd::shared_ptr<void> pv;
pv.reset(static_cast<X*>(0));
pv.reset(static_cast<X*>(nullptr));
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1342,10 +1342,10 @@ namespace UnitTest
EXPECT_TRUE(pv.unique());
EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances);
pv.reset(static_cast<X*>(0));
pv.reset(static_cast<X*>(nullptr));
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1361,10 +1361,10 @@ namespace UnitTest
EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances);
EXPECT_EQ(1, m_sharedPtr->m_test.m_yInstances);
pv.reset(static_cast<Y*>(0));
pv.reset(static_cast<Y*>(nullptr));
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances);
@@ -1375,10 +1375,10 @@ namespace UnitTest
{
AZStd::shared_ptr<int> pi;
pi.reset(static_cast<int*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
pi.reset(static_cast<int*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 1);
EXPECT_TRUE(pi.unique());
@@ -1386,23 +1386,23 @@ namespace UnitTest
int m = 0;
pi.reset(&m, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
EXPECT_TRUE(pi ? true : false);
EXPECT_TRUE(!!pi);
EXPECT_TRUE(pi.get() == &m);
EXPECT_TRUE(pi.use_count() == 1);
EXPECT_TRUE(pi.unique());
pi.reset(static_cast<int*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
pi.reset(static_cast<int*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == &m);
EXPECT_FALSE(pi);
EXPECT_TRUE(!pi);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
EXPECT_TRUE(pi.use_count() == 1);
EXPECT_TRUE(pi.unique());
pi.reset();
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
}
TEST_F(SmartPtr, SharedPtrResetClassWithDeleter)
@@ -1411,10 +1411,10 @@ namespace UnitTest
using Y = SharedPtr::test::Y;
AZStd::shared_ptr<X> px;
px.reset(static_cast<X*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
px.reset(static_cast<X*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
@@ -1422,40 +1422,40 @@ namespace UnitTest
X x(m_sharedPtr->m_test);
px.reset(&x, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
EXPECT_TRUE(px ? true : false);
EXPECT_TRUE(!!px);
EXPECT_TRUE(px.get() == &x);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
px.reset(static_cast<X*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
px.reset(static_cast<X*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == &x);
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
Y y(m_sharedPtr->m_test);
px.reset(&y, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
EXPECT_TRUE(px ? true : false);
EXPECT_TRUE(!!px);
EXPECT_TRUE(px.get() == &y);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
px.reset(static_cast<Y*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
px.reset(static_cast<Y*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == &y);
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
px.reset();
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
}
TEST_F(SmartPtr, SharedPtrResetVoidClassWithDeleter)
@@ -1464,10 +1464,10 @@ namespace UnitTest
using Y = SharedPtr::test::Y;
AZStd::shared_ptr<void> pv;
pv.reset(static_cast<X*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
pv.reset(static_cast<X*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
@@ -1475,40 +1475,40 @@ namespace UnitTest
X x(m_sharedPtr->m_test);
pv.reset(&x, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
EXPECT_TRUE(pv ? true : false);
EXPECT_TRUE(!!pv);
EXPECT_TRUE(pv.get() == &x);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
pv.reset(static_cast<X*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
pv.reset(static_cast<X*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == &x);
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
Y y(m_sharedPtr->m_test);
pv.reset(&y, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
EXPECT_TRUE(pv ? true : false);
EXPECT_TRUE(!!pv);
EXPECT_TRUE(pv.get() == &y);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
pv.reset(static_cast<Y*>(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
pv.reset(static_cast<Y*>(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == &y);
EXPECT_FALSE(pv);
EXPECT_TRUE(!pv);
EXPECT_TRUE(pv.get() == 0);
EXPECT_TRUE(pv.get() == nullptr);
EXPECT_TRUE(pv.use_count() == 1);
EXPECT_TRUE(pv.unique());
pv.reset();
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
}
TEST_F(SmartPtr, SharedPtrResetIncompleteNullWithDeleter)
@@ -1521,20 +1521,20 @@ namespace UnitTest
px.reset(p0, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
m_sharedPtr->m_test.deleted = &px;
px.reset(p0, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted));
EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0);
EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr);
}
TEST_F(SmartPtr, SharedPtrGetPointerEmpty)
{
struct X {};
AZStd::shared_ptr<X> px;
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
@@ -1544,8 +1544,8 @@ namespace UnitTest
TEST_F(SmartPtr, SharedPtrGetPointerNull)
{
struct X {};
AZStd::shared_ptr<X> px(static_cast<X*>(0));
EXPECT_TRUE(px.get() == 0);
AZStd::shared_ptr<X> px(static_cast<X*>(nullptr));
EXPECT_TRUE(px.get() == nullptr);
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
@@ -1555,8 +1555,8 @@ namespace UnitTest
TEST_F(SmartPtr, SharedPtrGetPointerCheckedDeleterNull)
{
struct X {};
AZStd::shared_ptr<X> px(static_cast<X*>(0), AZStd::checked_deleter<X>());
EXPECT_TRUE(px.get() == 0);
AZStd::shared_ptr<X> px(static_cast<X*>(nullptr), AZStd::checked_deleter<X>());
EXPECT_TRUE(px.get() == nullptr);
EXPECT_FALSE(px);
EXPECT_TRUE(!px);
@@ -1594,7 +1594,7 @@ namespace UnitTest
TEST_F(SmartPtr, SharedPtrUseCountNullClass)
{
struct X {};
AZStd::shared_ptr<X> px(static_cast<X*>(0));
AZStd::shared_ptr<X> px(static_cast<X*>(nullptr));
EXPECT_TRUE(px.use_count() == 1);
EXPECT_TRUE(px.unique());
@@ -1641,14 +1641,14 @@ namespace UnitTest
px.swap(px2);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px2.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px2.get() == nullptr);
using std::swap;
swap(px, px2);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px2.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px2.get() == nullptr);
}
TEST_F(SmartPtr, SharedPtrSwapNewClass)
@@ -1663,14 +1663,14 @@ namespace UnitTest
EXPECT_TRUE(px.get() == p);
EXPECT_TRUE(px.use_count() == 2);
EXPECT_TRUE(px2.get() == 0);
EXPECT_TRUE(px2.get() == nullptr);
EXPECT_TRUE(px3.get() == p);
EXPECT_TRUE(px3.use_count() == 2);
using std::swap;
swap(px, px2);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
EXPECT_TRUE(px2.get() == p);
EXPECT_TRUE(px2.use_count() == 2);
EXPECT_TRUE(px3.get() == p);
@@ -1876,10 +1876,10 @@ namespace UnitTest
AZStd::shared_ptr<void> pv;
AZStd::shared_ptr<int> pi = AZStd::static_pointer_cast<int>(pv);
EXPECT_TRUE(pi.get() == 0);
EXPECT_TRUE(pi.get() == nullptr);
AZStd::shared_ptr<X> px = AZStd::static_pointer_cast<X>(pv);
EXPECT_TRUE(px.get() == 0);
EXPECT_TRUE(px.get() == nullptr);
}
TEST_F(SmartPtr, SharedPtrStaticPointerCastNewIntToVoid)
@@ -1946,7 +1946,7 @@ namespace UnitTest
AZStd::shared_ptr<void const volatile> px;
AZStd::shared_ptr<void> px2 = AZStd::const_pointer_cast<void>(px);
EXPECT_TRUE(px2.get() == 0);
EXPECT_TRUE(px2.get() == nullptr);
}
TEST_F(SmartPtr, SharedPtrIntConstPointerCastInt)
@@ -1954,7 +1954,7 @@ namespace UnitTest
AZStd::shared_ptr<int const volatile> px;
AZStd::shared_ptr<int> px2 = AZStd::const_pointer_cast<int>(px);
EXPECT_TRUE(px2.get() == 0);
EXPECT_TRUE(px2.get() == nullptr);
}
TEST_F(SmartPtr, SharedPtrClassConstPointerCastClass)
@@ -1963,7 +1963,7 @@ namespace UnitTest
AZStd::shared_ptr<X const volatile> px;
AZStd::shared_ptr<X> px2 = AZStd::const_pointer_cast<X>(px);
EXPECT_TRUE(px2.get() == 0);
EXPECT_TRUE(px2.get() == nullptr);
}
TEST_F(SmartPtr, SharedPtrVoidVolatileConstPointerCastVoid)
+4 -4
View File
@@ -444,7 +444,7 @@ namespace UnitTest
str2.back() = 'p';
AZ_TEST_ASSERT(str2.back() == 'p');
AZ_TEST_ASSERT(str2.c_str() != 0);
AZ_TEST_ASSERT(str2.c_str() != nullptr);
AZ_TEST_ASSERT(::strlen(str2.c_str()) == str2.length());
str2.resize(30, 'm');
@@ -793,7 +793,7 @@ namespace UnitTest
AZ_TEST_ASSERT(alphanum_comp(strdup("Alpha 2 B"), strA) > 0);
// show usage of the comparison functor with a set
typedef set<string, alphanum_less<string> > StringSetType;
using StringSetType = set<string, alphanum_less<string>>;
StringSetType s;
s.insert("Xiph Xlater 58");
s.insert("Xiph Xlater 5000");
@@ -879,7 +879,7 @@ namespace UnitTest
AZ_TEST_ASSERT(*setIt++ == "Xiph Xlater 10000");
// show usage of comparison functor with a map
typedef map<string, int, alphanum_less<string> > StringIntMapType;
using StringIntMapType = map<string, int, alphanum_less<string>>;
StringIntMapType m;
m["z1.doc"] = 1;
m["z10.doc"] = 2;
@@ -1441,7 +1441,7 @@ namespace UnitTest
TEST_F(String, String_FormatOnlyAllowsValidArgs)
{
constexpr bool v1 = 0;
constexpr bool v1 = false;
constexpr char v2 = 0;
constexpr unsigned char v3 = 0;
constexpr signed char v4 = 0;
@@ -824,7 +824,7 @@ namespace UnitTest
{1, 2, 3, 4}
};
AZ_TEST_ASSERT(myArr.empty() == false);
AZ_TEST_ASSERT(myArr.data() != 0);
AZ_TEST_ASSERT(myArr.data() != nullptr);
AZ_TEST_ASSERT(myArr.size() == 10);
AZ_TEST_ASSERT(myArr.front() == 1);
AZ_TEST_ASSERT(myArr.back() == 0);
@@ -52,7 +52,7 @@ namespace UnitTest
AssetLoadBus::Handler::BusConnect(m_assetId);
}
}
~OnAssetReadyListener()
~OnAssetReadyListener() override
{
m_assetId.SetInvalid();
m_latest = {};
@@ -109,7 +109,7 @@ namespace UnitTest
{
BusConnect(assetId);
}
~ContainerReadyListener()
~ContainerReadyListener() override
{
BusDisconnect();
}
@@ -2658,7 +2658,7 @@ namespace UnitTest
m_canceled = true;
}
~CancelListener()
~CancelListener() override
{
BusDisconnect();
}
@@ -420,7 +420,7 @@ namespace UnitTest
AZ::Data::AssetHandler::LoadResult LoadAssetData(
[[maybe_unused]] const AZ::Data::Asset<AZ::Data::AssetData>& asset,
[[maybe_unused]] AZStd::shared_ptr<AZ::Data::AssetDataStream> stream,
[[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB)
[[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB) override
{
return AZ::Data::AssetHandler::LoadResult::LoadComplete;
}
+2 -2
View File
@@ -398,7 +398,7 @@ namespace Benchmark
{
public:
EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusConnect(); }
~EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusDisconnect(); }
~EBusPerfBaselineImplEmpty() override { EBusPerfBaselineBus::Handler::BusDisconnect(); }
void OnSignal(int32_t) override {}
};
@@ -418,7 +418,7 @@ namespace Benchmark
{
public:
EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusConnect(); }
~EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusDisconnect(); }
~EBusPerfBaselineImplIncrement() override { EBusPerfBaselineBus::Handler::BusDisconnect(); }
void SetIncrementCounter(int32_t* incrementCounter) { m_incrementCounter = incrementCounter; }
void OnSignal(int32_t) override { ++(*m_incrementCounter); }
int32_t* m_incrementCounter;
@@ -870,11 +870,11 @@ namespace Benchmark
, public ::UnitTest::AllocatorsBase
{
public:
void SetUp([[maybe_unused]] const ::benchmark::State& state)
void SetUp([[maybe_unused]] const ::benchmark::State& state) override
{
::UnitTest::AllocatorsBase::SetupAllocator();
}
void TearDown([[maybe_unused]] const ::benchmark::State& state)
void TearDown([[maybe_unused]] const ::benchmark::State& state) override
{
::UnitTest::AllocatorsBase::TeardownAllocator();
}
+7 -7
View File
@@ -184,7 +184,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(Vector3SumJob, ThreadPoolAllocator, 0)
Vector3SumJob(const Vector3* array, unsigned int size, Vector3* result, JobContext* context = NULL)
Vector3SumJob(const Vector3* array, unsigned int size, Vector3* result, JobContext* context = nullptr)
: Job(true, context)
, m_array(array)
, m_size(size)
@@ -284,7 +284,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(FibonacciJobJoin, ThreadPoolAllocator, 0)
FibonacciJobJoin(int* result, JobContext* context = NULL)
FibonacciJobJoin(int* result, JobContext* context = nullptr)
: Job(true, context)
, m_result(result)
{
@@ -304,7 +304,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(FibonacciJobFork, ThreadPoolAllocator, 0)
FibonacciJobFork(int n, int* result, JobContext* context = NULL)
FibonacciJobFork(int n, int* result, JobContext* context = nullptr)
: Job(true, context)
, m_n(n)
, m_result(result)
@@ -374,7 +374,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(FibonacciJob2, ThreadPoolAllocator, 0)
FibonacciJob2(int n, int* result, JobContext* context = NULL)
FibonacciJob2(int n, int* result, JobContext* context = nullptr)
: Job(true, context)
, m_n(n)
, m_result(result)
@@ -441,7 +441,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(MergeSortJobJoin, ThreadPoolAllocator, 0)
MergeSortJobJoin(int* array, int* tempArray, int size1, int size2, JobContext* context = NULL)
MergeSortJobJoin(int* array, int* tempArray, int size1, int size2, JobContext* context = nullptr)
: Job(true, context)
, m_array(array)
, m_tempArray(tempArray)
@@ -496,7 +496,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(MergeSortJobFork, ThreadPoolAllocator, 0)
MergeSortJobFork(int* array, int* tempArray, int size, JobContext* context = NULL)
MergeSortJobFork(int* array, int* tempArray, int size, JobContext* context = nullptr)
: Job(true, context)
, m_array(array)
, m_tempArray(tempArray)
@@ -585,7 +585,7 @@ namespace UnitTest
public:
AZ_CLASS_ALLOCATOR(QuickSortJob, ThreadPoolAllocator, 0)
QuickSortJob(int* array, int left, int right, JobContext* context = NULL)
QuickSortJob(int* array, int left, int right, JobContext* context = nullptr)
: Job(true, context)
, m_array(array)
, m_left(left)
@@ -22,7 +22,7 @@ namespace Benchmark
: public benchmark::Fixture
{
public:
void SetUp([[maybe_unused]] const::benchmark::State& state)
void SetUp([[maybe_unused]] const::benchmark::State& state) override
{
m_testDataArray.resize(1000);
+6 -6
View File
@@ -90,7 +90,7 @@ namespace UnitTest
#else
static const int numAllocations = 10000;
#endif
void* addresses[numAllocations] = {0};
void* addresses[numAllocations] = {nullptr};
IAllocatorAllocate& sysAlloc = AllocatorInstance<SystemAllocator>::Get();
@@ -242,7 +242,7 @@ namespace UnitTest
//////////////////////////////////////////////////////////////////////////
// realloc test
address[0] = NULL;
address[0] = nullptr;
static const unsigned int checkValue = 0x0badbabe;
// create tree (non pool) allocation (we usually pool < 256 bytes)
address[0] = sysAlloc.Allocate(2048, 16);
@@ -372,7 +372,7 @@ namespace UnitTest
poolAllocator.GetRecords()->unlock();
}
for (i = 0; address[i] != 0; ++i)
for (i = 0; address[i] != nullptr; ++i)
{
poolAlloc.DeAllocate(address[i]);
}
@@ -544,7 +544,7 @@ namespace UnitTest
#else
static const int numAllocations = 10000;
#endif
void* addresses[numAllocations] = {0};
void* addresses[numAllocations] = {nullptr};
IAllocatorAllocate& poolAlloc = AllocatorInstance<ThreadPoolAllocator>::Get();
@@ -665,7 +665,7 @@ namespace UnitTest
poolAllocator.GetRecords()->unlock();
}
for (int i = 0; address[i] != 0; ++i)
for (int i = 0; address[i] != nullptr; ++i)
{
poolAlloc.DeAllocate(address[i]);
}
@@ -820,7 +820,7 @@ namespace UnitTest
AllocatorInstance<SystemAllocator>::Create(sysDesc);
BestFitExternalMapAllocator::Descriptor desc;
desc.m_mapAllocator = NULL; // use the system allocator
desc.m_mapAllocator = nullptr; // use the system allocator
desc.m_memoryBlockByteSize = 4 * 1024 * 1024;
desc.m_memoryBlock = azmalloc(desc.m_memoryBlockByteSize, desc.m_memoryBlockAlignment);
@@ -121,13 +121,13 @@ namespace Benchmark
: public ::benchmark::Fixture
{
public:
void SetUp(const ::benchmark::State& state)
void SetUp(const ::benchmark::State& state) override
{
AZ_UNUSED(state);
AZ::AllocatorInstance<HphaSchema_TestAllocator>::Create();
}
void TearDown(const ::benchmark::State& state)
void TearDown(const ::benchmark::State& state) override
{
AZ_UNUSED(state);
AZ::AllocatorInstance<HphaSchema_TestAllocator>::Destroy();
@@ -28,12 +28,12 @@ namespace JsonSerializationTests
AZ::NameDictionary::Destroy();
}
void Reflect(AZStd::unique_ptr<AZ::SerializeContext>& context)
void Reflect(AZStd::unique_ptr<AZ::SerializeContext>& context) override
{
AZ::Name::Reflect(context.get());
}
void Reflect(AZStd::unique_ptr<AZ::JsonRegistrationContext>& context)
void Reflect(AZStd::unique_ptr<AZ::JsonRegistrationContext>& context) override
{
AZ::Name::Reflect(context.get());
}
@@ -74,7 +74,7 @@ namespace Benchmark
{
public:
EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusConnect(); }
~EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusDisconnect(); }
~EBusPerfBaselineImplEmpty() override { EBusPerfBaselineBus::Handler::BusDisconnect(); }
void OnSignal(int32_t) override {}
};
@@ -94,7 +94,7 @@ namespace Benchmark
{
public:
EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusConnect(); }
~EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusDisconnect(); }
~EBusPerfBaselineImplIncrement() override { EBusPerfBaselineBus::Handler::BusDisconnect(); }
void SetIncrementCounter(int32_t* incrementCounter) { m_incrementCounter = incrementCounter; }
void OnSignal(int32_t) override { ++(*m_incrementCounter); }
int32_t* m_incrementCounter;
+4 -4
View File
@@ -1382,7 +1382,7 @@ namespace UnitTest
static int s_errorCount = 0;
IncompleteType* s_globalIncompletePtr = static_cast<IncompleteType*>(AZ_INVALID_POINTER);
IncompleteType* s_globalIncompletePtr1 = 0;
IncompleteType* s_globalIncompletePtr1 = nullptr;
void GlobalVarSet(int v)
{
@@ -2234,7 +2234,7 @@ namespace UnitTest
// incomplete types passed by a light-user data (pointer reference)
AZ_TEST_ASSERT(s_globalIncompletePtr == reinterpret_cast<IncompleteType*>(AZ_INVALID_POINTER));
AZ_TEST_ASSERT(s_globalIncompletePtr1 == 0);
AZ_TEST_ASSERT(s_globalIncompletePtr1 == nullptr);
script.Execute("globalIncomplete1 = globalIncomplete");
AZ_TEST_ASSERT(s_globalIncompletePtr1 == s_globalIncompletePtr);
@@ -3157,7 +3157,7 @@ namespace UnitTest
char stackOutput[2048];
debugContext->StackTrace(stackOutput, AZ_ARRAY_SIZE(stackOutput));
AZ_Printf("Script", "%s", stackOutput);
AZ_TEST_ASSERT(strstr(stackOutput, "GlobalFunction") != 0);
AZ_TEST_ASSERT(strstr(stackOutput, "GlobalFunction") != nullptr);
AZ_TEST_ASSERT(breakpoint->m_lineNumber == 20);
}
else if (m_numBreakpointHits == 2)
@@ -3193,7 +3193,7 @@ namespace UnitTest
char stackOutput[2048];
debugContext->StackTrace(stackOutput, AZ_ARRAY_SIZE(stackOutput));
AZ_Printf("Script", "%s", stackOutput);
AZ_TEST_ASSERT(strstr(stackOutput, "GlobalMult") != 0);
AZ_TEST_ASSERT(strstr(stackOutput, "GlobalMult") != nullptr);
AZ_TEST_ASSERT(breakpoint->m_lineNumber == 23);
}
@@ -2231,7 +2231,7 @@ TEST_F(SerializeBasicTest, BasicTypeTest_Succeed)
(void)classId;
DeprecationTestClass* obj = reinterpret_cast<DeprecationTestClass*>(classPtr);
EXPECT_EQ( 0, obj->m_deprecated.m_data );
EXPECT_EQ( NULL, obj->m_deprecatedPtr );
EXPECT_EQ( nullptr, obj->m_deprecatedPtr );
EXPECT_EQ( 0, obj->m_oldClassData );
EXPECT_EQ( 0.f, obj->m_newClassData );
EXPECT_EQ( 0, obj->m_missingMember );
@@ -4057,7 +4057,7 @@ namespace UnitTest
if (strcmp(classData->m_name, "MyEditStruct") == 0)
{
EXPECT_TRUE(classData->m_editData != NULL);
EXPECT_TRUE(classData->m_editData != nullptr);
EXPECT_EQ( 0, strcmp(classData->m_editData->m_name, "MyEditStruct") );
EXPECT_EQ( 0, strcmp(classData->m_editData->m_description, "My edit struct class used for ...") );
EXPECT_EQ( 2, classData->m_editData->m_elements.size() );
@@ -4071,12 +4071,12 @@ namespace UnitTest
// Number of options attribute
EXPECT_EQ(classElement->m_editData->m_attributes[0].first, AZ_CRC("NumOptions", 0x90274abc));
Edit::AttributeData<int>* intData = azrtti_cast<Edit::AttributeData<int>*>(classElement->m_editData->m_attributes[0].second);
EXPECT_TRUE(intData != NULL);
EXPECT_TRUE(intData != nullptr);
EXPECT_EQ( 3, intData->Get(instance) );
// Get options attribute
EXPECT_EQ( classElement->m_editData->m_attributes[1].first, AZ_CRC("Options", 0xd035fa87));
Edit::AttributeFunction<int(int)>* funcData = azrtti_cast<Edit::AttributeFunction<int(int)>*>(classElement->m_editData->m_attributes[1].second);
EXPECT_TRUE(funcData != NULL);
EXPECT_TRUE(funcData != nullptr);
EXPECT_EQ( 20, funcData->Invoke(instance, 10) );
}
return true;
@@ -58,7 +58,7 @@ namespace JsonSerializationTests
return array;
}
AZStd::shared_ptr<Array> CreatePartialDefaultInstance()
AZStd::shared_ptr<Array> CreatePartialDefaultInstance() override
{
auto array = AZStd::make_shared<Array>();
(*array)[0] = 10;
@@ -128,7 +128,7 @@ namespace JsonSerializationTests
return array;
}
AZStd::shared_ptr<Array> CreatePartialDefaultInstance()
AZStd::shared_ptr<Array> CreatePartialDefaultInstance() override
{
auto partialInstance = aznew MultipleInheritence();
partialInstance->m_var1 = 142;
@@ -169,7 +169,7 @@ namespace JsonSerializationTests
return AZStd::shared_ptr<Map>(new Map{}, &Delete);
}
AZStd::shared_ptr<Map> CreatePartialDefaultInstance()
AZStd::shared_ptr<Map> CreatePartialDefaultInstance() override
{
auto instance = AZStd::shared_ptr<Map>(new Map{}, &Delete);
instance->emplace(AZStd::make_pair(aznew SimpleClass(), aznew SimpleClass(188, 188.0)));
@@ -33,7 +33,7 @@ namespace JsonSerializationTests
return AZStd::make_shared<String>("Hello");
}
AZStd::string_view GetJsonForFullySetInstance()
AZStd::string_view GetJsonForFullySetInstance() override
{
return R"("Hello")";
}
@@ -48,7 +48,7 @@ namespace JsonSerializationTests
features.m_supportsInjection = false;
}
bool AreEqual(const String& lhs, const String& rhs)
bool AreEqual(const String& lhs, const String& rhs) override
{
return lhs.compare(rhs) == 0;
}
@@ -147,7 +147,7 @@ namespace SettingsRegistryConsoleUtilsTests
struct SettingsRegistryDumpCommandHandler
: public AZ::Debug::TraceMessageBus::Handler
{
bool OnOutput(const char* window, const char* message)
bool OnOutput(const char* window, const char* message) override
{
if (window == AZStd::string_view("SettingsRegistry"))
{
@@ -218,7 +218,7 @@ namespace SettingsRegistryConsoleUtilsTests
, m_expectedValue2{ expectedValue2 }
{
}
bool OnOutput(const char* window, const char* message)
bool OnOutput(const char* window, const char* message) override
{
if (window == AZStd::string_view("SettingsRegistry"))
{
+1 -1
View File
@@ -40,7 +40,7 @@ namespace UnitTest
}
}
~StatisticsTest()
~StatisticsTest() override
{
}
@@ -184,7 +184,7 @@ namespace AZ::IO
size = size >> 2;
for (u64 i = 0; i < size; ++i)
{
// Using assert here because in case of a problem EXPECT would
// Using assert here because in case of a problem EXPECT would
// cause a large amount of log noise.
ASSERT_EQ(buffer[i], offset + (i << 2));
}
@@ -203,7 +203,9 @@ namespace AZ::IO
{
do
{
while (m_context->FinalizeCompletedRequests());
while (m_context->FinalizeCompletedRequests())
{
}
} while (m_cache->ExecuteRequests());
}
@@ -269,7 +271,7 @@ namespace AZ::IO
RedirectReadCalls();
EXPECT_CALL(*this, ReadFile(_, _, 0, m_fakeFileLength));
ProcessRead(m_buffer, m_path, 0, m_fakeFileLength, IStreamerTypes::RequestStatus::Completed);
VerifyReadBuffer(0, m_fakeFileLength);
}
@@ -519,8 +521,8 @@ namespace AZ::IO
using ::testing::_;
using ::testing::Return;
CreateTestEnvironment();
CreateTestEnvironment();
EXPECT_CALL(*m_mock, ExecuteRequests())
.WillOnce(Return(true))
.WillRepeatedly(Return(false));
@@ -553,7 +555,7 @@ namespace AZ::IO
RunProcessLoop();
EXPECT_TRUE(allRequestsCompleted);
VerifyReadBuffer(256, m_fakeFileLength - 512);
VerifyReadBuffer(buffer1, m_fakeFileLength - 768, secondReadSize);
}
@@ -622,7 +624,7 @@ namespace AZ::IO
m_fakeFileFound = false;
m_fakeFileLength = 0;
ProcessRead(m_buffer, m_path, 0, m_blockSize, IStreamerTypes::RequestStatus::Failed);
}
@@ -650,18 +652,18 @@ namespace AZ::IO
status.m_isIdle = false;
}));
EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(count);
constexpr size_t scratchBufferSize = 128_kib;
using ScratchBuffer = char[scratchBufferSize];
ScratchBuffer buffers[count];
bool allRequestsCompleted = true;
auto completed = [&allRequestsCompleted](const FileRequest& request)
{
// Capture result before request is recycled.
allRequestsCompleted = allRequestsCompleted && request.GetStatus() == IStreamerTypes::RequestStatus::Completed;
};
for (size_t i = 0; i < count; ++i)
{
StreamStackEntry::Status status;
@@ -738,7 +740,7 @@ namespace AZ::IO
RedirectReadCalls();
EXPECT_CALL(*this, ReadFile(_, _, 256, m_fakeFileLength - 256));
ProcessRead(m_buffer, m_path, 256, m_fakeFileLength - 256, IStreamerTypes::RequestStatus::Completed);
VerifyReadBuffer(256, m_fakeFileLength - 256);
}
@@ -1062,7 +1064,7 @@ namespace AZ::IO
.WillRepeatedly(Return(false));
EXPECT_CALL(*m_mock, QueueRequest(_))
.WillRepeatedly(Invoke(this, &BlockCacheTest::QueueReadRequest));
size_t firstReadSize = m_fakeFileLength - (2 * m_blockSize) - 512;
FileRequest* request0 = m_context->GetNewInternalRequest();
request0->CreateRead(nullptr, m_buffer, m_bufferSize, m_path, 256, firstReadSize);
@@ -1097,7 +1099,7 @@ namespace AZ::IO
VerifyReadBuffer(buffer1.get(), secondReadOffset, secondReadSize);
}
@@ -1146,7 +1148,7 @@ namespace AZ::IO
FileRequest* request = m_context->GetNewInternalRequest();
request->CreateFlush(m_path);
RunAndCompleteRequest(request, IStreamerTypes::RequestStatus::Completed);
// The partial read would normally be serviced from the cache, but now triggers another read.
EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(1);
ProcessRead(m_buffer, m_path, 512, m_blockSize - 1024, IStreamerTypes::RequestStatus::Completed);
@@ -1170,7 +1172,7 @@ namespace AZ::IO
FileRequest* request = m_context->GetNewInternalRequest();
request->CreateFlushAll();
RunAndCompleteRequest(request, IStreamerTypes::RequestStatus::Completed);
// The partial read would normally be serviced from the cache, but now triggers another read.
EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(1);
ProcessRead(m_buffer, m_path, 512, m_blockSize - 1024, IStreamerTypes::RequestStatus::Completed);
+1 -1
View File
@@ -966,7 +966,7 @@ namespace AZ
{
public:
StringPathFuncTest() = default;
virtual ~StringPathFuncTest() = default;
~StringPathFuncTest() override = default;
};