# Path: geomdl/compatibility.py
# def flip_ctrlpts_u(ctrlpts, size_u, size_v):
# def flip_ctrlpts(ctrlpts, size_u, size_v):
# def flip_ctrlpts2d(ctrlpts2d, size_u=0, size_v=0):
# def generate_ctrlptsw(ctrlpts):
# def generate_ctrlptsw2d(ctrlpts2d):
# def generate_ctrlpts_weights(ctrlpts):
# def generate_ctrlpts2d_weights(ctrlpts2d):
# def combine_ctrlpts_weights(ctrlpts, weights=None):
# def separate_ctrlpts_weights(ctrlptsw):
# def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
# def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'):
# def generate_ctrlpts2d_weights_file(file_in='', file_out='ctrlpts_weights.txt'):
# def _read_ctrltps2d_file(file_in):
# def _save_ctrlpts2d_file(ctrlpts2d, size_u, size_v, file_out):


from geomdl import compatibility
    size_v = 4

    # the following is in v-order
    ctrlpts = [[0, 0, 0], [0, 1, 0], [0, 2, -3], [0, 3, 7],
               [1, 0, 6], [1, 1, 0], [1, 2, 0], [1, 3, 8],
               [2, 0, 0], [2, 1, 0], [2, 2, 3], [1, 3, 7]]

    # the following is in u-order
    result = [[0, 0, 0], [1, 0, 6], [2, 0, 0],
              [0, 1, 0], [1, 1, 0], [2, 1, 0],
              [0, 2, -3], [1, 2, 0], [2, 2, 3],
              [0, 3, 7], [1, 3, 8], [1, 3, 7]]

    check = compatibility.flip_ctrlpts(ctrlpts, size_u, size_v)

    assert check == result


def test_flip_ctrlpts2d():
    # the following is in v-order
    ctrlpts = [[[0, 0, 0], [0, 1, 0], [0, 2, -3], [0, 3, 7]],
               [[1, 0, 6], [1, 1, 0], [1, 2, 0], [1, 3, 8]],
               [[2, 0, 0], [2, 1, 0], [2, 2, 3], [1, 3, 7]]]

    # the following is in u-order
    result = [[[0, 0, 0], [1, 0, 6], [2, 0, 0]],
              [[0, 1, 0], [1, 1, 0], [2, 1, 0]],
              [[0, 2, -3], [1, 2, 0], [2, 2, 3]],
              [[0, 3, 7], [1, 3, 8], [1, 3, 7]]]


# Path: geomdl/compatibility.py
# def flip_ctrlpts_u(ctrlpts, size_u, size_v):
# def flip_ctrlpts(ctrlpts, size_u, size_v):
# def flip_ctrlpts2d(ctrlpts2d, size_u=0, size_v=0):
# def generate_ctrlptsw(ctrlpts):
# def generate_ctrlptsw2d(ctrlpts2d):
# def generate_ctrlpts_weights(ctrlpts):
# def generate_ctrlpts2d_weights(ctrlpts2d):
# def combine_ctrlpts_weights(ctrlpts, weights=None):
# def separate_ctrlpts_weights(ctrlptsw):
# def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
# def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'):
# def generate_ctrlpts2d_weights_file(file_in='', file_out='ctrlpts_weights.txt'):
# def _read_ctrltps2d_file(file_in):
# def _save_ctrlpts2d_file(ctrlpts2d, size_u, size_v, file_out):


# Path: tests/test_compatibility.py
from geomdl import compatibility

    size_v = 4

    # the following is in v-order
    ctrlpts = [[0, 0, 0], [0, 1, 0], [0, 2, -3], [0, 3, 7],
               [1, 0, 6], [1, 1, 0], [1, 2, 0], [1, 3, 8],
               [2, 0, 0], [2, 1, 0], [2, 2, 3], [1, 3, 7]]

    # the following is in u-order
    result = [[0, 0, 0], [1, 0, 6], [2, 0, 0],
              [0, 1, 0], [1, 1, 0], [2, 1, 0],
              [0, 2, -3], [1, 2, 0], [2, 2, 3],
              [0, 3, 7], [1, 3, 8], [1, 3, 7]]

    check = compatibility.flip_ctrlpts(ctrlpts, size_u, size_v)

    assert check == result


def test_flip_ctrlpts2d():
    # the following is in v-order
    ctrlpts = [[[0, 0, 0], [0, 1, 0], [0, 2, -3], [0, 3, 7]],
               [[1, 0, 6], [1, 1, 0], [1, 2, 0], [1, 3, 8]],
               [[2, 0, 0], [2, 1, 0], [2, 2, 3], [1, 3, 7]]]

    # the following is in u-order
    result = [[[0, 0, 0], [1, 0, 6], [2, 0, 0]],
              [[0, 1, 0], [1, 1, 0], [2, 1, 0]],
              [[0, 2, -3], [1, 2, 0], [2, 2, 3]],
              [[0, 3, 7], [1, 3, 8], [1, 3, 7]]]


    check = compatibility.flip_ctrlpts2d(ctrlpts)