[pypy-commit] cffi cffi-1.0: A test to verify that cffi_opcopde.py and parse_c_type.h contain the same thing

arigo noreply at buildbot.pypy.org
Wed Apr 15 19:25:36 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1717:b4c788fecdc9
Date: 2015-04-15 19:26 +0200
http://bitbucket.org/cffi/cffi/changeset/b4c788fecdc9/

Log:	A test to verify that cffi_opcopde.py and parse_c_type.h contain the
	same thing

diff --git a/new/cffi_opcode.py b/new/cffi_opcode.py
--- a/new/cffi_opcode.py
+++ b/new/cffi_opcode.py
@@ -24,9 +24,10 @@
 OP_FUNCTION_END    = 17
 OP_NOOP            = 19
 OP_BITFIELD        = 21
-OP_CPYTHON_BLTN_V  = 23   # varargs
-OP_CPYTHON_BLTN_N  = 25   # noargs
-OP_CPYTHON_BLTN_O  = 27   # O  (i.e. a single arg)
+OP_INTEGER_CONST   = 23
+OP_CPYTHON_BLTN_V  = 25   # varargs
+OP_CPYTHON_BLTN_N  = 27   # noargs
+OP_CPYTHON_BLTN_O  = 29   # O  (i.e. a single arg)
 
 PRIM_VOID          = 0
 PRIM_BOOL          = 1
@@ -44,6 +45,7 @@
 PRIM_FLOAT         = 13
 PRIM_DOUBLE        = 14
 PRIM_LONGDOUBLE    = 15
+_NUM_PRIM          = 16
 
 PRIMITIVE_TO_INDEX = {
     'int':    PRIM_INT,
diff --git a/new/parse_c_type.h b/new/parse_c_type.h
--- a/new/parse_c_type.h
+++ b/new/parse_c_type.h
@@ -18,9 +18,10 @@
 #define _CFFI_OP_FUNCTION_END   17
 #define _CFFI_OP_NOOP           19
 #define _CFFI_OP_BITFIELD       21
-#define _CFFI_OP_CPYTHON_BLTN_V 23   // varargs
-#define _CFFI_OP_CPYTHON_BLTN_N 25   // noargs
-#define _CFFI_OP_CPYTHON_BLTN_O 27   // O  (i.e. a single arg)
+#define _CFFI_OP_INTEGER_CONST  23
+#define _CFFI_OP_CPYTHON_BLTN_V 25   // varargs
+#define _CFFI_OP_CPYTHON_BLTN_N 27   // noargs
+#define _CFFI_OP_CPYTHON_BLTN_O 29   // O  (i.e. a single arg)
 
 #define _CFFI_PRIM_VOID          0
 #define _CFFI_PRIM_BOOL          1
diff --git a/new/test_parse_c_type.py b/new/test_parse_c_type.py
--- a/new/test_parse_c_type.py
+++ b/new/test_parse_c_type.py
@@ -242,3 +242,9 @@
         assert parse("%s" % (identifier_names[i])) == ['->', Typename(i)]
         assert parse("%s*" % (identifier_names[i])) == [Typename(i),
                                                         '->', Pointer(0)]
+
+def test_cffi_opcode_sync():
+    import cffi_opcode
+    for name in dir(lib):
+        if name.startswith('_CFFI_'):
+            assert getattr(cffi_opcode, name[6:]) == getattr(lib, name)


More information about the pypy-commit mailing list