standalone: Disable tests requiring return of non-primitive values

This commit is contained in:
David Mak 2024-01-29 12:49:50 +08:00
parent b3736c3e99
commit fef4b2a5ce
2 changed files with 93 additions and 92 deletions

View File

@ -23,8 +23,8 @@ class A:
def get_a(self) -> int32: def get_a(self) -> int32:
return self.a return self.a
def get_b(self) -> B: # def get_b(self) -> B:
return self.b # return self.b
def run() -> int32: def run() -> int32:

View File

@ -21,8 +21,8 @@ def run() -> int32:
test_uint32() test_uint32()
test_int64() test_int64()
test_uint64() test_uint64()
test_A() # test_A()
test_B() # test_B()
return 0 return 0
def test_int32(): def test_int32():
@ -173,91 +173,92 @@ def test_uint64():
a >>= uint32(b) a >>= uint32(b)
output_uint64(a) output_uint64(a)
class A: # FIXME Fix returning objects of non-primitive types; Currently this is disabled in the function checker
a: int32 # class A:
def __init__(self, a: int32): # a: int32
self.a = a # def __init__(self, a: int32):
# self.a = a
def __add__(self, other: A) -> A: #
output_int32(self.a + other.a) # def __add__(self, other: A) -> A:
return A(self.a + other.a) # output_int32(self.a + other.a)
# return A(self.a + other.a)
def __sub__(self, other: A) -> A: #
output_int32(self.a - other.a) # def __sub__(self, other: A) -> A:
return A(self.a - other.a) # output_int32(self.a - other.a)
# return A(self.a - other.a)
def test_A(): #
a = A(17) # def test_A():
b = A(3) # a = A(17)
# b = A(3)
c = a + b #
# fail due to alloca in __add__ function # c = a + b
# output_int32(c.a) # # fail due to alloca in __add__ function
# # output_int32(c.a)
a += b #
# fail due to alloca in __add__ function # a += b
# output_int32(a.a) # # fail due to alloca in __add__ function
# # output_int32(a.a)
a = A(17) #
b = A(3) # a = A(17)
d = a - b # b = A(3)
# fail due to alloca in __add__ function # d = a - b
# output_int32(c.a) # # fail due to alloca in __add__ function
# # output_int32(c.a)
a -= b #
# fail due to alloca in __add__ function # a -= b
# output_int32(a.a) # # fail due to alloca in __add__ function
# # output_int32(a.a)
a = A(17) #
b = A(3) # a = A(17)
a.__add__(b) # b = A(3)
a.__sub__(b) # a.__add__(b)
# a.__sub__(b)
#
class B: #
a: int32 # class B:
def __init__(self, a: int32): # a: int32
self.a = a # def __init__(self, a: int32):
# self.a = a
def __add__(self, other: B) -> B: #
output_int32(self.a + other.a) # def __add__(self, other: B) -> B:
return B(self.a + other.a) # output_int32(self.a + other.a)
# return B(self.a + other.a)
def __sub__(self, other: B) -> B: #
output_int32(self.a - other.a) # def __sub__(self, other: B) -> B:
return B(self.a - other.a) # output_int32(self.a - other.a)
# return B(self.a - other.a)
def __iadd__(self, other: B) -> B: #
output_int32(self.a + other.a + 24) # def __iadd__(self, other: B) -> B:
return B(self.a + other.a + 24) # output_int32(self.a + other.a + 24)
# return B(self.a + other.a + 24)
def __isub__(self, other: B) -> B: #
output_int32(self.a - other.a - 24) # def __isub__(self, other: B) -> B:
return B(self.a - other.a - 24) # output_int32(self.a - other.a - 24)
# return B(self.a - other.a - 24)
def test_B(): #
a = B(17) # def test_B():
b = B(3) # a = B(17)
# b = B(3)
c = a + b #
# fail due to alloca in __add__ function # c = a + b
# output_int32(c.a) # # fail due to alloca in __add__ function
# # output_int32(c.a)
a += b #
# fail due to alloca in __add__ function # a += b
# output_int32(a.a) # # fail due to alloca in __add__ function
# # output_int32(a.a)
a = B(17) #
b = B(3) # a = B(17)
d = a - b # b = B(3)
# fail due to alloca in __add__ function # d = a - b
# output_int32(c.a) # # fail due to alloca in __add__ function
# # output_int32(c.a)
a -= b #
# fail due to alloca in __add__ function # a -= b
# output_int32(a.a) # # fail due to alloca in __add__ function
# # output_int32(a.a)
a = B(17) #
b = B(3) # a = B(17)
a.__add__(b) # b = B(3)
a.__sub__(b) # a.__add__(b)
# a.__sub__(b)