src/third_party/angle/src/common/FastVector_unittest.cpp
TEST(FastVector, Constructors)
{
    FastVector<int, 5> defaultContructor;
    EXPECT_EQ(0u, defaultContructor.size());

    FastVector<int, 5> count(3);
    EXPECT_EQ(3u, count.size());

    FastVector<int, 5> countAndValue(3, 2);
    EXPECT_EQ(3u, countAndValue.size());
    EXPECT_EQ(2, countAndValue[1]);

    FastVector<int, 5> copy(countAndValue);
    EXPECT_EQ(copy, countAndValue);

    FastVector<int, 5> copyRValue(std::move(count));
    EXPECT_EQ(3u, copyRValue.size());

    FastVector<int, 5> initializerList{1, 2, 3, 4, 5};
    EXPECT_EQ(5u, initializerList.size());
    EXPECT_EQ(3, initializerList[2]);

    FastVector<int, 5> assignCopy(copyRValue);
    EXPECT_EQ(3u, assignCopy.size());

    FastVector<int, 5> assignRValue(std::move(assignCopy));
    EXPECT_EQ(3u, assignRValue.size());

    FastVector<int, 5> assignmentInitializerList = {1, 2, 3, 4, 5};
    EXPECT_EQ(5u, assignmentInitializerList.size());
    EXPECT_EQ(3, assignmentInitializerList[2]);
}
// Make sure the various constructors compile and do basic checks
Make sure the various constructors compile and do basic checks
Make sure the various constructors compile and do basic checks
TEST(FastVector, Constructors)
{
    FastVector<int, 5> defaultContructor;
    EXPECT_EQ(0u, defaultContructor.size());
    FastVector<int, 5> count(3);
    EXPECT_EQ(3u, count.size());
    FastVector<int, 5> countAndValue(3, 2);
    EXPECT_EQ(3u, countAndValue.size());
    EXPECT_EQ(2, countAndValue[1]);
    FastVector<int, 5> copy(countAndValue);
    EXPECT_EQ(copy, countAndValue);
    FastVector<int, 5> copyRValue(std::move(count));
    EXPECT_EQ(3u, copyRValue.size());
    FastVector<int, 5> initializerList{1, 2, 3, 4, 5};
    EXPECT_EQ(5u, initializerList.size());
    EXPECT_EQ(3, initializerList[2]);
    FastVector<int, 5> assignCopy(copyRValue);
    EXPECT_EQ(3u, assignCopy.size());
    FastVector<int, 5> assignRValue(std::move(assignCopy));
    EXPECT_EQ(3u, assignRValue.size());
    FastVector<int, 5> assignmentInitializerList = {1, 2, 3, 4, 5};
    EXPECT_EQ(5u, assignmentInitializerList.size());
    EXPECT_EQ(3, assignmentInitializerList[2]);
}
TEST ( FastVector , Constructors ) { FastVector < int , 5 > defaultContructor ; EXPECT_EQ ( 0u , defaultContructor . size ( ) ) ; FastVector < int , 5 > count ( 3 ) ; EXPECT_EQ ( 3u , count . size ( ) ) ; FastVector < int , 5 > countAndValue ( 3 , 2 ) ; EXPECT_EQ ( 3u , countAndValue . size ( ) ) ; EXPECT_EQ ( 2 , countAndValue [ 1 ] ) ; FastVector < int , 5 > copy ( countAndValue ) ; EXPECT_EQ ( copy , countAndValue ) ; FastVector < int , 5 > copyRValue ( std :: move ( count ) ) ; EXPECT_EQ ( 3u , copyRValue . size ( ) ) ; FastVector < int , 5 > initializerList { 1 , 2 , 3 , 4 , 5 } ; EXPECT_EQ ( 5u , initializerList . size ( ) ) ; EXPECT_EQ ( 3 , initializerList [ 2 ] ) ; FastVector < int , 5 > assignCopy ( copyRValue ) ; EXPECT_EQ ( 3u , assignCopy . size ( ) ) ; FastVector < int , 5 > assignRValue ( std :: move ( assignCopy ) ) ; EXPECT_EQ ( 3u , assignRValue . size ( ) ) ; FastVector < int , 5 > assignmentInitializerList = { 1 , 2 , 3 , 4 , 5 } ; EXPECT_EQ ( 5u , assignmentInitializerList . size ( ) ) ; EXPECT_EQ ( 3 , assignmentInitializerList [ 2 ] ) ; }
Make sure the various constructors compile and do basic checks
Make sure the various constructors compile and do basic checks