Rename route_frame to route_incoming_frame

master
Fred Sundvik 2016-02-14 21:34:40 +02:00
parent 0eb62c4ce6
commit f22d2543b1
3 changed files with 8 additions and 8 deletions

View File

@ -22,4 +22,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
void route_frame(uint8_t* data, uint16_t size);
void route_incoming_frame(uint8_t* data, uint16_t size);

View File

@ -107,7 +107,7 @@ void validator_recv_frame(uint8_t* data, uint16_t size) {
uint32_t frame_crc = *(uint32_t*)(data + size - 4);
uint32_t expected_crc = crc32_byte(data, size - 4);
if (frame_crc == expected_crc) {
route_frame(data, size-4);
route_incoming_frame(data, size-4);
}
}
}

View File

@ -26,7 +26,7 @@ SOFTWARE.
#include <cgreen/mocks.h>
#include "protocol/frame_validator.c"
void route_frame(uint8_t* data, uint16_t size) {
void route_incoming_frame(uint8_t* data, uint16_t size) {
mock(data, size);
}
@ -39,7 +39,7 @@ BeforeEach(FrameValidator) {}
AfterEach(FrameValidator) {}
Ensure(FrameValidator, doesnt_validate_frames_under_5_bytes) {
never_expect(route_frame);
never_expect(route_incoming_frame);
uint8_t data[] = {1, 2};
validator_recv_frame(0, 1);
validator_recv_frame(data, 2);
@ -49,7 +49,7 @@ Ensure(FrameValidator, doesnt_validate_frames_under_5_bytes) {
Ensure(FrameValidator, validates_one_byte_frame_with_correct_crc) {
uint8_t data[] = {0x44, 0x04, 0x6A, 0xB3, 0xA3};
expect(route_frame,
expect(route_incoming_frame,
when(size, is_equal_to(1)),
when(data, is_equal_to_contents_of(data, 1))
);
@ -58,13 +58,13 @@ Ensure(FrameValidator, validates_one_byte_frame_with_correct_crc) {
Ensure(FrameValidator, does_not_validate_one_byte_frame_with_incorrect_crc) {
uint8_t data[] = {0x44, 0, 0, 0, 0};
never_expect(route_frame);
never_expect(route_incoming_frame);
validator_recv_frame(data, 5);
}
Ensure(FrameValidator, validates_four_byte_frame_with_correct_crc) {
uint8_t data[] = {0x44, 0x10, 0xFF, 0x00, 0x74, 0x4E, 0x30, 0xBA};
expect(route_frame,
expect(route_incoming_frame,
when(size, is_equal_to(4)),
when(data, is_equal_to_contents_of(data, 4))
);
@ -73,7 +73,7 @@ Ensure(FrameValidator, validates_four_byte_frame_with_correct_crc) {
Ensure(FrameValidator, validates_five_byte_frame_with_correct_crc) {
uint8_t data[] = {1, 2, 3, 4, 5, 0xF4, 0x99, 0x0B, 0x47};
expect(route_frame,
expect(route_incoming_frame,
when(size, is_equal_to(5)),
when(data, is_equal_to_contents_of(data, 5))
);