summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 8bf4de7..f427a49 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -6070,12 +6070,35 @@ settrace_to_record(PyObject *self, PyObject *list)
Py_RETURN_NONE;
}
+
static PyObject *
test_macros(PyObject *self, PyObject *Py_UNUSED(args))
{
- // Py_MIN(), Py_MAX()
+ struct MyStruct {
+ int x;
+ };
+ wchar_t array[3];
+
+ // static_assert(), Py_BUILD_ASSERT()
+ static_assert(1 == 1, "bug");
+ Py_BUILD_ASSERT(1 == 1);
+
+
+ // Py_MIN(), Py_MAX(), Py_ABS()
assert(Py_MIN(5, 11) == 5);
assert(Py_MAX(5, 11) == 11);
+ assert(Py_ABS(-5) == 5);
+
+ // Py_STRINGIFY()
+ assert(strcmp(Py_STRINGIFY(123), "123") == 0);
+
+ // Py_MEMBER_SIZE(), Py_ARRAY_LENGTH()
+ assert(Py_MEMBER_SIZE(struct MyStruct, x) == sizeof(int));
+ assert(Py_ARRAY_LENGTH(array) == 3);
+
+ // Py_CHARMASK()
+ int c = 0xab00 | 7;
+ assert(Py_CHARMASK(c) == 7);
// _Py_IS_TYPE_SIGNED()
assert(_Py_IS_TYPE_SIGNED(int));
@@ -6084,6 +6107,7 @@ test_macros(PyObject *self, PyObject *Py_UNUSED(args))
Py_RETURN_NONE;
}
+
static PyObject *negative_dictoffset(PyObject *, PyObject *);
static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *);
static PyObject *getargs_s_hash_int(PyObject *, PyObject *, PyObject*);