~ubuntu-branches/ubuntu/utopic/cmocka/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/test_assert_macros_fail.c

  • Committer: Package Import Robot
  • Author(s): David Prévot, Andreas Schneider, David Prévot
  • Date: 2014-04-13 10:43:02 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140413104302-q1x223agjm8n57uj
Tags: 0.4.0-1
[ Andreas Schneider ]
* Bump version to 0.4.0.

[ David Prévot ]
* Use dh_doxygen to get rid of *.md5 and *.map files
* Provide jQuery helper for cmocka-doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdarg.h>
 
2
#include <stddef.h>
 
3
#include <setjmp.h>
 
4
#include <cmocka.h>
 
5
 
 
6
#include <errno.h>
 
7
#include <sys/types.h>
 
8
#include <sys/stat.h>
 
9
#include <unistd.h>
 
10
#include <fcntl.h>
 
11
 
 
12
/**************************************
 
13
 *** assert_return_code
 
14
 **************************************/
 
15
static void test_assert_return_code_fail(void **state)
 
16
{
 
17
    int fd;
 
18
 
 
19
    (void)state; /* unused */
 
20
 
 
21
    fd = open("this_file_doesnt_exist.cmocka", 0);
 
22
    assert_return_code(fd, errno);
 
23
 
 
24
    if (fd >= 0) {
 
25
        close(fd);
 
26
    }
 
27
}
 
28
 
 
29
int main(void) {
 
30
    const UnitTest tests[] = {
 
31
        unit_test(test_assert_return_code_fail),
 
32
    };
 
33
    return run_tests(tests);
 
34
}