Skip to content

Commit

Permalink
TEST: Update tests to use just i32()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed May 4, 2023
1 parent 2bea899 commit 4c28bc9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions integration_tests/elemental_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def elemental_sqrt64():
shape[0] = 4096
observed = reshape(sqrt(array), shape)
for l in range(4096):
i = i32(int(l/256))
i = i32(l/256)
j = (l - i*256)//16
k = (l - i*256 - j*16)
assert abs(observed[l]**2.0 - f64(i + j + k)) <= eps
Expand All @@ -42,7 +42,7 @@ def elemental_sqrt32():
shape[0] = 256
observed = reshape(sqrt(array), shape)
for l in range(256):
i = i32(int(l/16))
i = i32(l/16)
j = (l - i*16)
assert abs(observed[l]**f32(2.0) - f32(i + j)) <= eps

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/elemental_04.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def verify(observed: f32[:], base: i32, eps: f32):
j: i32

for k in range(100):
i = i32(int(k/10))
i = i32(k/10)
j = (k - i*10)
assert abs(f32(base)**(observed[k]) - f32(i + j + 1)) <= eps

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/global_syms_04.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def test_global_symbols():
def update_global_symbols():
global b, c, d
x: f64 = f64(c) * d
b = i32(int(x))
b = i32(x)
y: f64 = f64(b) / 12.0
c = i64(int(y))
c = i64(y)
z: i64 = i64(b) * c
d = f64(z)

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/lpdraw/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def Line(H: i32, W: i32, Screen: i32[H, W], x1: i32, y1: i32, x2: i32, y2: i32)
y1 += sy

def Circle(H: i32, W: i32, Screen: i32[H, W], x: i32, y: i32, r: f64) -> None:
x0: i32 = i32(int(r))
x0: i32 = i32(r)
y0: i32 = 0
err: i32 = 0

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_numpy_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_nd_to_1d(a: f64[:, :]):
newshape1[0] = 4096
d = reshape(c, newshape1)
for l in range(4096):
i = i32(int(l/256))
i = i32(l/256)
j = (l - i*256)//16
k = (l - i*256 - j*16)
assert abs(d[l] - f64(i + j + k) - 0.5) <= eps
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_reshape_with_argument():

d: f64[4096] = empty(4096)
for l in range(4096):
i = i32(int(l/256))
i = i32(l/256)
j = (l - i*256)//16
k = (l - i*256 - j*16)
d[l] = f64(i + j + k) + 0.5
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/test_pkg_lnn_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def plot_graph(p: Perceptron, input_vectors: list[list[f64]], outputs: list[i32]
y2 *= scale_offset

# print (x1, y1, x2, y2)
Line(Height, Width, Screen, i32(int(x1 + shift_offset)), i32(int(y1 + shift_offset)), i32(int(x2 + shift_offset)), i32(int(y2 + shift_offset)))
Line(Height, Width, Screen, i32(x1 + shift_offset), i32(y1 + shift_offset), i32(x2 + shift_offset), i32(y2 + shift_offset))

i: i32
point_size: i32 = 5
Expand All @@ -41,12 +41,12 @@ def plot_graph(p: Perceptron, input_vectors: list[list[f64]], outputs: list[i32]
input_vectors[i][0] += shift_offset
input_vectors[i][1] += shift_offset
if outputs[i] == 1:
x: i32 = i32(int(input_vectors[i][0]))
y: i32 = i32(int(input_vectors[i][1]))
x: i32 = i32(input_vectors[i][0])
y: i32 = i32(input_vectors[i][1])
Line(Height, Width, Screen, x - point_size, y, x + point_size, y)
Line(Height, Width, Screen, x, y - point_size, x, y + point_size)
else:
Circle(Height, Width, Screen, i32(int(input_vectors[i][0])), i32(int(input_vectors[i][1])), f64(point_size))
Circle(Height, Width, Screen, i32(input_vectors[i][0]), i32(input_vectors[i][1]), f64(point_size))

Display(Height, Width, Screen)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_pkg_lnn_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def plot_graph(p: Perceptron, input_vectors: list[list[f64]], outputs: list[f64]
y2 *= scale_offset

# print (x1, y1, x2, y2)
Line(Height, Width, Screen, i32(int(x1 + shift_offset)), i32(int(y1 + shift_offset)), i32(int(x2 + shift_offset)), i32(int(y2 + shift_offset)))
Line(Height, Width, Screen, i32(x1 + shift_offset), i32(y1 + shift_offset), i32(x2 + shift_offset), i32(y2 + shift_offset))

i: i32
point_size: i32 = 5
Expand All @@ -41,7 +41,7 @@ def plot_graph(p: Perceptron, input_vectors: list[list[f64]], outputs: list[f64]
outputs[i] *= scale_offset
outputs[i] += shift_offset

Circle(Height, Width, Screen, i32(int(input_vectors[i][0])), i32(int(outputs[i])), f64(point_size))
Circle(Height, Width, Screen, i32(input_vectors[i][0]), i32(outputs[i]), f64(point_size))

Display(Height, Width, Screen)

Expand Down

0 comments on commit 4c28bc9

Please sign in to comment.