2016-02-24 1 views

Répondre

1

En supposant que vous l'objet fantaisie est nommé mockObj, voici comment vous correspondre l'argument avec le vecteur souhaité:

std::vector<int> dataToMatch{ 1, 2, 3 }; 
EXPECT_CALL(mockObj, send(ElementsAreArray(dataToMatch.cbegin(), dataToMatch.cend()))) 
    .WillOnce(Return()); 
2

Selon gmock docs sur container matchers, pour le cas d'utilisation proposée, vous pouvez simplement faire:

EXPECT_CALL(mockObj, send(std::vector<int>{1,2,3}).Times(1);