/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) {
7
  s_print ("(Error Test): %s\n", str);
8
}
9
39 by Gustav Hartvigsson
* Added "check" target for testing.
10
int test_error () {
11
  setup_unit ();
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
12
13
  SDynamicArray * arr = NULL;
14
39 by Gustav Hartvigsson
* Added "check" target for testing.
15
  SError * e = NULL;
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
16
108 by Gustav Hartvigsson
libssts:
17
  test_case (s_error_has_error (e) == FALSE, "The error is not set. (NULL)");
18
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
19
108 by Gustav Hartvigsson
libssts:
20
  e = s_error_new ();
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
21
  test_case (e != NULL, "Error is not NULL");
108 by Gustav Hartvigsson
libssts:
22
  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...
23
24
  s_error_append (e, S_ERROR_NONE, "Nothing!", S_ERROR_GET_DEFAULT_DOMAIN);
25
108 by Gustav Hartvigsson
libssts:
26
  test_case (s_error_has_error (e) == TRUE, "The error is set.");
27
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
28
  arr = s_error_to_string_array (e);
29
30
  s_dynamic_array_for_each (arr, FOREACHFUNC(_internal_print_error), NULL);
31
108 by Gustav Hartvigsson
libssts:
32
  s_dynamic_array_free (arr, TRUE);
33
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
34
  s_print ("Hello!");
35
108 by Gustav Hartvigsson
libssts:
36
  s_error_free (e);
37
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
38
  s_error_teardown ();
39 by Gustav Hartvigsson
* Added "check" target for testing.
39
  end_unit ();
5.2.5 by Gustav Hartvigsson
Woops, foregot the test of the Error Objects...
40
}