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:
- 7:c65c4c98d237
- Parent:
- 6:b70f32a80d51
- Child:
- 8:b9c096965c00
diff -r b70f32a80d51 -r c65c4c98d237 test.cpp
--- a/test.cpp Mon Feb 13 19:13:50 2017 +0000
+++ b/test.cpp Tue Feb 14 01:13:18 2017 +0000
@@ -20,6 +20,9 @@
parsed_frame_to_string_accelerometer_test();
parsed_frame_to_string_accelerometer_negative_values_test();
parsed_frame_to_string_unsupported_event_type_test();
+
+ construct_vector_using_function_that_returns_int_test();
+ test_create_vector_by_copy_test();
}
void vectors_are_equal_test()
@@ -65,6 +68,36 @@
return constructed_vector;
}
+int some_function_that_returns_int_forty_two()
+{
+ return 42;
+}
+
+void construct_vector_using_function_that_returns_int_test()
+{
+ const char actual_vector_array[] = {EVENT_TYPE_BUTTON, (char) (some_function_that_returns_int_forty_two() )};
+ const vector<char> actual_vector = construct_vector(actual_vector_array, 2);
+
+ const char expected_vector_array[] = {EVENT_TYPE_BUTTON, 42};
+ vector<char> expected_vector = construct_vector(expected_vector_array, 2);
+
+ assert(vectors_are_equal(actual_vector, expected_vector));
+}
+
+void test_create_vector_by_copy_test()
+{
+ const vector<char> original(2, 3);
+ vector<char> *copy_vector = new vector<char>();
+ *copy_vector = original;
+
+ assert(vectors_are_equal(original, *copy_vector));
+
+ delete copy_vector;
+
+ assert(original.at(0) == 3);
+ assert(original.at(1) == 3);
+}
+
void generate_transmit_request_test()
{
const char expected_array[] = {0x7E, 0x00, 0x12, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x54, 0x65, 0x73, 0x74, 0x51};
