/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to tests/base_n.c

  • Committer: Gustav Hartvigsson
  • Date: 2021-09-09 10:23:09 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210909102309-b79pigoha67t5m92
* stuff to do with the unfinished base32 implementation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
const schar * testdata1 = "Hello World!";
7
7
const schar * testdata2 = "Hello World";
 
8
const schar * testdata3 = "Hello LibSSTS!";
 
9
const schar * testdata4 = "";
8
10
 
9
11
int
10
12
test_base_16_text (void) {
53
55
  test_case (s_string_is_equal (testdata2, ret), "The string has the expected value");
54
56
  
55
57
  s_free (hex);
 
58
  s_free (ret);
 
59
  
 
60
  //////////////////////////////////////////////////////////////////////////////
 
61
  
 
62
  testdata_size = strlen (testdata4);
 
63
  
 
64
  hex = s_base_16_enc ((sbyte *) testdata4, testdata_size, &out_size);
 
65
  
 
66
  test_case (s_string_is_equal ("", hex), "The Base16 data has the expected value.");
 
67
  
 
68
  s_print ("HEX: %s\n", hex);
 
69
  
 
70
  hex_size = strlen (hex);
 
71
  
 
72
  test_case (out_size == hex_size, "The outputed string has the same length as what the function reports.");
 
73
  
 
74
  ret = (schar *) s_base_16_dec (hex, hex_size, &out2_size);
 
75
  
 
76
  s_print ("RET:%s\n", ret);
 
77
  
 
78
  test_case (s_string_is_equal (testdata4, ret), "The string has the expected value");
 
79
  
 
80
  s_free (hex);
 
81
  s_free (ret);
56
82
  
57
83
  end_unit ();
58
84
}
76
102
  
77
103
  schar * t_hex = s_base_16_enc ((sbyte *) t1, testdata_size, &out_size);
78
104
  
79
 
  s_print ("%s\n", t_hex);
 
105
  //s_print ("%s\n", t_hex);
80
106
  
81
107
  TestBase16Struct * t2 = (TestBase16Struct *) s_base_16_dec (t_hex, out_size, &out2_size);
82
108
  
83
 
  s_print ("TestBase16Struct: some_value: %i, some_other_value: %li\n", t2->some_value, t2->some_other_value);
 
109
  //s_print ("TestBase16Struct: some_value: %i, some_other_value: %li\n", t2->some_value, t2->some_other_value);
84
110
  
85
111
  test_case (t2->some_value == t1->some_value, "some_value are equal.");
86
112
  test_case (t2->some_other_value == t1->some_other_value, "some_other_value are equal");
91
117
  
92
118
  end_unit ();
93
119
}
 
120
 
 
121
 
 
122
const schar * testdata3_base_32 = "JBSWY3DPEBGGSYSTKNKFGII=";
 
123
 
 
124
int
 
125
test_base_32_text (void) {
 
126
  setup_unit ();
 
127
  
 
128
  end_unit ();
 
129
}