terminal/src/til/ut_til/BaseTests.cpp
Dustin L. Howett 60630cf7c4
Fix the x86 build and re-enable x86 CI (#6467)
This was a miss.
2020-06-11 17:04:42 +00:00

37 lines
969 B
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "precomp.h"
#include "til.h"
using namespace WEX::Common;
using namespace WEX::Logging;
using namespace WEX::TestExecution;
// Tests for things in the TIL base class.
class BaseTests
{
TEST_CLASS(BaseTests);
TEST_METHOD(ManageVector)
{
constexpr float shrinkThreshold = 0.5f;
std::vector<int> foo;
foo.reserve(20);
Log::Comment(L"Expand vector.");
til::manage_vector(foo, 30, shrinkThreshold);
VERIFY_ARE_EQUAL(30u, foo.capacity());
Log::Comment(L"Try shrink but by not enough for threshold.");
til::manage_vector(foo, 18, shrinkThreshold);
VERIFY_ARE_EQUAL(30u, foo.capacity());
Log::Comment(L"Shrink because it is meeting threshold.");
til::manage_vector(foo, 15, shrinkThreshold);
VERIFY_ARE_EQUAL(15u, foo.capacity());
}
};