You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
1.6 KiB

# class defs
class A_CLASS(object):
a_class_i:int = 0
def __init__(self:"A_CLASS", x:int):
self.x = x
def add(self:"A_CLASS", y:int) -> int:
y = y+self.x
return y
class B_CLASS(object):
b_class_i:int = 0
class C_CLASS(B_CLASS):
pass
# var defs
a_s:str = "a_s"
b_s:str = "b_s"
c_s:str = "c_s"
a_i:int = 0
b_i:int = 0
c_i:int = 0
a_b:bool = False
b_b:bool = False
c_b:bool = False
a_list:[int] = None
b_list:[int] = None
c_list:[int] = None
a_class:A_CLASS = None
b_class:B_CLASS = None
c_class:C_CLASS = None
# fun defs
def f_1() -> object:
def f_f_1() -> object:
global a_s
print(a_s)
pass
pass
def f_2() -> object:
f_a_s:str = "s"
def f_f_2() -> object:
nonlocal f_a_s
print(f_a_s)
pass
pass
def f_3(x:int) -> int:
f_b_s:int = 3
return x*f_b_s
# Declarations
a_list = [1, 2, 3]
b_list = [0, 0, 0]
c_list = [-1, -2, -3]
a_class = A_CLASS(5)
b_class = B_CLASS()
c_class = C_CLASS()
# POSITIVE TEST CASES
#-------------------
# String operations
# String addition and assignment operations
a_s = a_s + b_s
print(a_s)
# Assigning to a string with string indexing operation
c_s = a_s[0]
print(c_s)
# --------------------
# Boolean operations
a_b = a_i == b_i and not b_b
print(a_b)
# --------------------
# List operations
a_list = a_list + b_list
c_i = a_list[0]
a_list[1] = 2
# --------------------
# function operations
a_i = f_3(3) + 5
f_1()
f_2()
# --------------------
# class operations
a_i = a_class.add(2)
print(a_i)
a_i = a_class.add(c_class.b_class_i)
print(a_i)