本文整理汇总了C++中testing::ElementsAreArray方法的典型用法代码示例。如果您正苦于以下问题:C++ testing::ElementsAreArray方法的具体用法?C++ testing::ElementsAreArray怎么用?C++ testing::ElementsAreArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testing
的用法示例。
在下文中一共展示了testing::ElementsAreArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(BLEReturnSysExRecoveryBuffer, ReturnTwice)
{
using testing::ElementsAreArray;
using testing::_;
using testing::Args;
Fixture f;
static uint8_t longSysEx1[9] =
{
0x80, 0x80, 0xf0, 0x47, 0x7f, 0x15, 0x5c, 0x00, 0x01
};
static uint8_t longSysEx2[9] =
{
0x80, 0x21, 0x46, 0x47, 0x7f, 0x15, 0x5c, 0xf7, 0xf7
};
static uint8_t sysExFalseResult[13] =
{ 0xf0, 0x47, 0x7f, 0x15, 0x5c, 0x00, 0x01, 0x21, 0x46,
0x47, 0x7f, 0x15, 0xf7
};
static uint8_t sysExRecoveryResult[14] =
{ 0xf0, 0x47, 0x7f, 0x15, 0x5c, 0x00, 0x01, 0x21, 0x46,
0x47, 0x7f, 0x15, 0x5c, 0xf7
};
EXPECT_CALL(f.getMock(), SendSysEx(_,_,0)).With(Args<0,1>(
ElementsAreArray(sysExFalseResult))).Times(1);
EXPECT_CALL(f.getMock(), SendSysEx(_,_,0)).With(Args<0,1>(
ElementsAreArray(sysExRecoveryResult))).Times(1);
f.parseDataArray(longSysEx1, 9);
f.parseDataArray(longSysEx2, 9);
}
示例2:
TEST_F(ByteStuffer, receives_two_valid_frames) {
uint8_t expected1[] = {5, 0};
uint8_t expected2[] = {3};
EXPECT_CALL(*this, validator_recv_frame(_, _, _))
.With(Args<1, 2>(ElementsAreArray(expected1)));
EXPECT_CALL(*this, validator_recv_frame(_, _, _))
.With(Args<1, 2>(ElementsAreArray(expected2)));
byte_stuffer_recv_byte(1, 2);
byte_stuffer_recv_byte(1, 5);
byte_stuffer_recv_byte(1, 1);
byte_stuffer_recv_byte(1, 0);
byte_stuffer_recv_byte(1, 2);
byte_stuffer_recv_byte(1, 3);
byte_stuffer_recv_byte(1, 0);
}
示例3: ElementsAreArray
TEST(EventLogListBuilder, IntThenString) {
EventLogListBuilder builder;
const uint8_t EXPECTED_LOG[] = {
EVENT_TYPE_LIST,
2, // Number of items in the list.
EVENT_TYPE_INT,
42, 0, 0, 0, // 4 byte integer value.
EVENT_TYPE_STRING,
5, 0, 0, 0, // 4 byte length of the string.
'D', 'r', 'o', 'i', 'd',
};
builder.Append(42);
builder.Append("Droid");
std::unique_ptr<uint8_t[]> log;
size_t size;
builder.Release(&log, &size);
EXPECT_EQ(17U, size);
uint8_t* log_data = log.get();
EXPECT_THAT(std::vector<uint8_t>(log_data, log_data + size),
ElementsAreArray(EXPECTED_LOG));
}
示例4:
TEST_F(FrameValidator, sends_five_bytes_with_correct_crc) {
uint8_t original[] = {1, 2, 3, 4, 5, 0, 0, 0, 0};
uint8_t expected[] = {1, 2, 3, 4, 5, 0xF4, 0x99, 0x0B, 0x47};
EXPECT_CALL(*this, byte_stuffer_send_frame(_, _, _))
.With(Args<1, 2>(ElementsAreArray(expected)));
validator_send_frame(0, original, 5);
}
示例5: sizeof
TEST_F(ByteStuffer, sends_and_receives_full_roundtrip_small_packet_with_zeros) {
uint8_t original_data[] = { 1, 0, 3, 0, 0, 9};
byte_stuffer_send_frame(1, original_data, sizeof(original_data));
EXPECT_CALL(*this, validator_recv_frame(_, _, _))
.With(Args<1, 2>(ElementsAreArray(original_data)));
int i;
for(auto& d : sent_data) {
byte_stuffer_recv_byte(1, d);
}
}
示例6: ElementsAreArray
TEST_F(ByteStuffer, sends_frame_with_254_non_zeroes) {
uint8_t data[254];
int i;
for(i=0;i<254;i++) {
data[i] = i + 1;
}
byte_stuffer_send_frame(0, data, 254);
uint8_t expected[256];
expected[0] = 0xFF;
for(i=1;i<255;i++) {
expected[i] = i;
}
expected[255] = 0;
EXPECT_THAT(sent_data, ElementsAreArray(expected));
}