/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "../libssts/SimpleTypeSystem.h"
#include "test_macros.h"
#include "base_n.h"


const schar * testdata = "Hello World!";

int
test_base_n (void) {
  setup_unit ();
  
  size_t testdata_size = strlen (testdata),
         out_size = 0,
         hex_size = 0,
         out2_size = 0,
         ret_size = 0;
  
  schar * hex = s_base_16_enc ((sbyte *) testdata, testdata_size, &out_size);
  
  test_case (s_string_is_equal ("48656C6C6F20576F726C642100", hex), "The Base16 data has the expected value.");
  
  hex_size = strlen (hex);
  
  schar * ret = s_base_16_dec (hex, hex_size, &out2_size);
  
  s_print ("Test data: %s, The output from the decoding: %s\n", testdata, ret);
  
  test_case (s_string_is_equal (testdata, ret), "The string has the expected value");
  
  
  s_free (hex);
  s_free (ret);
  
  end_unit ();
}