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:
return self.a
def get_b(self) -> B:
return self.b
# def get_b(self) -> B:
# return self.b
def run() -> int32:

View File

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