File: set_field.c

package info (click to toggle)
cgreen 1.6.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,588 kB
  • sloc: ansic: 12,276; sh: 558; makefile: 474; cpp: 403; python: 181; xml: 33; sed: 13
file content (18 lines) | stat: -rw-r--r-- 420 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cgreen/cgreen.h>
#include <cgreen/mocks.h>

struct structure {
    int field;
    char *string;
};

void update_field(struct structure *struct_to_update) {
    int *field = &struct_to_update->field;
    mock(struct_to_update, field);
}

Ensure(setting_field_of_parameter) {
    int fourty_two = 42;
    expect(update_field,
           will_set_contents_of_output_parameter(field, &fourty_two, sizeof(int)));
}