Skip to content

Commit d9f8bc7

Browse files
committed
format tests
1 parent 9926813 commit d9f8bc7

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

test/control_flow.jl

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -718,28 +718,28 @@ function call1(a, b)
718718
end
719719

720720
if !Reactant.TRACE_CALLS[]
721-
@testset "call: basic" begin
722-
a = rand(2, 3)
723-
b = rand(2, 3)
724-
a_ra = Reactant.to_rarray(a)
725-
b_ra = Reactant.to_rarray(b)
721+
@testset "call: basic" begin
722+
a = rand(2, 3)
723+
b = rand(2, 3)
724+
a_ra = Reactant.to_rarray(a)
725+
b_ra = Reactant.to_rarray(b)
726726

727-
@test @jit(call1(a_ra, b_ra)) call1(a, b)
727+
@test @jit(call1(a_ra, b_ra)) call1(a, b)
728728

729-
# check whether the func for _call1 was only generated once:
730-
ir = @code_hlo optimize = false call1(a_ra, b_ra)
731-
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
732-
@test length(ops) == 2 # call1, _call1
729+
# check whether the func for _call1 was only generated once:
730+
ir = @code_hlo optimize = false call1(a_ra, b_ra)
731+
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
732+
@test length(ops) == 2 # call1, _call1
733733

734-
# With different operand sizes, different functions need to be generated:
735-
c = rand(4, 5)
736-
c_ra = Reactant.to_rarray(c)
734+
# With different operand sizes, different functions need to be generated:
735+
c = rand(4, 5)
736+
c_ra = Reactant.to_rarray(c)
737737

738-
@test @jit(call1(a_ra, c_ra)) call1(a, c)
739-
ir = @code_hlo optimize = false call1(a_ra, c_ra)
740-
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
741-
@test length(ops) == 3
742-
end
738+
@test @jit(call1(a_ra, c_ra)) call1(a, c)
739+
ir = @code_hlo optimize = false call1(a_ra, c_ra)
740+
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
741+
@test length(ops) == 3
742+
end
743743
end
744744

745745
_call2(a) = a + a
@@ -769,14 +769,14 @@ function call3(y)
769769
end
770770

771771
if !Reactant.TRACE_CALLS[]
772-
@testset "call: caching for Julia operands" begin
773-
y = rand(3)
774-
y_ra = Reactant.to_rarray(y)
772+
@testset "call: caching for Julia operands" begin
773+
y = rand(3)
774+
y_ra = Reactant.to_rarray(y)
775775

776-
ir = @code_hlo optimize = false call3(y_ra)
777-
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
778-
@test length(ops) == 5 # call3, .+, .*, _call3 (2X)
779-
end
776+
ir = @code_hlo optimize = false call3(y_ra)
777+
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
778+
@test length(ops) == 5 # call3, .+, .*, _call3 (2X)
779+
end
780780
end
781781

782782
struct Foo
@@ -794,16 +794,16 @@ function call4(foo, foo2, bar)
794794
end
795795

796796
if !Reactant.TRACE_CALLS[]
797-
@testset "call: Caching struct arguments" begin
798-
a = rand(10)
799-
b = rand(10)
800-
foo = Foo(Reactant.to_rarray(a))
801-
foo2 = Foo(Reactant.to_rarray(b))
802-
bar = Foo(Bar(Reactant.to_rarray(b))) # typeof(foo) == typeof(bar), but these don't match!
803-
ir = @code_hlo optimize = false call4(foo, foo2, bar)
804-
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
805-
@test length(ops) == 3 # call4, _call4 for {foo, foo2}, and _call4 for bar
806-
end
797+
@testset "call: Caching struct arguments" begin
798+
a = rand(10)
799+
b = rand(10)
800+
foo = Foo(Reactant.to_rarray(a))
801+
foo2 = Foo(Reactant.to_rarray(b))
802+
bar = Foo(Bar(Reactant.to_rarray(b))) # typeof(foo) == typeof(bar), but these don't match!
803+
ir = @code_hlo optimize = false call4(foo, foo2, bar)
804+
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
805+
@test length(ops) == 3 # call4, _call4 for {foo, foo2}, and _call4 for bar
806+
end
807807
end
808808

809809
function _call5!(a, b)

0 commit comments

Comments
 (0)