Skip to content

Commit

Permalink
Lattice indexing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aryavorskiy committed Mar 12, 2024
1 parent e2a943c commit 4999135
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions test/test_lattice.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@testset "Lattice" begin
@testset "Interface" begin
sql = SquareLattice(10, 20)
@test [site_index(sql, s) for s in sql] == 1:length(sql)
x, y = coordvalues(sql)
s_0 = SquareLattice(10, 20) do (x, y)
x < y
Expand Down Expand Up @@ -51,15 +50,16 @@
@test gl1 == gl2
end

circle_l = TriangularLattice(-10:10, -10:10) do site
x, y = site
return x^2 + y^2 50 && (abs(x) > 3 || abs(y) > 3)
end

@testset "Creation" begin
sl = SquareLattice(-1:1, -1:1)
sl2 = SquareLattice{2}(Square(h = 1))
@test LatticeModels.stripparams(sl) == LatticeModels.stripparams(sl2)

circle_l = TriangularLattice(-10:10, -10:10) do site
return site.coords[1]^2 + site.coords[2]^2 50 &&
(abs(site.coords[1]) > 3 || abs(site.coords[2]) > 3)
end
circle_l2 = TriangularLattice(Circle(50), !Square(h = 3))
@test LatticeModels.stripparams(circle_l) == LatticeModels.stripparams(circle_l2)

Expand All @@ -76,6 +76,14 @@
@test_throws ArgumentError SquareLattice(Circle(10))
end

@testset "Indexing" begin
circle_lt = addlookuptable(circle_l)
for (i, site) in enumerate(circle_l)
@test site_index(circle_l, site) == i
@test site_index(circle_lt, site) == i
end
end

l = SquareLattice(10, 10)
x, y = coordvalues(l)
xm2 = LatticeValue(l) do (x, y)
Expand Down

0 comments on commit 4999135

Please sign in to comment.