bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
|
138
by Gustav Hartvigsson
* Fixed s_base_16_enc |
1 |
#include "../libssts/SimpleTypeSystem.h" |
2 |
#include "test_macros.h" |
|
3 |
#include "base_n.h" |
|
4 |
||
5 |
||
6 |
const schar * testdata = "Hello World!"; |
|
7 |
||
8 |
int
|
|
9 |
test_base_n (void) { |
|
10 |
setup_unit (); |
|
11 |
|
|
12 |
size_t testdata_size = strlen (testdata), |
|
13 |
out_size = 0, |
|
14 |
hex_size = 0, |
|
|
151
by Gustav Hartvigsson
* Fixed all warnings (exept the depricated warning...) |
15 |
out2_size = 0; |
|
138
by Gustav Hartvigsson
* Fixed s_base_16_enc |
16 |
|
17 |
schar * hex = s_base_16_enc ((sbyte *) testdata, testdata_size, &out_size); |
|
18 |
|
|
|
150
by Gustav Hartvigsson
* Fixed the tests in the CMake file |
19 |
s_print ("HEX: %s\n", hex); |
20 |
|
|
|
138
by Gustav Hartvigsson
* Fixed s_base_16_enc |
21 |
test_case (s_string_is_equal ("48656C6C6F20576F726C642100", hex), "The Base16 data has the expected value."); |
22 |
|
|
23 |
hex_size = strlen (hex); |
|
24 |
|
|
|
151
by Gustav Hartvigsson
* Fixed all warnings (exept the depricated warning...) |
25 |
schar * ret = (schar *) s_base_16_dec (hex, hex_size, &out2_size); |
|
138
by Gustav Hartvigsson
* Fixed s_base_16_enc |
26 |
|
27 |
s_print ("Test data: %s, The output from the decoding: %s\n", testdata, ret); |
|
28 |
|
|
29 |
test_case (s_string_is_equal (testdata, ret), "The string has the expected value"); |
|
30 |
|
|
31 |
|
|
32 |
s_free (hex); |
|
33 |
s_free (ret); |
|
34 |
|
|
35 |
end_unit (); |
|
36 |
}
|