Go to the documentation of this file.
13 for (
size_t i=0;
i<
h;
i++){
14 for (
size_t j=0;
j<w;
j++){
15 t1[
i][
j] = (
i * w) +
j;
18 for (
size_t i=0;
i<
h;
i++){
19 for (
size_t j=0;
j<w;
j++){
20 ck_assert_int_eq(t1[
i][
j], (
i * w) +
j);
30 char **t1 = (
char**)malloc(w *
sizeof(
char*));
31 for (
size_t i=0;
i<w;
i++){
32 t1[
i] = (
char*)malloc(
h *
sizeof(
char));
34 for (
size_t i=0;
i<w;
i++){
35 for (
size_t j=0;
j<
h;
j++){
36 t1[
i][
j] = (
i * w) +
j;
39 for (
size_t i=0;
i<w;
i++){
40 for (
size_t j=0;
j<
h;
j++){
41 fprintf(
stdout,
"%ld, %ld | %d == %ld\n",
i,
j, t1[
i][
j], (
i * w) +
j);
42 ck_assert_int_eq(t1[
i][
j], (
i * w) +
j);
50 Suite *
s = suite_create(
"Stub");
52 TCase *tc_core = tcase_create(
"Core");
53 tcase_add_test(tc_core, allocate2d);
55 suite_add_tcase(
s, tc_core);
60 int main(
int argc,
char **argv){
64 SRunner *sr = srunner_create(
s);
66 srunner_run_all(sr, CK_VERBOSE);
67 number_failed = srunner_ntests_failed(sr);
69 return (number_failed == 0) ?
EXIT_SUCCESS : EXIT_FAILURE;
END_TEST Suite * stub_suite(void)
int main(int argc, char **argv)
void free2d_char(char **p)
Free a two-dimensional array created by allocate2d_char.
Utility functions for allocating and freeing two-dimensional arrays of various types.
void free_all(void *dark_rest, void *gain, void *tdi, void *scan_temp, void *side, void *msec)
void free2d_all_char(char **p, size_t length)
Free a two-dimensional array created by malloc'ing each row individually.
char ** allocate2d_char(size_t h, size_t w)
Allocate a two-dimensional array of type char of a given size.