|
|
@ -304,7 +304,7 @@ Ensure(ByteStuffer, received_frame_is_aborted_when_its_too_long) {
|
|
|
|
recv_byte(&state, 0);
|
|
|
|
recv_byte(&state, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_zero_size_frame_does_nothing) {
|
|
|
|
Ensure(ByteStuffer, does_nothing_when_sending_zero_size_frame) {
|
|
|
|
assert_that(sent_data_size, is_equal_to(0));
|
|
|
|
assert_that(sent_data_size, is_equal_to(0));
|
|
|
|
send_frame(NULL, 0);
|
|
|
|
send_frame(NULL, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -317,7 +317,7 @@ Ensure(ByteStuffer, send_one_byte_frame) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_two_byte_frame) {
|
|
|
|
Ensure(ByteStuffer, sends_two_byte_frame) {
|
|
|
|
uint8_t data[] = {5, 0x77};
|
|
|
|
uint8_t data[] = {5, 0x77};
|
|
|
|
send_frame(data, 2);
|
|
|
|
send_frame(data, 2);
|
|
|
|
uint8_t expected[] = {3, 5, 0x77, 0};
|
|
|
|
uint8_t expected[] = {3, 5, 0x77, 0};
|
|
|
@ -325,7 +325,7 @@ Ensure(ByteStuffer, send_two_byte_frame) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_one_byte_frame_with_zero) {
|
|
|
|
Ensure(ByteStuffer, sends_one_byte_frame_with_zero) {
|
|
|
|
uint8_t data[] = {0};
|
|
|
|
uint8_t data[] = {0};
|
|
|
|
send_frame(data, 1);
|
|
|
|
send_frame(data, 1);
|
|
|
|
uint8_t expected[] = {1, 1, 0};
|
|
|
|
uint8_t expected[] = {1, 1, 0};
|
|
|
@ -333,7 +333,7 @@ Ensure(ByteStuffer, send_one_byte_frame_with_zero) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_two_byte_frame_starting_with_zero) {
|
|
|
|
Ensure(ByteStuffer, sends_two_byte_frame_starting_with_zero) {
|
|
|
|
uint8_t data[] = {0, 9};
|
|
|
|
uint8_t data[] = {0, 9};
|
|
|
|
send_frame(data, 2);
|
|
|
|
send_frame(data, 2);
|
|
|
|
uint8_t expected[] = {1, 2, 9, 0};
|
|
|
|
uint8_t expected[] = {1, 2, 9, 0};
|
|
|
@ -341,7 +341,7 @@ Ensure(ByteStuffer, send_two_byte_frame_starting_with_zero) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_two_byte_frame_starting_with_non_zero) {
|
|
|
|
Ensure(ByteStuffer, sends_two_byte_frame_starting_with_non_zero) {
|
|
|
|
uint8_t data[] = {9, 0};
|
|
|
|
uint8_t data[] = {9, 0};
|
|
|
|
send_frame(data, 2);
|
|
|
|
send_frame(data, 2);
|
|
|
|
uint8_t expected[] = {2, 9, 1, 0};
|
|
|
|
uint8_t expected[] = {2, 9, 1, 0};
|
|
|
@ -349,7 +349,7 @@ Ensure(ByteStuffer, send_two_byte_frame_starting_with_non_zero) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_three_byte_frame_zero_in_the_middle) {
|
|
|
|
Ensure(ByteStuffer, sends_three_byte_frame_zero_in_the_middle) {
|
|
|
|
uint8_t data[] = {9, 0, 0x68};
|
|
|
|
uint8_t data[] = {9, 0, 0x68};
|
|
|
|
send_frame(data, 3);
|
|
|
|
send_frame(data, 3);
|
|
|
|
uint8_t expected[] = {2, 9, 2, 0x68, 0};
|
|
|
|
uint8_t expected[] = {2, 9, 2, 0x68, 0};
|
|
|
@ -357,7 +357,7 @@ Ensure(ByteStuffer, send_three_byte_frame_zero_in_the_middle) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_three_byte_frame_data_in_the_middle) {
|
|
|
|
Ensure(ByteStuffer, sends_three_byte_frame_data_in_the_middle) {
|
|
|
|
uint8_t data[] = {0, 0x55, 0};
|
|
|
|
uint8_t data[] = {0, 0x55, 0};
|
|
|
|
send_frame(data, 3);
|
|
|
|
send_frame(data, 3);
|
|
|
|
uint8_t expected[] = {1, 2, 0x55, 1, 0};
|
|
|
|
uint8_t expected[] = {1, 2, 0x55, 1, 0};
|
|
|
@ -365,7 +365,7 @@ Ensure(ByteStuffer, send_three_byte_frame_data_in_the_middle) {
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
assert_that(sent_data, is_equal_to_contents_of(expected, sizeof(expected)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ensure(ByteStuffer, send_three_byte_frame_all_zeroes) {
|
|
|
|
Ensure(ByteStuffer, sends_three_byte_frame_with_all_zeroes) {
|
|
|
|
uint8_t data[] = {0, 0, 0};
|
|
|
|
uint8_t data[] = {0, 0, 0};
|
|
|
|
send_frame(data, 3);
|
|
|
|
send_frame(data, 3);
|
|
|
|
uint8_t expected[] = {1, 1, 1, 1, 0};
|
|
|
|
uint8_t expected[] = {1, 1, 1, 1, 0};
|
|
|
|