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:
- 10:612739c6d27d
- Parent:
- 8:b9c096965c00
--- a/test.cpp	Tue Feb 14 02:38:18 2017 +0000
+++ b/test.cpp	Tue Feb 14 07:55:15 2017 +0000
@@ -23,6 +23,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()
@@ -271,3 +274,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
    