def test_write_read_with_offset(self): first_loop, _ = make_horizontal_loop_with_init("field") second_loop, _, _ = make_horizontal_loop_with_copy( "out", "field", True) stencil = make_vertical_loop([first_loop, second_loop]) result = _find_merge_candidates(stencil) assert len(result) == 0
def test_vertex_edge_vertex(self): first_loop = make_empty_horizontal_loop(common.LocationType.Vertex) second_loop = make_empty_horizontal_loop(common.LocationType.Edge) third_loop = make_empty_horizontal_loop(common.LocationType.Vertex) stencil = make_vertical_loop([first_loop, second_loop, third_loop]) result = _find_merge_candidates(stencil) assert len(result) == 0
def test_same_location(self): first_loop = make_empty_horizontal_loop(common.LocationType.Vertex) second_loop = make_empty_horizontal_loop(common.LocationType.Vertex) stencil = make_vertical_loop([first_loop, second_loop]) result = _find_merge_candidates(stencil) assert len(result) == 1 assert result[0][0] == first_loop assert result[0][1] == second_loop
def test_write_read_no_offset_write_read_with_offset(self): first_loop, _ = make_horizontal_loop_with_init("field") second_loop, _, _ = make_horizontal_loop_with_copy( "field2", "field", False) third_loop, _, _ = make_horizontal_loop_with_copy( "out", "field2", True) stencil = make_vertical_loop([first_loop, second_loop, third_loop]) result = _find_merge_candidates(stencil) assert len(result) == 1 assert len(result[0]) == 2 assert result[0][0] == first_loop assert result[0][1] == second_loop
def test_2_sets_of_location(self): first_loop = make_empty_horizontal_loop(common.LocationType.Vertex) second_loop = make_empty_horizontal_loop(common.LocationType.Vertex) third_loop = make_empty_horizontal_loop(common.LocationType.Edge) fourth_loop = make_empty_horizontal_loop(common.LocationType.Edge) stencil = make_vertical_loop( [first_loop, second_loop, third_loop, fourth_loop]) result = _find_merge_candidates(stencil) assert len(result) == 2 assert len(result[0]) == 2 assert result[0][0] == first_loop assert result[0][1] == second_loop assert len(result[1]) == 2 assert result[1][0] == third_loop assert result[1][1] == fourth_loop