Beispiel #1
0
 def setUp(self):
     """NOTE this is called once for each test* method
     (it is not called once per class).
     FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
     """
     header_str = """
     typedef enum {
         TEST_1 = 0,
         TEST_2
     } test_status_t;
     """
     libraries = None
     self.module, output = ctypesgentest.test(header_str)
Beispiel #2
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''

struct foo
{
        int a;
        char b;
        int c;
        int d : 15;
        int   : 17;
};

struct __attribute__((packed)) packed_foo
{
        int a;
        char b;
        int c;
        int d : 15;
        int   : 17;
};

typedef struct
{
        int a;
        char b;
        int c;
        int d : 15;
        int   : 17;
} foo_t;

typedef struct __attribute__((packed))
{
        int a;
        char b;
        int c;
        int d : 15;
        int   : 17;
} packed_foo_t;

typedef int Int;

typedef struct {
        int Int;
} id_struct_t;
'''
        libraries = None
        self.module, output = ctypesgentest.test(header_str)
Beispiel #3
0
 def setUp(self):
     """NOTE this is called once for each test* method
     (it is not called once per class).
     FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
     """
     header_str = '#include <stdlib.h>\n'
     if sys.platform == "win32":
         # pick something from %windir%\system32\msvc*dll that include stdlib
         libraries = ["msvcrt.dll"]
         libraries = ["msvcrt"]
     elif sys.platform.startswith("linux"):
         libraries = ["libc.so.6"]
     else:
         libraries = ["libc"]
     self.module, output = ctypesgentest.test(header_str, libraries=libraries, all_headers=True)
Beispiel #4
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''
struct foo
{
        int a;
        int b;
        int c;
};
'''
        libraries = None
        self.module, output = ctypesgentest.test(header_str)
Beispiel #5
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''
#include <stdbool.h>

struct foo
{
    bool is_bar;
    int a;
};
'''
        self.module, _ = ctypesgentest.test(header_str)#, all_headers=True)
Beispiel #6
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''
struct foo
{
        int a;
        int b;
        int c;
};
'''
        libraries = None
        self.module, output = ctypesgentest.test(header_str)
Beispiel #7
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''
#include <stdbool.h>

struct foo
{
    bool is_bar;
    int a;
};
'''
        self.module, _ = ctypesgentest.test(header_str)  #, all_headers=True)
Beispiel #8
0
 def setUp(self):
     """NOTE this is called once for each test* method
     (it is not called once per class).
     FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
     """
     header_str = '#include <stdlib.h>\n'
     if sys.platform == "win32":
         # pick something from %windir%\system32\msvc*dll that include stdlib
         libraries = ["msvcrt.dll"]
         libraries = ["msvcrt"]
     elif sys.platform.startswith("linux"):
         libraries = ["libc.so.6"]
     else:
         libraries = ["libc"]
     self.module, output = ctypesgentest.test(header_str, libraries=libraries, all_headers=True)
Beispiel #9
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''
#define A 1
#define B(x,y) x+y
#define C(a,b,c) a?b:c
#define funny(x) "funny" #x
#define multipler_macro(x,y) x*y
#define minus_macro(x,y) x-y
#define divide_macro(x,y) x/y
#define mod_macro(x,y) x%y
'''
        libraries = None
        self.module, output = ctypesgentest.test(header_str)
Beispiel #10
0
    def setUp(self):
        """NOTE this is called once for each test* method
        (it is not called once per class).
        FIXME This is slightly inefficient as it is called *way* more times than it needs to be.
        """
        header_str = '''
#define A 1
#define B(x,y) x+y
#define C(a,b,c) a?b:c
#define funny(x) "funny" #x
#define multipler_macro(x,y) x*y
#define minus_macro(x,y) x-y
#define divide_macro(x,y) x/y
#define mod_macro(x,y) x%y
'''
        libraries = None
        self.module, output = ctypesgentest.test(header_str)