Skip to content

Commit

Permalink
Test inconsistent dimensions in TensorNetwork constructor and push! m…
Browse files Browse the repository at this point in the history
…ethods
  • Loading branch information
jofrevalles committed Jul 12, 2023
1 parent 71506a5 commit 71365d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/TensorNetwork_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
@test size(tn) == Dict(:i => 2, :j => 3)
@test issetequal(labels(tn, :open), [:i, :j])
@test isempty(labels(tn, :hyper))

tensor1 = Tensor(zeros(2, 2), (:i, :j))
tensor2 = Tensor(zeros(3, 3), (:j, :k))
@test_throws DimensionMismatch tn = TensorNetwork([tensor1, tensor2])
end
end

Expand All @@ -32,6 +36,8 @@
@test size(tn) == Dict(:i => 2, :j => 2, :k => 2)
@test issetequal(labels(tn, :open), [:i, :j, :k])
@test isempty(labels(tn, :hyper))

@test_throws DimensionMismatch push!(tn, Tensor(zeros(3, 3), (:i, :j)))
end

@test_throws Exception begin
Expand Down

0 comments on commit 71365d9

Please sign in to comment.