File: stream_tests1.c

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

char *read_paragraph(int (*read)(void *), void *stream);

static int stream_stub(void *stream) {
    return (int)mock(stream);
}

Describe(ParagraphReader);
BeforeEach(ParagraphReader) {}
AfterEach(ParagraphReader) {}

Ensure(ParagraphReader, gives_null_when_reading_empty_stream) {
    always_expect(stream_stub, will_return(EOF));                                 // <1>
    assert_that(read_paragraph(&stream_stub, NULL), is_null);
}