# Path: picwriter/toolkit.py
# TOL = 1e-6
# CURRENT_CELLS = {}
# CURRENT_CELL_NAMES = {}
#     CURRENT_CELLS = {}
#     CURRENT_CELL_NAMES = {}
# def add(top_cell, component_cell, center=(0, 0), x_reflection=False):
# def reset_database():
# def getCellName(name):
# def build_mask(cell, wgt, final_layer=None, final_datatype=None):
# def get_trace_length(trace, wgt):
# def get_keys(cell):
# def get_angle(pt1, pt2):
# def get_exact_angle(pt1, pt2):
# def dist(pt1, pt2):
# def get_direction(pt1, pt2):
# def get_turn(dir1, dir2):
# def flip_direction(direction):
# def translate_point(pt, length, direction, height=0.0):
# def normalize_angle(angle):
# def get_curve_length(func, start, end, grid=0.001):
#     def get_cur_length(pt_list):
# def build_waveguide_polygon(
#     func, wg_width, start_direction, end_direction, start_val=0, end_val=1, grid=0.001
# ):
#     def get_path_points(
#         func, wg_width, num_pts, start_direction, end_direction, start_val=0, end_val=1
#     ):
#     def check_path(path, grid):
#     def __init__(self, name, *args):
#     def _auto_transform_(self):
#     def _hash_cell_(self, *args):
#     def __get_cell(self):
#     def __direction_to_rotation(self, direction):
#     def add(self, element, origin=(0, 0), rotation=0.0, x_reflection=False):
#     def addto(self, top_cell, x_reflection=False):
# class Component:


from unittest import TestCase
from picwriter.components import *
from picwriter import toolkit as tk
import gdspy
import numpy as np
        import numpy as np
# -*- coding: utf-8 -*-
"""
@author: DerekK88
"""
from __future__ import absolute_import, division, print_function, unicode_literals



""" Test cases below for each component type in the library.  Checks creation and size. """


class TestPICwriter(TestCase):
    global AREA_TOL
    AREA_TOL = 1e-1  # Some variation is expected when small updates occur to library

    def test_waveguide_creation(self):
        top = gdspy.Cell("t1")
        wgt = WaveguideTemplate(bend_radius=50, resist="+", fab="LIFTOFF")
        wg1 = Waveguide([(50, 0), (250, 0), (250, 500), (500, 500)], wgt)
        wg2 = Waveguide([(0, 0), (0, 100), (-250, 100), (-250, -100)], wgt)

# Path: picwriter/toolkit.py
# TOL = 1e-6
# CURRENT_CELLS = {}
# CURRENT_CELL_NAMES = {}
#     CURRENT_CELLS = {}
#     CURRENT_CELL_NAMES = {}
# def add(top_cell, component_cell, center=(0, 0), x_reflection=False):
# def reset_database():
# def getCellName(name):
# def build_mask(cell, wgt, final_layer=None, final_datatype=None):
# def get_trace_length(trace, wgt):
# def get_keys(cell):
# def get_angle(pt1, pt2):
# def get_exact_angle(pt1, pt2):
# def dist(pt1, pt2):
# def get_direction(pt1, pt2):
# def get_turn(dir1, dir2):
# def flip_direction(direction):
# def translate_point(pt, length, direction, height=0.0):
# def normalize_angle(angle):
# def get_curve_length(func, start, end, grid=0.001):
#     def get_cur_length(pt_list):
# def build_waveguide_polygon(
#     func, wg_width, start_direction, end_direction, start_val=0, end_val=1, grid=0.001
# ):
#     def get_path_points(
#         func, wg_width, num_pts, start_direction, end_direction, start_val=0, end_val=1
#     ):
#     def check_path(path, grid):
#     def __init__(self, name, *args):
#     def _auto_transform_(self):
#     def _hash_cell_(self, *args):
#     def __get_cell(self):
#     def __direction_to_rotation(self, direction):
#     def add(self, element, origin=(0, 0), rotation=0.0, x_reflection=False):
#     def addto(self, top_cell, x_reflection=False):
# class Component:


# Path: picwriter/tests/test_picwriter.py
from unittest import TestCase
from picwriter.components import *
from picwriter import toolkit as tk
import gdspy
import numpy as np
        import numpy as np

# -*- coding: utf-8 -*-
"""
@author: DerekK88
"""
from __future__ import absolute_import, division, print_function, unicode_literals



""" Test cases below for each component type in the library.  Checks creation and size. """


class TestPICwriter(TestCase):
    global AREA_TOL
    AREA_TOL = 1e-1  # Some variation is expected when small updates occur to library

    def test_waveguide_creation(self):
        top = gdspy.Cell("t1")
        wgt = WaveguideTemplate(bend_radius=50, resist="+", fab="LIFTOFF")
        wg1 = Waveguide([(50, 0), (250, 0), (250, 500), (500, 500)], wgt)
        wg2 = Waveguide([(0, 0), (0, 100), (-250, 100), (-250, -100)], wgt)

        tk.add(top, wg1)