/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
1
#include "../libssts/SimpleTypeSystem.h"
39 by Gustav Hartvigsson
* Added "check" target for testing.
2
#include "error.h"
3
#include "test_macros.h"
4
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
5
void
6
_internal_print_error (SDynamicArray * arr, schar * str, spointer data) {
109.1.5 by Gustav Hartvigsson
* Getting closer to fixing the callbacks...
7
  s_print ("YO!");
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
8
  s_print ("(Error Test): %s\n", str);
9
  s_print ("YO!");
10
}
11
39 by Gustav Hartvigsson
* Added "check" target for testing.
12
int test_error () {
13
  setup_unit ();
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
14
15
  SDynamicArray * arr = NULL;
16
39 by Gustav Hartvigsson
* Added "check" target for testing.
17
  SError * e = NULL;
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
18
108 by Gustav Hartvigsson
libssts:
19
  test_case (s_error_has_error (e) == FALSE, "The error is not set. (NULL)");
20
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
21
108 by Gustav Hartvigsson
libssts:
22
  e = s_error_new ();
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
23
  test_case (e != NULL, "Error is not NULL");
108 by Gustav Hartvigsson
libssts:
24
  test_case (s_error_has_error (e) == FALSE, "The error is not set.");
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
25
26
  s_error_append (e, S_ERROR_NONE, "Nothing!", S_ERROR_GET_DEFAULT_DOMAIN);
27
108 by Gustav Hartvigsson
libssts:
28
  test_case (s_error_has_error (e) == TRUE, "The error is set.");
29
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
30
  arr = s_error_to_string_array (e);
31
32
  s_dynamic_array_for_each (arr, FOREACHFUNC(_internal_print_error), NULL);
33
108 by Gustav Hartvigsson
libssts:
34
  s_dynamic_array_free (arr, TRUE);
35
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
36
  s_print ("Hello!");
37
108 by Gustav Hartvigsson
libssts:
38
  s_error_free (e);
39
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
40
  s_error_teardown ();
39 by Gustav Hartvigsson
* Added "check" target for testing.
41
  end_unit ();
5.2.5 by Gustav Hartvigsson
Woops, foregot the test of the Error Objects...
42
}