add some graph tests (#3702)

* add some graph tests

* PatternMatcher class

* speedup

* const cast test

* fix tests

* itertools chain
This commit is contained in:
George Hotz
2024-03-12 09:49:47 -07:00
committed by GitHub
parent f599c6e7f4
commit 2024b24f35
3 changed files with 76 additions and 16 deletions

View File

@@ -156,6 +156,11 @@ class TestExecALU(TestUOps):
self.assertEqual(exec_alu(BinaryOps.CMPLT, dtypes.bool, (True, False)), False)
self.assertEqual(exec_alu(BinaryOps.CMPLT, dtypes.bool, (True, True)), False)
def test_bool_where(self):
self.assertIs(exec_alu(TernaryOps.WHERE, dtypes.bool, (False, False, False)), False)
self.assertIs(exec_alu(TernaryOps.WHERE, dtypes.int, (False, 2, 4)), 4)
self.assertIs(exec_alu(TernaryOps.WHERE, dtypes.float, (False, 2.2, 4.5)), 4.5)
def test_overflow(self):
self.assertEqual(exec_alu(BinaryOps.ADD, dtypes.uint8, (250, 250)), 244)
self.assertEqual(exec_alu(BinaryOps.ADD, dtypes.uint8, (256, 0)), 0)