Skip to content

Commit

Permalink
Fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chenspc committed Jan 6, 2020
1 parent 2f1dbbc commit c86dd17
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
3 changes: 3 additions & 0 deletions src/defects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ function find_defect(graphene, type::String)
elseif type == "Butterfly" || type == "V2(5555-6-7777)"
defects = [defects; find_butterfly(graphene)]
end
for i in 1:length(defects)
defects[i]._id = id_offset+i
end
return defects
end

Expand Down
38 changes: 19 additions & 19 deletions test/test_defects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ map(x -> make_signature!(x, test_noa_dict), test_graphene)
end

test_defect_image = import_stack("test_files/test_defect_bw.h5")
test_graphene = make_graphene(centroid2xy(make_centroids(test_defect_image)), max_bondlength=20)
test_graphene = make_graphene(centroid2xy(make_centroids(test_defect_image)), max_bondlength=10)

test_flower = first(find_defect(test_graphene, "Flower"))
test_divacancy = first(find_defect(test_graphene, "Divacancy"))
Expand All @@ -263,6 +263,24 @@ test_defects[5]._id = length(test_graphene) + 1
@test test_defects[4] == test_stonewales
@test test_defects[5] == test_5775

@testset "Stone-Wales" begin
@test get_id(test_stonewales) == length(test_graphene) + 1
@test get_frame(test_stonewales) == 0
@test get_dataset(test_stonewales) == "dataset"
@test get_noa(test_stonewales) == 16
@test length(get_members(test_stonewales)) == 39
@test get_type(test_stonewales) == "Stone-Wales"
end

@testset "5775" begin
@test get_id(test_5775) == length(test_graphene) + 1
@test get_frame(test_5775) == 0
@test get_dataset(test_5775) == "dataset"
@test get_noa(test_5775) == 18
@test length(get_members(test_5775)) == 43
@test get_type(test_5775) == "5775"
end

@testset "Flower" begin
@test get_id(test_flower) == length(test_graphene) + 1
@test get_frame(test_flower) == 0
Expand All @@ -289,21 +307,3 @@ end
@test length(get_members(test_butterfly)) == 77
@test get_type(test_butterfly) == "Butterfly"
end

@testset "Stone-Wales" begin
@test get_id(test_stonewales) == length(test_graphene) + 1
@test get_frame(test_stonewales) == 0
@test get_dataset(test_stonewales) == "dataset"
@test get_noa(test_stonewales) == 16
@test length(get_members(test_stonewales)) == 39
@test get_type(test_stonewales) == "Stone-Wales"
end

@testset "5775" begin
@test get_id(test_5775) == length(test_graphene) + 1
@test get_frame(test_5775) == 0
@test get_dataset(test_5775) == "dataset"
@test get_noa(test_5775) == 18
@test length(get_members(test_5775)) == 43
@test get_type(test_5775) == "5775"
end

0 comments on commit c86dd17

Please sign in to comment.