summaryrefslogtreecommitdiff
path: root/gerber/tests/test_layers.py
blob: c77084d6cf693f73fe9d1a5bf2819bd16dbd090a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Author: Hamilton Kibbe <ham@hamiltonkib.be>

from .tests import *
from ..layers import guess_layer_class, hints


def test_guess_layer_class():
    """ Test layer type inferred correctly from filename
    """

    # Add any specific test cases here (filename, layer_class)
    test_vectors = [(None, 'unknown'), ('NCDRILL.TXT', 'unknown'),
                    ('example_board.gtl', 'top'),
                    ('exampmle_board.sst', 'topsilk'),
                    ('ipc-d-356.ipc', 'ipc_netlist'),]

    for hint in hints:
        for ext in hint.ext:
            assert_equal(hint.layer, guess_layer_class('board.{}'.format(ext)))
        for name in hint.name:
            assert_equal(hint.layer, guess_layer_class('{}.pho'.format(name)))

    for filename, layer_class in test_vectors:
        assert_equal(layer_class, guess_layer_class(filename))


def test_sort_layers():
    """ Test layer ordering
    """
    pass