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:
- 11:d3811e37d89c
- Parent:
- 9:04063c29ab43
- Child:
- 13:b5d0f491d465
--- a/test.cpp Tue Feb 14 05:02:45 2017 +0000
+++ b/test.cpp Tue Feb 14 09:25:25 2017 +0000
@@ -25,6 +25,9 @@
construct_vector_using_function_that_returns_int_test();
test_create_vector_by_copy_test();
+
+ string_to_data_test();
+ hexa_char_to_dec_test();
}
void vectors_are_equal_test()
@@ -286,3 +289,27 @@
assert(0 == strcmp(expected_string, actual_string));
}
+
+void string_to_data_test()
+{
+ vector<char> result;
+
+ result = string_to_data("0000");
+ assert(result.at(0) == 0);
+ assert(result.at(1) == 0);
+
+ result = string_to_data("EEEEEE");
+ assert(result.at(0) == 0xEE);
+ assert(result.at(1) == 0xEE);
+}
+
+void hexa_char_to_dec_test()
+{
+ assert(hexa_char_to_dec('0') == 0);
+ assert(hexa_char_to_dec('1') == 1);
+ assert(hexa_char_to_dec('A') == 10);
+ assert(hexa_char_to_dec('F') == 15);
+
+ assert(hexa_char_to_dec('a') == 10);
+ assert(hexa_char_to_dec('f') == 15);
+}
\ No newline at end of file
