Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NerfUS-Coord NerfUSTarget
Fork of APP3_xbee by
Diff: test.cpp
- Revision:
- 4:e97cfe6cc18c
- Parent:
- 3:37ea92feece2
- Child:
- 5:cd3c79853dc8
--- a/test.cpp Sun Feb 12 20:31:46 2017 +0000
+++ b/test.cpp Sun Feb 12 21:33:48 2017 +0000
@@ -11,6 +11,7 @@
parse_frame_parses_receive_packet_test();
parse_frame_parses_transmit_status_test();
parse_frame_parses_at_command_response_test();
+ handle_frame_adds_parsed_frame_to_mailbox_test();
}
void vectors_are_equal_test()
@@ -116,4 +117,23 @@
const vector<char> actual_parsed_frame = parse_frame(frame_to_parse);
assert(vectors_are_equal(expected_parsed_frame, actual_parsed_frame));
+}
+
+void handle_frame_adds_parsed_frame_to_mailbox_test()
+{
+ const char frame_to_handle_array[] = {0x7E, 0x00, 0x05, 0x88, 0x01, 0x4E, 0x4A, 0x00, 0xDE};
+ const vector<char> frame_to_handle = construct_vector(frame_to_handle_array, 9);
+
+ const char expected_parsed_frame_array[] = {FRAME_TYPE_AT_COMMAND_RESPONSE, AT_COMMAND_RESPONSE_STATUS_OK};
+ const vector<char> expected_parsed_frame = construct_vector(expected_parsed_frame_array, 2);
+
+ handle_frame(frame_to_handle);
+
+ //Read parsed frame from the mailbox
+ osEvent event = parsed_frames.get();
+ assert(event.status == osEventMail);
+ vector<char> *parsed_frame = (vector<char>*)event.value.p;
+
+ assert(vectors_are_equal(expected_parsed_frame, *parsed_frame));
+ parsed_frames.free(parsed_frame);
}
\ No newline at end of file
