Skip to content

Commit

Permalink
Increased test coverage.
Browse files Browse the repository at this point in the history
Merge branch 'master' into develop
Wote simple tests for util methods to increase test coverage.
  • Loading branch information
hbldh committed Aug 22, 2016
2 parents bc5c900 + c4e89d8 commit 7254465
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ source = lspopt
include = */lspopt/*
omit =
*/setup.py

[report]
exclude_lines =
except ImportError:
if _version_extra:

8 changes: 4 additions & 4 deletions lspopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# release. 'dev' as a _version_extra string means this is a development
# version.
_version_major = 0
_version_minor = 1
_version_patch = 3
_version_extra = 'dev1'
# _version_extra = 'a6'
_version_minor = 2
_version_patch = 0
# _version_extra = 'dev1'
_version_extra = 'a6'
# _version_extra = '' # Uncomment this for full releases

# Construct full version string from these.
Expand Down
65 changes: 65 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`test_implementation`
==================
.. module:: test_implementation
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: hbldh <henrik.blidh@nedomkull.com>
Created on 2015-11-14
"""

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import

import unittest

import pytest
import six
import numpy as np
from numpy.testing import assert_allclose

from lspopt import utils



def test_create_lsp_realisation():
"""Test that create method is working at least."""
N = 256
c = 20.0
Fs = 8.0
x, H, Rx = utils.create_lsp_realisation(N, c, Fs)
assert len(x) == N
assert_allclose(H.shape, (N, N))
assert_allclose(Rx.shape, (N, N))


def test_create_lscp_realisation():
"""Test that create method is working at least."""
N = 256
c = 1.4
Fs = 8.0
m = 12.0
d = 0.4
x, H, Rx = utils.create_lscp_realisation(N, c, Fs, m, d)
assert len(x) == N
assert_allclose(H.shape, (N, N))
assert_allclose(Rx.shape, (N, N))


def test_create_mlsp_realisation():
"""Test that create method is working at least."""
N = 256
c = [1.4, 20.0]
Fs = 8.0
x, H, Rx = utils.create_mlsp_realisation(N, c, Fs)
assert len(x) == N
assert_allclose(H.shape, (N, N))
assert_allclose(Rx.shape, (N, N))

0 comments on commit 7254465

Please sign in to comment.