Skip to content

Commit 50803e7

Browse files
committed
Add basic test for tuple symbols
1 parent e82764d commit 50803e7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Python/optimizer_symbols.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,19 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
682682
sym = _Py_uop_sym_new_const(ctx, PyLong_FromLong(0));
683683
TEST_PREDICATE(_Py_uop_sym_truthiness(sym) == 0, "bool(0) is not False");
684684

685+
JitOptSymbol *i1 = _Py_uop_sym_new_type(ctx, &PyFloat_Type);
686+
JitOptSymbol *i2 = _Py_uop_sym_new_const(ctx, val_43);
687+
JitOptSymbol *array[2] = { i1, i2 };
688+
sym = _Py_uop_sym_new_tuple(ctx, 2, array);
689+
TEST_PREDICATE(
690+
_Py_uop_sym_matches_type(_Py_uop_sym_tuple_getitem(ctx, sym, 0), &PyFloat_Type),
691+
"tuple item does not match value used to create tuple"
692+
);
693+
TEST_PREDICATE(
694+
_Py_uop_sym_get_const(_Py_uop_sym_tuple_getitem(ctx, sym, 1)) == val_43,
695+
"tuple item does not match value used to create tuple"
696+
);
697+
685698
_Py_uop_abstractcontext_fini(ctx);
686699
Py_DECREF(val_42);
687700
Py_DECREF(val_43);

0 commit comments

Comments
 (0)